-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: POJO class is not stored in the database in an ejb session
PostPosted: Sun Feb 04, 2007 5:20 pm 
Newbie

Joined: Tue Jan 30, 2007 5:58 pm
Posts: 14
Hi,

I want to persist a POJO class in a stateless session bean. I have read the tutorial (I use a BMT transaction) and I have no exception, BUT the POJO bean is NOT stored in the database at the end.

What can I do to solve this problem ?
Thanks for your help.

My configuration is : Hibernate + Jboss + JDK 1.5

Code in the stateless Session Bean:
Actor actor = null;
UserTransaction tx = null;

try {
actor = new Actor();
actor.setFirstname(firstname);
actor.setName(name);

EntityManagerFactory emf = Persistence.createEntityManagerFactory("dvdstorePU");

EntityManager em = emf.createEntityManager();

tx = (UserTransaction) new InitialContext().lookup("UserTransaction");
tx.begin();
em.persist(actor);
tx.commit();
em.close();
catch(….)
{}

Ejb-jar.xml :
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
</session>
</enterprise-beans>

Persistence.xml :
….
<properties>
<property name="hibernate.archive.autodetection" value="class, hbm" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.dialect"
value="org.hibernate.dialect.MySQLDialect" />
<property name="hibernate.connection.driver_class"
value="com.mysql.jdbc.Driver" />
<property name="hibernate.connection.url"
value="jdbc:mysql://localhost:3306/dvdstore" />
<property name="hibernate.connection.username" value="root" />
<property name="hibernate.connection.password"
value="system" />
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
</properties>
…….


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.