wood burning stoves*
The moose likes Object Relational Mapping and the fly likes Doubt on hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Doubt on hibernate" Watch "Doubt on hibernate" New topic
Author

Doubt on hibernate

syruss kumar
Ranch Hand

Joined: Jul 23, 2009
Posts: 93
Hi all,

I have return a class in which i have 2 tables 1.Cart_new 2.cart_items.primary key of cart_new is mapped as a foreign key to cart_items

While im trying to get the values i got this error.


Exception in thread "main" java.lang.ClassCastException: org.hibernate.collection.PersistentSet cannot be cast to java.util.HashSet



Can't we cast that?
Can any one suggest me ?
Thanks in advance


All search starts with beginner's luck and all search ends with victor's severly tested.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Don't initialize your cartItems property to a HashSet, let Hibernate decided what implementation it will use and code to the interface.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
syruss kumar
Ranch Hand

Joined: Jul 23, 2009
Posts: 93
Thanks a lot paul,

i have resolved that issue but while i tried to save that i got could not instantiate id generator exception.

java.lang.ExceptionInInitializerError
Caused by: org.hibernate.MappingException: could not instantiate id generator
at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:97)
at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:152)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:182)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
at com.Helper.sessionCreator.createSession(sessionCreator.java:16)
at com.DataAccessObjects.CartDAO.<clinit>(CartDAO.java:14)
Caused by: org.hibernate.MappingException: param named "property" is required for foreign id generation strategy
at org.hibernate.id.ForeignGenerator.configure(ForeignGenerator.java:82)
at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:93)
... 5 more





i surfed in the net but couldnt resolved this .
is it a jar problem.im using hibernate3.jar

Can anyone help me to resolve this ?
Thanks in advance
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt on hibernate
 
Similar Threads
issue with Xdocler Ant Task
Batch Delete Problem
Hibernate Query by Example
Hibernate and MS Access?
Hibernate how to update only one colum value