Hi,

are you sure your model is a LDM?
IIRC you have a ListView involved. What's the type of this.getDefaultModel() ?

I suppose that normal execution is ...

Yes, this is the way it is supposed to work.

Sven

On 06/03/2011 07:55 PM, Gonzalo Aguilar Delgado wrote:
Hi Again,

I checked why I'm receiving this nasty error. It seems that fails in
this piece of code of the submit form:

                        @Override
                        protected void onSubmit() {
                                log.debug("Saving content");
                                IModel model = this.getDefaultModel();
                                Lead object = (Lead)model.getObject();
                                if(leadDAO!=null&&  object!=null)
                                {
------>Is not attached                if(leadDAO.isAttached(object))
                                        leadDAO.save(object);
                                }
                                super.onSubmit();
                        }

That's strange because behind there is a LoadableDetachableModel  that
loads this object. If it's loaded in the submit it MUST be same
transaction that loaded it. Maybe it opened another one?

Anyway it must be attached because nothing happened in the middle. But
is not.

Why? Is this normal?

I suppose that normal execution is:

        * Submit is performed.
        * load() method of the model is executed because transient object is
lost on this new http session.
        * object loaded is sent to the CompoundPropertyModel that encloses it.
        * The object is updated by the CompoundPropertyModel model.
        * onSubmit() is executed
        * getObject() does not executes load() function of the
LoadableDetachableModel because it already was loaded.
        
Here comes the question... So then, Why it's not attached? Who oppened a
new transaction? Why?

LOGS
-------------------------
When onSubmit logs shows as follows:
DEBUG - Collections                - Collection found:
[com.level2.enterprise.hibernate.generated.Lead.leadIdentifiers#com.level2.enterprise.crm.hibernate.datatypes.UuidUserType@642b6fc7],
 was: 
[com.level2.enterprise.hibernate.generated.Lead.leadIdentifiers#com.level2.enterprise.crm.hibernate.datatypes.UuidUserType@642b6fc7]
 (uninitialized)
DEBUG - Collections                - Collection found:
[com.level2.enterprise.hibernate.generated.Lead.leadBasicDetails#com.level2.enterprise.crm.hibernate.datatypes.UuidUserType@642b6fc7],
 was: 
[com.level2.enterprise.hibernate.generated.Lead.leadBasicDetails#com.level2.enterprise.crm.hibernate.datatypes.UuidUserType@642b6fc7]
 (uninitialized)
DEBUG - tractFlushingEventListener - Flushed: 0 insertions, 0 updates, 0
deletions to 1 objects
DEBUG - tractFlushingEventListener - Flushed: 0 (re)creations, 0
updates, 0 removals to 2 collections
DEBUG - Printer                    - listing entities:
DEBUG - Printer                    -
com.level2.enterprise.hibernate.generated.Lead{dateLead=2009-04-03
00:00:00, leadBasicDetails=<uninitialized>, email=t...@test.com,
dateCreated=2009-11-05 00:00:00, leadIdentifiers=<uninitialized>,
idLot=132,
uuid=com.level2.enterprise.crm.hibernate.datatypes.UuidUserType@642b6fc7, 
dateUpdated=2011-04-27 20:52:15}
DEBUG - JDBCTransaction            - re-enabling autocommit
DEBUG - JDBCTransaction            - committed JDBC Connection
DEBUG - ConnectionManager          - transaction completed on session
with on_close connection release mode; be sure to close the session to
release JDBC resources!
DEBUG - ibernateTransactionManager - Closing Hibernate Session
[org.hibernate.impl.SessionImpl@5ce0f945] after transaction
DEBUG - SessionFactoryUtils        - Closing Hibernate Session
DEBUG - ConnectionManager          - releasing JDBC connection [ (open
PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
DEBUG - ConnectionManager          - transaction completed on session
with on_close connection release mode; be sure to close the session to
release JDBC resources!
--------------------------------------------------
There's one transaction completed. I suppose the one that loaded it.

The isAttached created a new transaction:
--------------------------------------------------
DEBUG - ScaffoldingForm            - Saving content
DEBUG - ibernateTransactionManager - Creating new transaction with name
[com.googlecode.genericdao.dao.hibernate.GenericDAO.isAttached]:
PROPAGATION_REQUIRED,ISOLATION_DEFAULT
DEBUG - SessionImpl                - opened session at timestamp:
13071235926
DEBUG - ibernateTransactionManager - Opened new Session
[org.hibernate.impl.SessionImpl@145edcf5] for Hibernate transaction
DEBUG - ibernateTransactionManager - Preparing JDBC Connection of
Hibernate Session [org.hibernate.impl.SessionImpl@145edcf5]
DEBUG - JDBCTransaction            - begin
DEBUG - ConnectionManager          - opening JDBC connection
DEBUG - JDBCTransaction            - current autocommit status: true
DEBUG - JDBCTransaction            - disabling autocommit
DEBUG - ibernateTransactionManager - Exposing Hibernate transaction as
JDBC transaction [jdbc:postgresql://127.0.0.1:5432/op_development_es,
UserName=user_development, PostgreSQL Native Driver]
DEBUG - ibernateTransactionManager - Initiating transaction commit
DEBUG - ibernateTransactionManager - Committing Hibernate transaction on
Session [org.hibernate.impl.SessionImpl@145edcf5]
DEBUG - JDBCTransaction            - commit
DEBUG - JDBCTransaction            - re-enabling autocommit
DEBUG - JDBCTransaction            - committed JDBC Connection
DEBUG - ConnectionManager          - transaction completed on session
with on_close connection release mode; be sure to close the session to
release JDBC resources!
DEBUG - ibernateTransactionManager - Closing Hibernate Session
[org.hibernate.impl.SessionImpl@145edcf5] after transaction
DEBUG - SessionFactoryUtils        - Closing Hibernate Session
DEBUG - ConnectionManager          - releasing JDBC connection [ (open
PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
DEBUG - ConnectionManager          - transaction completed on session
with on_close connection release mode; be sure to close the session to
release JDBC resources!
--------------------------------------------

Why? Because on the new transaction it will not be attached so I cannot
save it. I suppose it must continue with the same transaction that
loaded it.



Thank you in advance.






"No subestimes el poder de la gente estúpida en grupos grandes"

El vie, 03-06-2011 a las 09:26 +0200, Gonzalo Aguilar Delgado escribió:
Hi Sven,

Thank you for the update. I will check why they are not detached... They
should.

Tnx again.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to