Zhou, Andrew wrote:
Now I strip out all logic from EJB session bean to a stand alone application and now my update also do not work.
you set 'useAutoCommit=0' in your standalone app. This is problematic because OJB does not try to change the autoCommit state. If in your DB autoCommit is set false by default you will never see any data in DB.
Set to '1' in stand-alone apps.
regards, Armin
I am wondering if any setup wrong in OJB.properties or repository
My repository look like,
<jdbc-connection-descriptor
jcd-alias="repository.xml"
default-connection="true"
platform="Oracle"
jdbc-level="2.0"
driver="oracle.jdbc.driver.OracleDriver"
protocol="jdbc"
subprotocol="oracle"
dbalias="thin:@servername:1521:dbname"
username="user"
password="passwd"
eager-release="false"
batch-mode="false"
useAutoCommit="0"
ignoreAutoCommitExceptions="true">
<connection-pool maxActive="21" validationQuery="select 1 from dual" />
<sequence-manager
className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImp
l"> <attribute attribute-name="grabSize"
attribute-value="20"/> <attribute
attribute-name="autoNaming" attribute-value="true"/>
<attribute attribute-name="globalSequenceId" attribute-value="false"/>
<attribute attribute-name="globalSequenceStart"
attribute-value="10000"/> </sequence-manager> </jdbc-connection-descriptor>
And in code I do
broker.beginTransaction(); broker.store((Object) proj); broker.commitTransaction();
I can see the data in Cache is updated, but not persist to database at all :-(.
Thanks for your help!
-Andrew
-----Original Message-----
From: Zhou, Andrew Sent: Tuesday, May 04, 2004 8:36 AM
To: [EMAIL PROTECTED]
Subject: OJB EJB on Weblogic using Oracle
Hi Guys, Just new to this OJB world. Quite exciting.
Well I am trying to create a simple stateless session bean using OJB to do database related work. My environment is as follows, Weblogic 7.2 SP2 OJB 1.0.rc3 Oracle9i
So far I can get the object back through OJB, but I get in trouble when
I do update, my code is as follows PBKey pbKey = new PBKey("repository.xml");
broker = PersistenceBrokerFactory.createPersistenceBroker(pbKey);
Criteria criteria = new Criteria(); QueryByCriteria query = new QueryByCriteria(Project.class, criteria); results = broker.getCollectionByQuery(query);
Iterator it = results.iterator();
while(it.hasNext()) {
Project proj = (Project) it.next();
proj.setUserID("abcdefg");
broker.store((Object) proj); }
When I run this, the new UserID is not stored in Database. I created a
Pool, using oracle.jdbc.driver.OracleDriver. I am not sure if this is
correct. I also tested a XA Pool based on
oracle.jdbc.xa.client.OracleXADataSource, but this one give me
transaction exceptions.
Another problem is that, in repository.xml, I can only do, jndi-datasource-name="MyDataSource" but not jndi-datasource-name="java:com/env/jdbc/testDB" Even though I have a resource-ref created in weblogic-ejb-jar.xml, <resource-description> <res-ref-name>jdbc/titanDB</res-ref-name> <jndi-name>MyDataSource</jndi-name> </resource-description>
Well, I am wondering if some developer on this list had experienced same problem or has some possible solutions. If you can share with me and rest of this group with your experience, any help is highly appreciated.
Regards -Andrew
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]