voila,
je tourne sur Hibernate3 en tant que service .har sur jboss 4.0
j'attaque hibernate via un EJB session avec un pattern de commande
lorsque j'effectue une transaction,
le seul moyen d'effectuer l'insertion est d'utiliser flush
par exemple :
begin
persist
commit
close de ma session
j'ai comme debug :
16:45:18,312 DEBUG [CreateLanguage] Start execute
16:45:18,312 DEBUG [SessionFactoryObjectFactory] JNDI lookup: hibernate/SessionFactory
16:45:18,312 DEBUG [SessionFactoryObjectFactory] lookup: uid=4028811407dc6a830107dcb190d00009
16:45:18,312 DEBUG [JDBCContext] successfully registered Synchronization
16:45:18,312 DEBUG [SessionImpl] opened session at timestamp: 4641911268605952
16:45:18,312 DEBUG [HibernateHelper] Session is open
16:45:18,312 DEBUG [JTATransaction] Looking for UserTransaction under: UserTransaction
16:45:18,312 DEBUG [JTATransaction] Obtained UserTransaction
16:45:18,328 DEBUG [JTATransaction] begin
16:45:18,328 DEBUG [JDBCContext] after transaction begin
16:45:18,328 DEBUG [HibernateHelper] transaction started
16:45:18,328 DEBUG [AbstractSaveEventListener] transient instance of: com.monpkg.hibernate.Language
16:45:18,328 DEBUG [DefaultSaveOrUpdateEventListener] saving transient instance
16:45:18,328 DEBUG [AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
16:45:18,328 DEBUG [ConnectionManager] opening JDBC connection
16:45:18,328 DEBUG [SQL] select nextval ('language_idlanguage_seq')
16:45:18,328 INFO [STDOUT] Hibernate: select nextval ('language_idlanguage_seq')
16:45:18,328 DEBUG [AbstractBatcher] preparing statement
16:45:18,328 DEBUG [SequenceGenerator] Sequence identifier generated: 49
16:45:18,328 DEBUG [AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
16:45:18,328 DEBUG [AbstractBatcher] closing statement
16:45:18,328 DEBUG [ConnectionManager] aggressively releasing JDBC connection
16:45:18,328 DEBUG [ConnectionManager] closing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
16:45:18,328 DEBUG [AbstractSaveEventListener] generated identifier: 49, using strategy: org.hibernate.id.SequenceGenerator
16:45:18,328 DEBUG [AbstractSaveEventListener] saving [com.monpgk.hibernate.Language#49]
16:45:18,328 DEBUG [AbstractSaveEventListener] calling onSave()
16:45:18,328 DEBUG [APersistent] onSave Event happend
16:45:18,328 DEBUG [HibernateHelper] save done
16:45:18,328 DEBUG [JTATransaction] commit
16:45:18,328 DEBUG [HibernateHelper] Transaction commited
16:45:18,328 DEBUG [SessionImpl] closing session
16:45:18,328 DEBUG [ConnectionManager] connection already null in cleanup : no action
16:45:18,328 DEBUG [HibernateHelper] Session is closed
16:45:18,328 DEBUG [CreateLanguage] End execute
16:45:18,328 DEBUG [CacheSynchronization] transaction before completion callback
16:45:18,328 DEBUG [CacheSynchronization] automatically flushing session
16:45:18,328 DEBUG [SessionImpl] automatically flushing session
16:45:18,328 DEBUG [JDBCContext] before transaction completion
16:45:18,328 DEBUG [SessionImpl] before transaction completion
16:45:18,328 DEBUG [CacheSynchronization] transaction after completion callback, status: 3
16:45:18,328 DEBUG [JDBCContext] after transaction completion
16:45:18,328 DEBUG [SessionImpl] after transaction completion
===============================
cela ne m'insert rien en base.
en revanche si j'effectue :
begin
persist
commit
FLUSH
close de ma session
j'ai comme debug :
16:55:02,375 DEBUG [CreateLanguage] Start execute
16:55:02,390 DEBUG [SessionFactoryObjectFactory] JNDI lookup: hibernate/SessionFactory
16:55:02,390 DEBUG [SessionFactoryObjectFactory] lookup: uid=4028811407dc6a830107dcbbc155000a
16:55:02,390 DEBUG [JDBCContext] successfully registered Synchronization
16:55:02,390 DEBUG [SessionImpl] opened session at timestamp: 4641913660989440
16:55:02,390 DEBUG [HibernateHelper] Session is open
16:55:02,390 DEBUG [JTATransaction] Looking for UserTransaction under: UserTransaction
16:55:02,390 DEBUG [JTATransaction] Obtained UserTransaction
16:55:02,406 DEBUG [JTATransaction] begin
16:55:02,406 DEBUG [JDBCContext] after transaction begin
16:55:02,406 DEBUG [HibernateHelper] transaction started
16:55:02,406 DEBUG [AbstractSaveEventListener] transient instance of: com.monpkg.hibernate.Language
16:55:02,406 DEBUG [DefaultSaveOrUpdateEventListener] saving transient instance
16:55:02,406 DEBUG [AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
16:55:02,406 DEBUG [ConnectionManager] opening JDBC connection
16:55:02,406 DEBUG [SQL] select nextval ('language_idlanguage_seq')
16:55:02,406 INFO [STDOUT] Hibernate: select nextval ('language_idlanguage_seq')
16:55:02,406 DEBUG [AbstractBatcher] preparing statement
16:55:02,406 DEBUG [SequenceGenerator] Sequence identifier generated: 53
16:55:02,406 DEBUG [AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
16:55:02,406 DEBUG [AbstractBatcher] closing statement
16:55:02,406 DEBUG [ConnectionManager] aggressively releasing JDBC connection
16:55:02,406 DEBUG [ConnectionManager] closing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
16:55:02,406 DEBUG [AbstractSaveEventListener] generated identifier: 53, using strategy: org.hibernate.id.SequenceGenerator
16:55:02,406 DEBUG [AbstractSaveEventListener] saving [com.monpkg.hibernate.Language#53]
16:55:02,406 DEBUG [AbstractSaveEventListener] calling onSave()
16:55:02,406 DEBUG [APersistent] onSave Event happend
16:55:02,406 DEBUG [HibernateHelper] save done
16:55:02,406 DEBUG [JTATransaction] commit
16:55:02,406 DEBUG [HibernateHelper] Transaction commited
16:55:02,406 DEBUG [AbstractFlushingEventListener] flushing session
16:55:02,406 DEBUG [AbstractFlushingEventListener] processing flush-time cascades
16:55:02,406 DEBUG [AbstractFlushingEventListener] dirty checking collections
16:55:02,406 DEBUG [AbstractFlushingEventListener] Flushing entities and processing referenced collections
16:55:02,406 DEBUG [AbstractFlushingEventListener] Processing unreferenced collections
16:55:02,406 DEBUG [AbstractFlushingEventListener] Scheduling collection removes/(re)creates/updates
16:55:02,406 DEBUG [AbstractFlushingEventListener] Flushed: 1 insertions, 0 updates, 0 deletions to 1 objects
16:55:02,406 DEBUG [AbstractFlushingEventListener] Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
16:55:02,406 DEBUG [Printer] listing entities:
16:55:02,406 DEBUG [Printer] com.monpkg.hibernate.Language{code=Teste, eventTypeResSet=null, creationDate=29 novembre 2005, inviteFlyerResSet=null, inviteAcceptationTypeResSet=null, updateDate=29 novembre 2005, name=LangueTest, countryResSet=null, id=53, inviteCategoryResSet=null, communityCategoryResSet=null}
16:55:02,406 DEBUG [AbstractFlushingEventListener] executing flush
16:55:02,406 DEBUG [AbstractEntityPersister] Inserting entity: [com.monpkg.hibernate.Language#53]
16:55:02,406 DEBUG [AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
16:55:02,406 DEBUG [ConnectionManager] opening JDBC connection
16:55:02,406 DEBUG [SQL] insert into language (code, name, creation_date, update_date, idlanguage) values (?, ?, ?, ?, ?)
16:55:02,406 INFO [STDOUT] Hibernate: insert into language (code, name, creation_date, update_date, idlanguage) values (?, ?, ?, ?, ?)
16:55:02,406 DEBUG [AbstractBatcher] preparing statement
16:55:02,406 DEBUG [AbstractEntityPersister] Dehydrating entity: [com.monpkg.hibernate.Language#53]
16:55:02,406 DEBUG [StringType] binding 'Teste' to parameter: 1
16:55:02,406 DEBUG [StringType] binding 'LangueTest' to parameter: 2
16:55:02,406 DEBUG [DateType] binding '29 novembre 2005' to parameter: 3
16:55:02,406 DEBUG [DateType] binding '29 novembre 2005' to parameter: 4
16:55:02,406 DEBUG [IntegerType] binding '53' to parameter: 5
16:55:02,406 DEBUG [AbstractBatcher] Adding to batch
16:55:02,406 DEBUG [AbstractBatcher] Executing batch size: 1
16:55:02,406 DEBUG [AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
16:55:02,406 DEBUG [AbstractBatcher] closing statement
16:55:02,406 DEBUG [ConnectionManager] aggressively releasing JDBC connection
16:55:02,406 DEBUG [ConnectionManager] closing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
16:55:02,406 DEBUG [AbstractFlushingEventListener] post flush
16:55:02,406 DEBUG [SessionImpl] closing session
16:55:02,406 DEBUG [ConnectionManager] connection already null in cleanup : no action
16:55:02,406 DEBUG [HibernateHelper] Session is closed
16:55:02,406 DEBUG [CreateLanguage] End execute
16:55:02,406 DEBUG [CacheSynchronization] transaction before completion callback
16:55:02,406 DEBUG [CacheSynchronization] automatically flushing session
16:55:02,406 DEBUG [SessionImpl] automatically flushing session
16:55:02,406 DEBUG [JDBCContext] before transaction completion
16:55:02,406 DEBUG [SessionImpl] before transaction completion
16:55:02,421 DEBUG [CacheSynchronization] transaction after completion callback, status: 3
16:55:02,421 DEBUG [JDBCContext] after transaction completion
16:55:02,421 DEBUG [SessionImpl] after transaction completion
==============================
la documentation precise que c'est sur le commit que l'insert de declanche mais dans mon cas, il ne se passe rien. je suis obligé de flusher.
quelqu'un aurait-il une idée ???
merci
|