-
1. Re: How to connect my EJB to firebird database?
andydale Jan 29, 2007 11:39 AM (in response to g_zaspa)Hi,
You need to configure a persistence.xml file and then pack it in the META-INF dir of the ejb jar. The persistence.xml will look somethjing like so:<?xml version="1.0" encoding="UTF-8"?> <persistence> <persistence-unit name="myPU"> <jta-data-source>java:/<you firebird ds name></jta-data-source> <class><managed class name></class> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.FirebirdDialect"/> <property name="hibernate.hbm2ddl.auto" value="create-drop"/> </properties> </persistence-unit> </persistence>
You can then inject an EntityManager with the @PersistenceContext annotation within a Session bean.
Cheers,
Andy -
2. Re: How to connect my EJB to firebird database?
g_zaspa Jan 29, 2007 12:17 PM (in response to g_zaspa)I do about that and try to do the simplest way. My persistence.xml is
<?xml version="1.0" encoding="UTF-8"?>
<persistence-unit name="order" transaction-type="JTA">
<jta-data-source>java:/FIrebirdDS</jta-data-source>
</persistence-unit>
My EJB begins with:
@Stateless
@RemoteBinding(jndiBinding="ejb/Person")
public class PersonBean implements Person {
//@PersistenceContext EntityManager em;
When I deploy my .ear with this EJB, I get an error message in JBoss console with the last part:
--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: jboss.jca:name=FIrebirdDS,service=DataSourceBinding
State: NOTYETINSTALLED
Depends On Me:
persistence.units:ear=EJB3Test.ear,jar=EJB3Test.jar,unitName=order
persistence.units:ear=EJB3Test.ear,jar=EJB3Test.jar,unitName=order
persistence.units:ear=EJB3Test.ear,jar=EJB3Test.jar,unitName=order
But nevertheless .ear is deployed and I can reach my PersonBean EJB from a remote client on JNDI name and call it's business method. But as soon as I uncomment
//@PersistenceContext EntityManager em;
and redeploy my .ear, I cannot reach PersonBean EJB any more -
Object ref = context.lookup("ejb/Person"); in my client generates NameNotFoundException