Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

需求:增加新的Callback注入任意类型bean的对应属性 #541

Closed
wxs123456 opened this issue Oct 30, 2013 · 9 comments
Closed
Assignees
Labels
Milestone

Comments

@wxs123456
Copy link

应用场景:
A表有2两个字段,A1,A2,
映射后的实体类是也只有这两个属性,
现在我有个SQL语句
select A1,A2,(select count(*) from B where b.a1=a.a1) A3
FROM A;

为了得到计算列,我在实体类里添加属性A3,不加@column,,

通过
Sql sql = Sqls.create(sbsql.toString());
sql.setCallback(Sqls.callback.entities());
sql.setEntity(dao.getEntity(A.class));
dao.execute(sql);
List ls=sql.getList(A.class);
无法取到A3的值,
如果声明了@column,则可以取到。

@ywjno
Copy link
Member

ywjno commented Oct 30, 2013

A1 A2 这两属性是否用了@column注解?

@wxs123456
Copy link
Author

用了

在 2013-10-30 16:08:17,"Thomas Yang" notifications@github.com 写道:

A1A2 这两属性是否有用了@column注解?


Reply to this email directly or view it on GitHub.

@ywjno
Copy link
Member

ywjno commented Oct 30, 2013

如在 POJO 中用了@column注解,那么没有该注解的属性会被忽略掉,详细请看 nutz 的手册

@zozoh
Copy link
Member

zozoh commented Nov 3, 2013

这种情况,你可以为你的A3 声明 @Readonly 属性

@wxs123456
Copy link
Author

我的意思 可以增加一种新的解析方式,用于传入任意bean来获取值,而不需要声明任意属性,这对于自定义查询而不需要写自定义回调函数有很积极的意义。

@ywjno
Copy link
Member

ywjno commented Nov 9, 2013

参照 #456 这个pull request 来改代码自己实现吧。。。

@zozoh
Copy link
Member

zozoh commented Nov 12, 2013

@wxs123456 能说的再详细些吗?

@wendal
Copy link
Member

wendal commented Feb 10, 2015

新版的Record支持带前缀的toEntity操作了

@wendal wendal closed this as completed Feb 10, 2015
@wendal
Copy link
Member

wendal commented Feb 10, 2015

回调也是

@wendal wendal added this to the 1.b.52 milestone Feb 10, 2015
@wendal wendal self-assigned this Feb 10, 2015
@wendal wendal added the Dao label Feb 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants