-->
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: Detection new/already persisted entity
PostPosted: Mon Feb 12, 2007 8:48 am 
Newbie

Joined: Mon Feb 12, 2007 8:40 am
Posts: 2
Hi!

I'm using JPA under Tomcat while using Hibernate. My question is: how can I detect whether an object is new (= not yet persisted) or somewhere in an earlier layer of the application simply loaded.

Not every one of the dozen entity beans in my application have a simple one-attribute primary key I can check genericly for null. Is there a way to ask the Entity Manager this - something like em.contains() but then not only for the current persistence context but altogether: how can I detect if an entity has not yet been persisted yet?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 15, 2007 6:43 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I don't see anything simple

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 16, 2007 6:57 am 
Newbie

Joined: Mon Feb 12, 2007 8:40 am
Posts: 2
emmanuel wrote:
I don't see anything simple


Ehhh...what do you mean?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 20, 2007 6:50 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I don't see anything simple to address your problem

_________________
Emmanuel


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.