Seems ok but you must also define
org.exolab.castor.jdo.DataObjects as JNDI resource and get Database
object though it something like:
DataObjects dao;//as instance field of ejb
//sequence for you method
Database db= dao.getDatabase();
db.close();
I don't know exactly how you can acomplish this in Weblogic
but in JBoss works fine and configured by custom MBean interface that you
can find on JBoss site.
Something like that:
<jboss.jcml>
<mbean code="org.jboss.jdo.castor.CastorJDOImpl"
name="DefaultDomain:service=CastorJDO,name=TestCastor">
<attribute
name="Configuration">file:///C:/Castor/test_db.xml</attribute>
<attribute
name="JndiName">ContractJDO</attribute>
<attribute
name="LockTimeout">0</attribute>
<attribute
name="LoggingEnabled">false</attribute>
<attribute
name="CommonClassPath">false</attribute>
<attribute
name="AutoStore">false</attribute>
</mbean>
</jboss.jcml>
<jboss.xml>
<jboss>
<enterprise-beans>
<session>
<ejb-name>Test</ejb-name>
<jndi-name>test/Test</jndi-name>
<resource-ref>
<res-ref-name>jdo/Test</res-ref-name><!--
this is a name you are using in you
ejb-->
<jndi-name>java:/ContractJDO</jndi-name>
</resource-ref>
</session>
</enterprise-beans>
</jboss>
</jboss.xml>
<ejb-jar.xml>
...
<session>
<ejb-name>Test</ejb-name>
<home>...</home>
<remote>...</remote>
<ejb-class>...</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref>
<res-ref-name>jdo/Contract</res-ref-name>
<res-type>org.exolab.castor.jdo.DataObjects</res-type><!--this
is a type of resource
-->
<res-auth>Container</res-auth>
</resource-ref>
</session>
...
</ejb-jar.xml>
That's all.
----- Original Message -----
Sent: Sunday, October 27, 2002 3:22
PM
Subject: Re: [castor-dev] how can i
inform Castor JDO engine that i will use EJB Container's Transaction
Management?
My database.xml is like the
following, and the datasource which i defined in the example
server of weblogic is working fine!
<database name="petstore"
engine="oracle">
<jndi
name="datasource-petstorePool"/>
<mapping
href="user.xml"/>
</database>
Is there other thing i need
to declare in the database.xml file???
In the ejb-jar.xml file, i
have the following transaction description for the session bean and
when i use entity
bean instead of JDO, the session bean works fine.
<container-transaction>
<method>
<ejb-name>SignOnEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>createUser</method-name>
<method-params>
<method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>SignOnEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>authenticate</method-name>
<method-params>
<method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
1)You need to configure castor for container
integration- through JNDI DataSource in database mapping config file(see
site for reference).
2)Be sure that you set up properly container
configuration(transaction management) in EJB descriptor.
Regards.
----- Original Message -----
Sent: Sunday, October 27, 2002
12:52 PM
Subject: [castor-dev] how can i
inform Castor JDO engine that i will use EJB Container's Transaction
Management?
I have
a session bean and a jdo class.
The
session bean's business methods use Weblogic Server's
EJB Container's Transaction
Management--there
are no
"db.begin()" and "db.commit()" calls again,
and create and use
a org.exolab.castor.jdo.Database object,
too.
But it
seems that JDO engine don't know that it
is
using Container Management Transaction[CMT], because
it
threw a exception with a message of "there is no
transaction
in the
executed thread".
So i
want to know how i can inform Castor JDO engine
that i
will use EJB Container's Transaction Management?
Thank
you very much! ;)
yamssar