You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Roland Carlsson <ma...@javalia.se> on 2003/09/21 15:43:52 UTC

[Solution] Re: Blob and OutOfMenory

Hi!
I have got a solution of Tomas Mahler and thought that I would share it. It
is very simple once you realise that there arn't a 1-1 relation between
class-description and database-table but a n-1. You can have as many classes
mapping to one database-table as you like and find use of.

So the solution to how to avoid an OutOfMemory error handling blobs are to
separate your class holding the blob into two. If you like me have a
Picture-class separate them into  PictureInfo and  PictureData where the
PictureInfo holds all values about the picture that are not the picture-data
while the PictureData only holds the id and data. When you need the data of
the picture let the PictureInfo-class load an object of PictureData
(lazy-loading).

Regards
Roland Carlsson



----- Original Message ----- 
From: "Roland Carlsson" <ma...@javalia.se>
To: "OJB Users List" <oj...@db.apache.org>
Sent: Wednesday, July 30, 2003 6:47 PM
Subject: Blob and OutOfMenory


Hi!
I'm using blobs together with a byte[]. It works quite good except for one
little problem. I have 1000+ files of 1 MB and it isn't that nice to have
into ram. So what I looking for is a solution where I can keep only
referenses to an InputStream and a OutputStream from where I can reach the
data without have to store it in my classes until I use it.

I have tried to have java.sql.Blob into my classes but it doesn't seem to
work.

Thanks in advance
Roland Carlsson






---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Deadlocks during OJB internal table access

Posted by Guido Beutler <gu...@hrs.de>.
Hi Armin,


Armin Waibel wrote:

>Hi Guido,
>
>  
>
>>Hello,
>>
>>I'm using OJB 1.0 rc4 inside of jboss3.2.2rc3 and db2.
>>OJB is running into self generated deadlocks if I access ojb with
>>concurrent ejb clients when using SequenceManagerNextValImpl
>>As a workaround I use SequenceManagerInMemoryImpl but I think this
>>    
>>
>won't
>  
>
>>work with sequences.
>>If ojb could access his internal tables with read uncommitted this
>>should not
>>occur but it seems that OJB does not commit it's entries at the internal
>>
>>tables, especially the sequence id's.
>>    
>>
>
>Running within a j2ee container OJB should not commit any
>tx/connections. Each from OJB obtained DataSource was automatically
>enlisted in the running tx (thus it's not allowed to commit).
>Further I think it's not allowed to change
>transactionIsolation of DataSources (but maybe I'm wrong).
>  
>
I think it won't be a good idea to change the isolation state of the 
data source (even if it may be possible).

>  
>
>>What can I do to get rid of the deadlocks?
>>
>>    
>>
>Good question ;-)
>Can you discribe the deadlock more detailed?
>When does it occur, when create new sequence name
>(OJB can create missing sequence names by itself) or
>when lookup next sequence key?
>
Yes, at the lookup of the next sequence key at the same transaction.
If I have to generate only one new sequence id per transaction 
everything works fine.
I already thought about a RequiresNew attribute (see my other mail
"OJB getting wrong transactin context or RequiresNew attribute (JBoss) 
seems not to start new transaction"
 at the list) and wrap all ojb stuff to own new transactions. The idea 
was to get commits earlier than
at the end of the one large transaction. This would avoid to generate 
several id's at one transaction
but this didn't work with jboss :-( .

>Can you write a test case (not ejb based) to reproduce
>your problem?
>
I think that the problem has to do with the transaction layer inside of 
the ejb context so I don't think
that it is reproduceable outside of the ejb server.
I wasn't clear about the fact that the commits of the internal ojb 
tables are dependent on the
EJB transaction.

>There is a multithreaded test case in CVS called 'SMMultithreadedTest'.
>This test simulate concurrent clients. This test pass when I use
>SequenceManagerNextValImpl and sapDB.
>

But it is not a ejb test case isn't it?
Anyway I should check it.

best regards,

Guido




---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Deadlocks during OJB internal table access

Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Guido,

> Hello,
>
> I'm using OJB 1.0 rc4 inside of jboss3.2.2rc3 and db2.
> OJB is running into self generated deadlocks if I access ojb with
> concurrent ejb clients when using SequenceManagerNextValImpl
> As a workaround I use SequenceManagerInMemoryImpl but I think this
won't
> work with sequences.
> If ojb could access his internal tables with read uncommitted this
> should not
> occur but it seems that OJB does not commit it's entries at the
internal
> tables, especially the sequence id's.

Running within a j2ee container OJB should not commit any
tx/connections. Each from OJB obtained DataSource was automatically
enlisted in the running tx (thus it's not allowed to commit).
Further I think it's not allowed to change
transactionIsolation of DataSources (but maybe I'm wrong).

> What can I do to get rid of the deadlocks?
>
Good question ;-)
Can you discribe the deadlock more detailed?
When does it occur, when create new sequence name
(OJB can create missing sequence names by itself) or
when lookup next sequence key?
Can you write a test case (not ejb based) to reproduce
your problem?
There is a multithreaded test case in CVS called 'SMMultithreadedTest'.
This test simulate concurrent clients. This test pass when I use
SequenceManagerNextValImpl and sapDB.

regards,
Armin



> best regards,
>
> Guido
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Deadlocks during OJB internal table access

Posted by Guido Beutler <gu...@hrs.de>.
Hello,

I'm using OJB 1.0 rc4 inside of jboss3.2.2rc3 and db2.
OJB is running into self generated deadlocks if I access ojb with 
concurrent ejb clients when using SequenceManagerNextValImpl
As a workaround I use SequenceManagerInMemoryImpl but I think this won't 
work with sequences.
If ojb could access his internal tables with read uncommitted this 
should not
occur but it seems that OJB does not commit it's entries at the internal 
tables, especially the sequence id's.
What can I do to get rid of the deadlocks?

best regards,

Guido



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Update problem at ODMG Interface inside jboss

Posted by Guido Beutler <gu...@hrs.de>.
Hi,

I've got a problem during update of objects inside of jboss. I'm using 
ojb rc4 and jboss-3.2.2RC3.

My code looks like:

      Transaction   tx    = _impl.currentTransaction();
      tx.lock(obj, Transaction.WRITE);

First time the object is inserted.
Then I change a attribute of the object and execute the write method again.,
but the values at the database are not changed.
How do I have to performe updates?

Thankx,
best regards,

Guido





---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org