-->
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.  [ 3 posts ] 
Author Message
 Post subject: Calling one EJB from another EJB
PostPosted: Tue May 03, 2005 12:31 pm 
Beginner
Beginner

Joined: Thu Jan 13, 2005 10:31 am
Posts: 20
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 2.17


Hi,

My environment is Eclipse 3.0 with Lomboz Plugin; JBoss 3.2.3 Application Server; Microsoft SQL Server 2000 Database; Hibernate 2.17

The web application I am working on is using 2 different datasources (odbc-ds.xml and mssql-ds.xml). One is using Sun's ODBC-JDBC Driver while the other one is using Microsoft's SQL Server JDBC Driver.

I have 2 EJBs (Stateless Session Beans): PageEngine and ConfigurationManager.
"PageEngine" is using Sun's ODBC-JDBC Driver and is not using Hibernate.
"ConfigurationManager" is using Microsoft's SQL Server JDBC Driver. The "ConfigurationManager" uses Hibernate 2.17. In it I am using Thread Local Pattern.

In one of the methods of "ConfigurationManager", I need to call a method in "PageEngine". So I create a new method getPageEngine() in
"ConfigurationManager" to get the remote interface of "PageEngine".

private pageEngine getPageEngine() {
// Remote interface
pageEngine pe = null;

try {
// Home interface
pageEngineHome peHome = pageEngineUtil.getHome();
pe = peHome.create();
} catch (NamingException ne) {
System.out.println( "ConfigurationManager.java: getPageEngine():
NamingException= " + ne.getMessage() );
ne.printStackTrace();
} catch (RemoteException re) {
System.out.println( "ConfigurationManager.java: getPageEngine():
RemoteException= " + re.getMessage() );
re.printStackTrace();
} catch (CreateException ce) {
System.out.println( "ConfigurationManager.java: getPageEngine():
CreateException= " + ce.getMessage() );
ce.printStackTrace();
}
return pe;
}


Now I use it in my code :

pageEngine pe = getPageEngine();
String formCode = pe.detailEngine( sessionMap, "systemOptionDet", "systemOptionKeys", rs );

and dispaly the data in a JSP. Everything works fine except that in the log file I got a warning twice:


WARN [TxConnectionManager] Prepare called on a local tx. Use of local
transactions on a jta transaction with more than one branch may result in
inconsistent data in some cases of failure.

I look into detail and find out that the above warning is issued twice when i call the pe.detailEngine() method.
I tried different things:
1) commit the Hibernate Transaction and then call the pe.detailEngine() method
2) commit the Hibernate Transaction, close the Hibernate Session and then call the pe.detailEngine() method

Still the warning is coming up twice.

Can somebody explain this error and its remedy?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 04, 2005 11:43 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Do you have Hibernate configured to use jdbc-transactions or jta-transactions?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 20, 2005 10:05 am 
Beginner
Beginner

Joined: Thu Jan 13, 2005 10:31 am
Posts: 20
jta-transactions[/quote]


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

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.