-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: How to use restrictions
PostPosted: Fri Oct 22, 2010 2:27 am 
Newbie

Joined: Fri Oct 22, 2010 2:15 am
Posts: 1
I am using Spring Hibernate


How to Use restrictions like following in DAO

Criteria criteria = getSession().createCriteria(Inventory.class);
Criterion itemCodeCriterion = Restrictions.eq("inventoryItem.itemCode",itemCode);
Criterion itemDescriptionCriterion = Restrictions.like("inventoryItem.itemDescription",
itemDescription, MatchMode.ANYWHERE);
criteria.add(itemCodeCriterion);
criteria.add(itemDescriptionCriterion);
return criteria.list();

The Inventory Model has the following definition(Inventory.Java)

private long id;
private InventoryItem inventoryItem;
private StoreHouse storeHouse;
private Organization organization;

and the InventoryItem(Inventoryitem.java) has the following

private long id;
private InventoryItemGroup inventoryItemGroup;
private String itemCode;
private String itemDescription;
private String itemSpecification;


when i ran the Restriction i am getting the error

org.hibernate.QueryException: could not resolve property: inventoryItem.itemCode of: com.realty.model.Inventory at rg.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:81)
at org.hibernate.persister.entity.AbstractPropertyMapping.toColumns(AbstractPropertyMapping.java:96)
at


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.