One more find, I am doing a silly update, the field I try to update is
not even configured in repository-xxxx.xml! That is why it never get
committed to database!



-----Original Message-----
From: Zhou, Andrew 
Sent: Tuesday, May 04, 2004 12:08 PM
To: OJB Users List
Subject: RE: OJB EJB on Weblogic using Oracle -> PB update problem


Armin

Thanks for your reply. I made some progress on debugging my problem.

Instea of set useAutoCommit=1, I did my test by do a direct INSERT.
Amazing my java application works. I can see new row created in table.
Seems like as long as I touch "key-field" OJB will figure that there is
difference between cache and db and then commit change to DB.

Then I move on put same logic in EJB deployed on weblogic, it works as
expected, I can now update the "key-field" on the newly created test
record. My previous test are all on a non-key field. Guess that might be
related.

And then, I have a new problem that everytime, updated will be
committed, even though I use context.setRollbackOnly() or throw
EJBException. Mine EJB is a CMT. Later I found I am using a regular
datasource, oops :-). 

Now, I can commit, rollback as I wanted :-). So, I guess I am partially
done with my testing. But still, I don't know why OJB don't update
non-key-fields. 

My next task could be figure out the right impl for next seq number, I
will start a new thread if I have trouble. 

Yeah, rc3 is old, I am new to my team and they used to do lots work on
0.9.x and now 1.0.rc3 ....

Really appreciate all your guys help!

-Andrew


-----Original Message-----
From: Armin Waibel [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 04, 2004 11:39 AM
To: OJB Users List
Subject: Re: OJB EJB on Weblogic using Oracle -> PB update problem


Hi Andrew,

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]




---------------------------------------------------------------------
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]

Reply via email to