geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Zink <jochenl...@web.de>
Subject Re: Geronimo 2..01 + Hibernate + MDB
Date Fri, 12 Oct 2007 09:36:55 GMT
Thanks for your answer.

That is exactly what I want. 
But it does not work, as I expected ;).

1) I changed the DataSource to "no-transaction"
2) The MDB has Container Managed Transaction
3) the Hibernate Configuration looks like:
hibernate.connection.datasource=java:comp/env/jdbc/pushAEConnectionPool
hibernate.dialect=org.hibernate.dialect.Oracle9Dialect
hibernate.hbm2ddl.auto=validate

The strange thing is, f I add new Data with Hibernate, it works. The data is written to the
Database after the hibernate commit(); 
1. Transaction tx = session.beginTransaction();
2. session.save(...);
3. tx.commit(); -> written to the database

but, if I use the update Method, no change to the database happens.
1. Transaction tx = session.beginTransaction();
2. session.update(...);
3. tx.commit(); -> not data is written to the database

So, I believe it has something to do with Locks. But I don' know. I anyone has an idea, it
would be great :)

Thanks a lot!
Regards
Jochen


> -----Ursprüngliche Nachricht-----
> Von: user@geronimo.apache.org
> Gesendet: 11.10.07 19:12:34
> An: user@geronimo.apache.org
> Betreff: Re: Geronimo 2..01 + Hibernate + MDB


> 
> I'm not entirely sure I understand what you want.... let me try to  
> restate it:
> 
> -- calls to the mdb should be run in a JTA transaction, so if you  
> call setRollbackOnly the message will be redelivered
> -- whether the JTA transaction commits or rolls back, the hibernate  
> work should be done in a separate hibernate-controlled hibernate  
> transaction
> 
> You can get this effect by using container managed transaction for  
> the MDB and using a  no-transaction datasource for hibernate.  If you  
> generated the plan for the datasource using the console it will have  
> a <local-transaction> element; if you replace this with <no- 
> transaction> and deploy the plan from the command line or "deploy  
> new" in the console you should get a suitable configuration.
> 
> thanks
> david jencks
> 
> On Oct 11, 2007, at 5:52 AM, Jochen Zink wrote:
> 
> > Hello,
> >
> > I'm using Hibernate 3.2, Geronimo 2.0.1 and I have a MDB.
> >
> > Hibernate uses a global Connection Pool, which is deployed in  
> > Geronimo. That works.
> >
> > Inside the MDB there are some Saveactions to the database, which  
> > looks like this:
> >
> > Session session = Sessionfactory.openSession();
> > Transaction tx = session.beginTransaction();
> > session.save(..);
> > tx.commit();
> > session.close();
> > etc.
> >
> > My problem is, that no object is stored to the Database, after the  
> > commit();
> >
> > I guess, this is only a Configuration Problem, from Hibernate And/ 
> > or the MDBs Transaction Type.
> >
> > If I call setRollbackOnly() on the MessageDrivenContext(), I want  
> > that only the Message is redelivered to the MDB and not, that the  
> > hibernateTransactions are rollbacked. (Sorry for my bad English).
> >
> > The Transaction-Type of the MDB is set to Bean (is this right?)
> >
> > And the Hibernateconfiguration looks like this:
> > hibernate.connection.datasource=java:comp/env/jdbc/ 
> > pushAEConnectionPool
> > hibernate.dialect=org.hibernate.dialect.Oracle9Dialect
> > hibernate.hbm2ddl.auto=validate
> >
> >
> > I believe, that there must be some stuff like
> > hibernate.transaction.factory_class=org.hibernate.transaction.JTATrans 
> > actionFactory
> > hibernate.current_session_context_class=jta
> > hibernate.transaction.manager_lookup_class=?
> >
> > But, I also believe, that the simple stuff, without using  
> > JTATransactions should work.
> >
> > The whole application runs perfectly, if I use a local DataSource  
> > and not a Hibernate ConnectionPool.
> >
> > I found this example, but I was not able to find a solution for my  
> > problem inside.
> > http://cwiki.apache.org/GMOxDOC20/jboss-to-geronimo-hibernate- 
> > migration.html
> >
> > Thanks a lot for your help.
> > Regards
> > Jochen
> >
> >
> >
> >
> > ______________________________________________________________________ 
> > ____
> > Erweitern Sie FreeMail zu einem noch leistungsstärkeren E-Mail- 
> > Postfach!		
> > Mehr Infos unter http://produkte.web.de/club/?mc=021131
> >
> 
> 


_______________________________________________________________________
Jetzt neu! Schützen Sie Ihren PC mit McAfee und WEB.DE. 3 Monate
kostenlos testen. http://www.pc-sicherheit.web.de/startseite/?mc=022220


Mime
View raw message