Comments (5)
@cotide 你的实体中是否有定义 value
这个字段?
from anima.
我使用实体进行查询能正常工作
实体
@Table(name = "user_info")
@Data
public class UserInfo extends Model{
@Column(name = "user_id")
private int userId;
@Column(name = "`value`")
private String value;
}
测试代码
@Test
public void query(){
Anima.open(url,user,pass);
UserInfo result = select().from(UserInfo.class).where(UserInfo::getUserId,1).one();
System.out.println(result.getUserId());
System.out.println(result.getValue());
}
输出结果
09:48:40.244 [main] DEBUG org.sql2o.Query - Execute SQL => SELECT * FROM user_info WHERE user_id = ? LIMIT 1
09:48:40.247 [main] DEBUG org.sql2o.Query - Parameters => [1]
09:48:40.273 [main] DEBUG org.sql2o.Query - Total => 29 ms, execution: 18 ms, reading and parsing: 11 ms; executed [null]
1
hello world
能正确输出~
使用bySQL查询user_id字段值
@Test
public void query(){
Anima.open(url,user,pass);
int value = select().bySQL(
Integer.class,"select `user_id` from user_info where user_id = 1").one();
System.out.println(value);
}
能正确输出内容
使用bySQL查询value字段值
@Test
public void query(){
Anima.open(url,user,pass);
String value = select().bySQL(
String.class,"select `value` from user_info where user_id = 1").one();
System.out.println(value);
}
from anima.
使用bySQL 查询返回对象为String.class并且针对value字段时候不能正常工作
from anima.
这个问题已经修复了,在 6bedcc0 ,你可以继续使用快照版本尝试。
mvn clean compile -U
记得更新一下最新依赖
from anima.
OK~ 获取最新代码,问题已经解决了~
from anima.
Related Issues (20)
- 继承了Model的类无法使用Gson转换为JSON HOT 3
- 很看好这个库,强烈支持,望今后持续更新下去!
- 一点疑惑
- 已经开始公司部分程序中使用anima了
- 使用Anima.atomic连接池泄露 HOT 1
- ORACLE 支持
- java.lang.NoClassDefFoundError: com/blade/reflectasm/MethodAccess HOT 1
- 帮忙看一下这个错误是如何引起的 HOT 1
- 0.2.5版本没有isNull()这个接口
- 对模型执行update操作后id属性被置为NULL HOT 2
- 请问在insert时除了save可以BY
- 请问在insert时除了save可以BYSQL HOT 1
- 请问使用这个库可以调用存储过程吗 HOT 1
- 关于methodToFieldName方法,methodName.replace("get", "")问题
- increase value by 1
- Model类为内部类时save会报错
- 动态条件的优化问题 HOT 1
- page()的时候是不是没有设置columnmapping 字段的映射关系?
- Using Anima.deleteBatch get an exception HOT 1
- Got Keys were not fetched from database, Postgresql
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from anima.