File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Hibernate Criteria For Child One-To-Many Relationship Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate Criteria For Child One-To-Many Relationship" Watch "Hibernate Criteria For Child One-To-Many Relationship" New topic
Author

Hibernate Criteria For Child One-To-Many Relationship

bagus winarno
Greenhorn

Joined: Apr 29, 2013
Posts: 2
Hi,
I have relation one to many table like this
CUSTOMER(ID, NAME, ADDRESS) ONE-TO-MANY ORDER(ID,ID_PRODUCT, DATE)

this is my sql code = "SELECT * FROM CUSTOMER LEFT JOIN ORDER ON CUSTOMER.ID=ORDER.ID WHERE ID_PRODUCT LIKE '001' "
If I use DetachCriteria how I can write the criteria correctly


DetachedCriteria crit = DetachedCriteria.forClass(getDomainClass());

/**How can I write the criteria here**/

crit.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);

Thanks for your help.


[Thumbnail for menggunakan createCriteria HQL.png]

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Hibernate Criteria For Child One-To-Many Relationship
 
Similar Threads
session take older value
Using Oracle squence in Hibernate
Designing in Hibernate
Transposing rows to columns
how to write the jpql to query against the one to many table