I'm using the chenillekit hibernate daos, and there is no explicit update
method, so i thought save() should do this job.
I don't understand why there is a new Object if I annotade the config with
@Persist. Shouldn't it be saved in the Session?
btw: i found a possible solution with page activation context:
void onActivate(Long configId){
config=configDAO.doRetrieve(configId,false);
}
Long onPassivate(){
return config.getId();
}
but I still want to know why it won't work with @Persist?
-----Ursprüngliche Nachricht-----
Von: Jose Luis Sanchez [mailto:[email protected]]
Gesendet: Montag, 8. Februar 2010 10:21
An: Tapestry users
Betreff: Re: Updating Hibernate Entites
You are trying to save a new object while using the old object id ,
what would end in two entities with same id - something not possible.
You should call your DAO update method , instead of save.
> Hello List,
>
>
>
> i'm trying to update an Hibernate-Object but alway get an "a different object
> with the same identifier value was already associated with the session:"
> Exception.
>
>
>
> My Form-Code looks like:
>
> @Inject
>
> private ConfigurationDAO configDAO;
>
> @Persist
>
> @Property
>
> private Configuration config;
>
>
>
> void onSuccessFromConfigForm(){
>
> config.setEditDate(new Date());
>
> configDAO.doSave(config);
>
> }
>
>
>
> void onActivate(Long configId){
>
> config=configDAO.doRetrieve(configId,false);
>
> }
>
> void onActivate(){
>
> configs = configDAO.findAll();
>
> if(config==null)
>
> config=new de.leomedia.leotipp.model.Configuration();
>
> }
>
>
>
> can anyone give me a lead into the right direction?
>
>
>
> thanks, Dominik
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]