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.  [ 4 posts ] 
Author Message
 Post subject: help on Could not synchronize database state with session
PostPosted: Tue Aug 28, 2007 8:12 am 
Newbie

Joined: Tue Aug 28, 2007 8:03 am
Posts: 2
Hi,

Can anyone help me ?? Where are some good examples that use one to one and many to many relationships across a serious of page flows?. I keep getting random errors like the one above so I am obviously not using hibernate correctly. Sometimes it works sometimes it doesn't.

In particular I am having trouble when to persist the objects I create with the EntityManager and when to merge them.

What is the strategy to use when creating a serious of objects across multiple pages? i.e. Do you keep your objects transient until the last page, creating an object tree and then persist or do you persist when you create the object and incrementally apply the merge function?

I am using EJB3 and Hibernate 3.0 in conjunction with Seam and I can't find any decent examples?

Thanks in advance

Troy


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 28, 2007 9:15 am 
Newbie

Joined: Thu Apr 19, 2007 9:08 am
Posts: 2
Can You please make ur query a bit clear.What I understand from ur query is that you are actually modifying the object at various state in the code cycle .
If the case is so try Making A DAO , make it singleton and try to save or acess the objects using that DAO.

If possible ,for creating HIbernate session factory and the mapping classes ,you can always use tools such as MYECLIPSE . It will also reduce your time in creating & Setting up the hibernate enviornment.All the mappings will be made available to you by the IDE itself.

If this info does not help please try to give the classes you are using along with the mappings of hibernate then only a concrete answer could be given


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 28, 2007 1:29 pm 
Newbie

Joined: Tue Aug 28, 2007 12:54 pm
Posts: 16
Location: Munich, Germany
Have you read this ? http://www.hibernate.org/43.html
This is just one option how to solve your problem. Check the docs.
There's also loads of info on this in Christian's/Gavin's Book
"Java Persistence with Hibernate" ;-)

But isn't this supposed to be easier when using SEAM ?

Cheers, Tom.

_________________
www.tomeicher.de


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 29, 2007 6:57 am 
Newbie

Joined: Tue Aug 28, 2007 8:03 am
Posts: 2
Thanks guys, I took a while but I spent the whole day working through this, and it turns out the problem was caused by seam automatically flushing my persistence context after every request.

I kinda had objects in all sorts of states and no wonder hibernate was not happy.

A little more digging (and reading - thanks for the link Tom) it turns out that by controlling the flush manually I have a lot more control for my situation.


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

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.