Hello to one and all. I have had a little problem for the homework of Hibernate Query Language. I have done HQL but i could not finish Criteria with restrictions and Query by example. My code for criteria with restrictions is shown as below.
{ System.out.println("\n---Using criteria API with Restrictions ..."); Supplier supplier1 = new Supplier(); supplier1.setName("SamSung"); supplier1.setId(1); session.save(supplier1); Criteria crit = session.createCriteria(Product.class); crit.add(Restrictions.le("price",new Double(1000.0))); crit.add(Restrictions.eq("supplier", supplier1)); List results = crit.list(); displayProductsList(results); } But it does not return any value and i got ne record found.. My code for query by example is shown as below. { System.out.println("\n---Using criteria with Query By Example ..."); Criteria prdCrit = session.createCriteria(Product.class); Product product = new Product(); product.setName("T%"); Example prdExample = Example.create(product); prdExample.excludeProperty("price"); prdExample.enableLike(); List results = prdCrit.list(); displayProductsList(results); } It also does not return any record.. How can i fix it. Help me Please.. -- Regards KolluraniPandian A (Living in Virtual World) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Java EE (J2EE) Programming with Passion!" group. To post to this group, send email to java-ee-j2ee-programming-with-passion@googlegroups.com To unsubscribe from this group, send email to java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en -~----------~----~----~----~------~----~------~--~---