Here a small page sample

class EditPage
{
  @PageContext
  @Property
  private Configuration configuration;

  @Inject
  private ConfigurationDAO configDAO;

  @OnEvent(value = EventConstants.PREPARE)
  void onPrepare()
  {
        if (configuration == null)
            entity = new de.leomedia.leotipp.model.Configuration();
  }

    @OnEvent(value = EventConstants.SUCCESS)
    void onSuccess()
    {
        doSaveEntity();
    }

    @CommitAfter
    private void doSaveEntity()
    {
        configDAO.doSave(configuration);
    }
}

with regards
Sven Homburg
Founder of the Chenille Kit Project
http://chenillekit.codehaus.org




2010/2/8 Dominik Gätjens <[email protected]>

> 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
>
>

Reply via email to