Model People
@Entity
@Table(name="people")
public class People extends Model {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public int id;
public String name;
public String location;
@Transient
@Formula(select = "(SELECT ISNULL(`name`) + ISNULL(`location`) Num_Null FROM `people` where id = ${ta}.id )")
public String count;
....
}
List<People> records = find.select("id, count").findList();
When i run the above query, the resultant object has values for id field, but null for count field. If i remove the @Transient
annotation it works perfectly, but
i don't want the formula to execute for every query. So in order to restrict, i am using @Transient
annotation.
ebean
generated SQL query in Mysql workbench
, it shows the value for both id and count fields. Please help me to sort this issue.When i run the above query, the resultant object has values for id field, but null for count field. If i remove the
@Transient
annotation it works perfectly, but i don't want the formula to execute for every query. So in order to restrict, i am using@Transient
annotation.
List<People> records = find.select("id, count").findList();
In my case, count field is the one with @Transient and @Formula annotation. I already mentioned count field in my select statement.
Please correct me, if i have done anything wrong.
Thanks,
Sivakumar.R
--
---
You received this message because you are subscribed to a topic in the Google Groups "Ebean ORM" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ebean/Q8Xgtla0X4k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ebean+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Daryl,That's what i have done here,List<People> records = find.select("id, count").findList();
In my case, count field is the one with @Transient and @Formula annotation. I already mentioned count field in my select statement.
Please correct me, if i have done anything wrong.