[jboss-user] [EJB 3.0] - Re: problem with test invocation of session bean

dmitryak do-not-reply at jboss.com
Wed Jan 10 06:06:04 EST 2007


ok.

I will try to help you, but i am not sure that I can. :))

try to change your code

public class TestSessImpl implements TestSession, TestSessionRem{
  | @PersistenceUnit(unitName="hotel")
  | private EntityManagerFactory entityFactory;
  | private EntityManager entityManager;
  | 

to

public class TestSessImpl implements TestSession, TestSessionRem{
  | @PersistenceContext
  | private EntityManager entityManager;
  | 

and 

public TestEntity saveTestEntity(TestEntity entity) {
  | try{
  | EntityManager manager = entityFactory.createEntityManager();
  | manager.persist(entity);
  | }catch(Exception ex){
  | System.out.println(ex.getMessage());
  | }
  | return entity;
  | } 

to

public TestEntity saveTestEntity(TestEntity entity) {
  |     return manager.persist(entity);
  | }

If it doesn't help let me know...

P.S. I am sorry for my english

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3999852#3999852

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3999852



More information about the jboss-user mailing list