Your are rigth i dont need two different transactions nor two different data base 
connections.
Problem is - i get 2 diferent data base connection  when i trying :

            InitialContext().lookup("java:comp/env/jdbc/OraclePool");
            Connection aCon1 = ds.getConnection();
            aCon1.close();
            Connection aCon2 = ds.getConnection();
            aCon2.close();
Ans the question is why? If i running this code during the same EJB transaction i must 
get the same data base connection, otherwice I falling in problems if i 
want to use advansed oracle features (like FOREIGN KEY)

Sure i can use workaround like: not to use  FOREIGN KEY, or create just one 
oracleConnection and pass it into my functions where i working with 
database, but it is sux, i mean it is like not should be.

Image, i have BMP ejbCreate() function

you sugest to do like:
{
            InitialContext().lookup("java:comp/env/jdbc/OraclePool");
            Connection aCon1 = ds.getConnection();
            doJob1(aCon1)
            doJob2(aCon1)
}


I would like to be done like:
{
            doJob1()
            doJob2()
}

where in the doJobX() function i takes db connection, do the job, BUT DONT COMMIT, 
because commit should be processed after ejbPostCreate is 
processed.
In this case doJobX() function should work with the same oracle connection otherwise 
oracle can be locked.

BTW weblogic gives in such situation the same oracleConnection :(

D&D





On Tue, 21 Nov 2000 17:12:17 -0500, Jay Walters wrote:

>Do you need to get two different transactions - but perhaps things are more
>complex.  You can defer referential integrity checking until commit time
>which may help, and you can just plain not use it as well.  Just because
>something is a foreign key doesn't mean you need to tell the database.  In
>fact referential integrity checking can be expensive and you may want to
>consider whether you should use it just on that basis.
>
>Cheers
>
>-----Original Message-----
>From: Darius Davidavicius [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, November 21, 2000 12:18 PM
>To: jBoss Developer
>Subject: Re: [jBoss-Dev] Connection-transaction: feature or bug?
>
>
>>
>>Try this:
>>            DataSource ds = (DataSource)new
>>InitialContext().lookup("java:comp/env/jdbc/OraclePool");
>>            Connection aCon1 = ds.getConnection();
>>            aCon1.close();
>>            Connection aCon2 = ds.getConnection();
>>            aCon2.close();
>>
>It does not helps me in my my case:
>
>I take aCon1 and do insert into table1
>I take aCon2  and trying insert into table2, where table1 has FOREIGN KEY
>into table1 and here goes lock of oracle because I GOT DIFFERENT 
>connections.
>
>
>Some investigations:
>File: OraclePoll.java 
>function: Object getObject()
>       here it is called         
>              Object result = factory.isUniqueRequest();
>
>File: XAConnectionFactory.java
>Function     public Object isUniqueRequest()  ALWAYS returns false if i
>using Oracle8i pool because into wrapperTx Oracle conection is never
>inserted.
>
>File: XAConnectionFactory.java
>Function     public Object prepareObject(Object pooledObject) 
>inserts db connection into wrapperTx just of the type     XAConnectionImpl  
>
>How i can make sure i gen get the same data base connections in the same EJB
>transaction?
>
>I was looking into source code i could not found the sollution how i can
>store all types of connections (not just XAConnectionImpl)
>
>Maybe some class XAOracleConnectionImpl should be implemented with
>setTransactionListener ans all ther functios? Otherwise I cant add oracle 
>connection into the wrapperTx - connection, transaction association.
>
>Hmm i'm a bit confused...
>
>Regards,
>D&D
>
>
>
>
>




Reply via email to