Hi All,
I have two tables " application " and " user ". So Application has @ManyToMany relation with User. below is the code for @ManyToMany.
Application.java --------------------- protected List<User> users= new ArrayList<User>(0);
@ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE}) @JoinTable( joinColumns=@JoinColumn(name="application_fk"), inverseJoinColumns=@JoinColumn(name="user_fk")) @ForeignKey(name="FK_USER_APPLICATION", inverseName="FK_APPLICATION_USER") @IndexColumn(name="applicant_order", base=0) public List<User> getUsers() { return users; } public void setUsers(List<User> users) { this.users= users; }
i want to select first object in the "users" as column in the query . some thing like below code.
select users[0].zipCode , count(users[0].zipCode), sum(amount) , avg(amount) from Application
users[0] is the first object in the "users" list. do we have provision for doing this in hibernate.
can some one please help me to solve this issue. has any one come across such issue.
regards, ganesh
|