-->
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: Time of Persistence of Objects
PostPosted: Tue Aug 07, 2007 7:06 am 
Newbie

Joined: Fri Jul 27, 2007 5:48 am
Posts: 8
Hey,

Can any one tell the when objects get persisted in database using Hibernate annotations?

public class LocalizedString {

private static boolean dealerSites; // if true, then read from db else values

@CollectionOfElements
@MapKey(columns = { @Column(name = "locale", nullable = false)})
private Map<Locale, String> values;

public LocalizedString(LocalizedString localizedString)
{
setValues(new HashMap<Locale, String>(localizedString.getValues()));
}

public void setValues(Map<Locale, String> values)
{
this.values = values;
}
public Map<Locale, String> getValues()
{
if (dealersites == true)
{
//read from db
}

}
}

If when dealersites is true & a new LocalizedString getting created (& a call to setValues), then getValues if called (it will be read from database) , it will return NULL, or in the mean time values set via setValues will get stored in database?

So, when the object gets persisted in database - when no furhter reference to object / as soon as any change in the object is made?

Thanks,
Sucheta.


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.