Re: Insertion semantics

2004-03-24 Thread Laurie Harper
Results with OJB 0.9.7: totally different to 1.0rc5, also totally 
broken. Someone throw me a bone? :-(

OK, so I added all the field-desctipor id's and reference id's that 
0.9.7 requires, deleted then index-descriptor's that 0.9.7 doesn't 
recognise, and added properties for everything I was using anonymous 
access for and added public constructors/accessors/mutators until I 
wasn't getting errors any more. The result was the exact same code 
producing completely different results:

- the first insert, where the object already exists in the database, 
produced no errors with 097, where clearly it should have failed (and 
did with CVS HEAD and 1.0rc5, though not where I expected)

- the second and third inserts succeeded without error, but did nothing 
to the database; either an error should have occurred or the object 
should have been persisted

- the fourth and fith inserts similarly had no errors and no effect

- the deletes did nothing, despite executing the following SQL (as 
reported by p6spy):
1080191046253|4|0|statement|DELETE FROM PLAYER WHERE ID = ? |DELETE FROM 
PLAYER WHERE ID = '0'
1080191046256|1|0|commit||
(and yes, a record with ID=0 did exist in the database both before and 
after OJB 097 ran this SQL)

- the final delete (creating an object that didn't exist in the database 
and calling deletePersistent() on it) also succeeded without error, but 
did nothing despite executing the same SQL at above

Maybe tomorrow I'll zip up all the code and config files from the 1.0rc5 
and 097 tests I've done in case I've left something out in this thread. 
At this point I've done everything I can think of to understand what's 
going wrong short of single-stepping though everything in a debugger. 
There *must* be problems in my repository descriptor and/or the code I'm 
writing; I had this stuff working last time I used it on OJB 0.9.7.

Help? :-/

L.

Laurie Harper wrote:

OK, I just built OJB from CVS and it's still broken. The first insert 
throws an exception as described below; the second succeeds and the 
third, which should fail, hsa no effect. I extended my test code a 
little further as well with even worse results:

I added code to start another transaction, create another player object, 
insert it, commit and repeat (new trasaction, re-create an identical 
player object, insert and commit). I expected a successful insert 
followed by a failure, but neither of these inserts had any effect 
what-so-ever.

I also added code to try deleting a player object that doesn't exist in 
the database. It too has no effect.

I'm going to try downgrading to an older OJB release, since I've used it 
successfully in the past. If I get the same behaviour from that, at 
least I'll know¸ it's me that's buggy instead of OJB ;-)

L.

Laurie Harper wrote:

Is there more information I can provide so someone can help me 
understand what I'm doing wrong here? I'm completely blocked at the 
moment :-(

To re-iterate:

- persisting new objects which collide with previously existing 
objects results in an error, but not where I'd expect

- persisting multiple objects to the database that violate unique 
constraints doesn't raise any errors

- I can't delete newly inserted objects; OJB keys on column data it 
doesn't have available

Currently, this means that data entry is intrinsically unreliable in 
my app, since the data you just entered may or may not ever make it 
into the database, and I can't recover from errors by cleaning up 
earlier transactions because deletes don't work.

Any help would be appreciated.

L.

Laurie Harper wrote:

What are the expected semantics for object insertion? I'm a bit 
confused by what I'm seeing here  Here's some sample code:

Player p1 = null, p2 = null, p3 = null;

Implementation odmg = OJB.getInstance();
Database db = odmg.newDatabase();
db.open("repository.xml", Database.OPEN_READ_ONLY);
try {
System.out.println("insert p1 (pre-existing)");
p1 = new Player("name1", "player11", "pwd");
Transaction txn = odmg.newTransaction();
txn.begin();
txn.lock(p1, Transaction.WRITE);
System.out.println("commit");
txn.commit();
System.out.println("ok");
} catch (Throwable t) {
System.out.println("got a "+t.getClass().getName());
}
try {
System.out.println("insert p2 (new)");
Transaction txn = odmg.newTransaction();
txn.begin();
p2 = new Player("name3", "player3", "pwd");
txn.lock(p2, Transaction.WRITE);
System.out.println("insert p2 (again)");
p3 = new Player("name3", "player3", "pwd");
txn.lock(p3, Transaction.WRITE);
System.out.println("commit");
txn.commit();
System.out.println("ok");
} catch (Throwable t) {
System.out.println("got a "+t.getClass().getName());
t.printStackTrace();
}
System.out.println("clean-up");
try {
Transaction txn = odmg.newTransaction();
   

Re: Insertion semantics

2004-03-24 Thread Laurie Harper
OK, I just built OJB from CVS and it's still broken. The first insert 
throws an exception as described below; the second succeeds and the 
third, which should fail, hsa no effect. I extended my test code a 
little further as well with even worse results:

I added code to start another transaction, create another player object, 
insert it, commit and repeat (new trasaction, re-create an identical 
player object, insert and commit). I expected a successful insert 
followed by a failure, but neither of these inserts had any effect 
what-so-ever.

I also added code to try deleting a player object that doesn't exist in 
the database. It too has no effect.

I'm going to try downgrading to an older OJB release, since I've used it 
successfully in the past. If I get the same behaviour from that, at 
least I'll know¸ it's me that's buggy instead of OJB ;-)

L.

Laurie Harper wrote:

Is there more information I can provide so someone can help me 
understand what I'm doing wrong here? I'm completely blocked at the 
moment :-(

To re-iterate:

- persisting new objects which collide with previously existing objects 
results in an error, but not where I'd expect

- persisting multiple objects to the database that violate unique 
constraints doesn't raise any errors

- I can't delete newly inserted objects; OJB keys on column data it 
doesn't have available

Currently, this means that data entry is intrinsically unreliable in my 
app, since the data you just entered may or may not ever make it into 
the database, and I can't recover from errors by cleaning up earlier 
transactions because deletes don't work.

Any help would be appreciated.

L.

Laurie Harper wrote:

What are the expected semantics for object insertion? I'm a bit 
confused by what I'm seeing here  Here's some sample code:

Player p1 = null, p2 = null, p3 = null;

Implementation odmg = OJB.getInstance();
Database db = odmg.newDatabase();
db.open("repository.xml", Database.OPEN_READ_ONLY);
try {
System.out.println("insert p1 (pre-existing)");
p1 = new Player("name1", "player11", "pwd");
Transaction txn = odmg.newTransaction();
txn.begin();
txn.lock(p1, Transaction.WRITE);
System.out.println("commit");
txn.commit();
System.out.println("ok");
} catch (Throwable t) {
System.out.println("got a "+t.getClass().getName());
}
try {
System.out.println("insert p2 (new)");
Transaction txn = odmg.newTransaction();
txn.begin();
p2 = new Player("name3", "player3", "pwd");
txn.lock(p2, Transaction.WRITE);
System.out.println("insert p2 (again)");
p3 = new Player("name3", "player3", "pwd");
txn.lock(p3, Transaction.WRITE);
System.out.println("commit");
txn.commit();
System.out.println("ok");
} catch (Throwable t) {
System.out.println("got a "+t.getClass().getName());
t.printStackTrace();
}
System.out.println("clean-up");
try {
Transaction txn = odmg.newTransaction();
txn.begin();
db.deletePersistent(p2);
txn.commit();
} catch (Throwable t) {
System.out.println("got a "+t.getClass().getName());
}
db.close();
}
Assume player1 exists and player3 doesn't. I'm getting several 
surprises with this.

First, the insertion of player1 fails, as it should. But I expected it 
to fail on the call to lock(). It doesn't fail until the commit() at 
which point I get a 
org.apache.ojb.odmg.TransactionAbortedExceptionOJB. Is this the 
expected behaviour?

Next, the insertion of player3. This succeeds. What I was expecting 
was an error on the second call to lock(). I could see it failing in 
commit() instead for consistency with what I saw on player1, but it 
ought to fail somewhere shouldn't it?

Finally, the call to deletePersistent is having no effect. I'm unable 
to delete objects after I insert them. Am I doing something wrong or 
is this an OJB bug?

I suspect some or all of these problems may be to do with OJB's 
primary key handling. I'm using database native sequences and OJB 
seems not to cope with that correctly, going on the SQL statements 
P6Spy is reporting:

1079658237422|1|0|statement|SELECT password,email,name,ID FROM PLAYER 
WHERE ID = ? |SELECT password,email,name,ID FROM PLAYER WHERE ID = ''
[from the first call to lock() on player3; the second call generates 
no SQL]

1079658237473|2|0|statement|DELETE FROM PLAYER WHERE ID = ? |DELETE 
FROM PLAYER WHERE ID = ''
[on the call to deletePersistent, which explains why it's not doing much]

ID is an anonymous property on Player; could that be a factor? Here's 
the repository entry for the class:














If you need more info to diagnose what's going on, let me know.

L.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional comma

RE: sequence manager help (order of inserts to avoid FK problems)

2004-03-24 Thread McCaffrey, John G.
If I have a mapping of
Obj A
contains one Obj B
and a collection of Obj C

how do I tell ojb to insert table A before tables B or C?

I have foriegn key constraints that say A must exist before B can be
inserted, and A must exist before C can be inserted. (and the deletes need
to happen in the reverse order)

This must be very common for everyone, is there a trick to telling it what
order the inserts need to go?


-Original Message-
From: Armin Waibel [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 24, 2004 7:19 PM
To: OJB Users List
Subject: Re: sequence manager help (order of inserts to avoid FK
problems)


McCaffrey, John G. wrote:
> I am using rc 4. i can't get to CVS because I am behind a firewall (and my
> manager only wants us to use the labled builds)
> 
> I tried your suggestion to set the 
> primarykey=true, autoincrement="false" and access="readonly"
>   for my key (EVNT_RQST_ID)
> 
> and got the exception 
> Assignment of a NULL value to a NOT NULL column "EVNT_RQST_ID" is not
> allowed.
> 
> do you think that upgrading to rc 5 would help?

As I can remember there was a bug with autoincrement="false" handling, 
but I don't know when it was fixed. Give rc5 a change ;-)
We plan to release a new version end of this month (and final release 
one week later - if no major problem arise).

> Is there any other way I can tell OJB not to try to autoincrement the
keys?
>

Sorry, only possibility is to fix this in rc4 source code. See 
BrokerHelper#getValuesForObject

> I appreciate your help on this, I see that you are getting a thousand
emails
> right now, and somehow you manage to answer them. Thanks!!
>

I try to confuse people with my "exceptional bad" english, nevertheless 
some people post again and again ;-)

regards,
Armin

> -Original Message-
> From: Armin Waibel [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 24, 2004 6:39 PM
> To: OJB Users List
> Subject: Re: sequence manager help (order of inserts to avoid FK
> problems)
> 
> 
> Hi again,
> 
> did you try latest version from CVS? Latest version of PlatformDb2Impl 
> override method getLastInsertIdentityQuery and return the same query 
> string you use.
> 
> If you don't want to use the sequence manager from OJB
> primarykey=true, autoincrement="false" and access="readonly" should work 
> (and do work with latest from CVS). What version of OJB do you use?
> 
> regards,
> Armin
> 
> McCaffrey, John G. wrote:
> 
>>Almost there!
>>Ok, I just made the changes you suggested, and it is working, kinda.
>>I insert table A first (because that's where I get my Id from)
>>I assign the ID from A into B
>>then I go to insert table B
>>if I try to tell it that the primarykey=true  and autoincrement="false"
>>(beacause I don't want it to try to get the Identity from the DB for this
>>table, because it is not an Identity)
>>I get the exception 
>>
>> org.apache.ojb.broker.util.sequence.SequenceManagerException: Field does
>>not support autoincrement, please check repository: null
> 
>  >
> 
>>so I set autoincrement="true" (just to see if that would work) and then it
>>works (Yay!) but I also see that it made the trip to the db to try to get
>>the Identity (because it thinks there is one for this table) and I would
>>like to avoid that unecessary trip (if possible).
>>
>>Why does it get upset that autoincrement="false" ?
>>
>>
>>p.s.
>>I had to make a custom getLastInsertIdentityQuery() because thats the only
>>way that I could get OJB to call the DB with the statement I need for DB2
>>SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1
>>the PlatformDb2Impl doesn't have anything in that method, so I had to
> 
> extend
> 
>>it and override.
>>
>>
>>
>>
>>
>>-Original Message-
>>From: Armin Waibel [mailto:[EMAIL PROTECTED]
>>Sent: Wednesday, March 24, 2004 6:02 PM
>>To: OJB Users List
>>Subject: Re: sequence manager help (order of inserts to avoid FK
>>problems)
>>
>>
>>Hi John,
>>
>>McCaffrey, John G. wrote:
>>
>>
>>>I have a DB generated Identity column for Table A and I am able to use
OJB
>>>to insert that object A and see what the identity is with a custom
>>>getLastInsertIdentityQuery() method. (Yay!)
>>>
>>
>>
>>Why you don't use SequenceManagerNativeImpl?
>>http://db.apache.org/ojb/sequencemanager.html#nativeSequenceManager
>>
>>
>>
>>>I have a table B that is associated to Table A, but its ID is not
>>
>>generated.
>>
>>
>>>When I insert into Table A and get the generated ID, I would like to
>>
>>insert
>>
>>
>>>into table B and use that same ID. 
>>>in my mapping for Table A I have a reference descriptor to Table B, with
>>>auto-XXX all true
>>>
>>
>>
>>You can't use auto-udate true in your case, because OJB needs the PK of 
>>B to set the FK in A before storing A (assume you declared an 1:1 
>>reference between A and B).
>>The SequenceManager interface contains two methods only for handle DB 
>>identity based key generation:
>>setReferenceFKs(Object obj, ClassDescriptor cld)
>>afterStore(JdbcAccess dbAccess,

Back to square 1

2004-03-24 Thread Steve Clark
I've been using OJB for over a year now, and when it works, it's a
beautiful thing.  Thanks to the team for all you do!

I'm having two problems today which make me feel like a newbie.  I'm
hoping somebody can shed some light.

I'm using RC5, Oracle 9i, ODMG, PersistentFieldIntrospectorImpl.

1) Adding to a collection.  I have a simple 1:n relationship which
   uses an anonymous key.  Repository snippet:

 
   
   
 
   
 

 
   
 

   I've written the following code:

 // get parent object, with no children (yet)
 Parent parent = ; 
 Child child = new Child();

 tx = fOdmg.newTransaction();
 tx.begin();
 tx.lock(parent, tx.WRITE);
 tx.lock(child, tx.WRITE);
 parent.addChild(child);
 tx.commit();

   Parent.addChild() is defined as:
 public void addChild(Child child) {
fChildren.add(child);
 }

   The commit() throws:
  java.sql.SQLException: ORA-01400: cannot insert NULL into ("CHILD"."PARENT_ID")

   What am I missing??  Do I have to define the reverse relationship
   (Child.parent) in order to get the anonymous key to work?

2) I have a class A with a reference to class B.  B is mapped to a
   table in a different schema from A; my database user has read-only
   access to B's schema.  I database.deletePersistent(anA), and OJB
   tries to *update* the corresponding B, which I have not changed
   (there is no reference from B to A).  I have not set auto-anything
   anywhere in repository.xml.  Why would this happen?

thanks,
-steve

--
Steve Clark
Technology Applications Team
Natural Resources Research Center/USGS
[EMAIL PROTECTED]
(970)226-9291

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: sequence manager help (order of inserts to avoid FK problems)

2004-03-24 Thread Armin Waibel
McCaffrey, John G. wrote:
I am using rc 4. i can't get to CVS because I am behind a firewall (and my
manager only wants us to use the labled builds)
I tried your suggestion to set the 
primarykey=true, autoincrement="false" and access="readonly"
  for my key (EVNT_RQST_ID)

and got the exception 
Assignment of a NULL value to a NOT NULL column "EVNT_RQST_ID" is not
allowed.

do you think that upgrading to rc 5 would help?
As I can remember there was a bug with autoincrement="false" handling, 
but I don't know when it was fixed. Give rc5 a change ;-)
We plan to release a new version end of this month (and final release 
one week later - if no major problem arise).

Is there any other way I can tell OJB not to try to autoincrement the keys?

Sorry, only possibility is to fix this in rc4 source code. See 
BrokerHelper#getValuesForObject

I appreciate your help on this, I see that you are getting a thousand emails
right now, and somehow you manage to answer them. Thanks!!
I try to confuse people with my "exceptional bad" english, nevertheless 
some people post again and again ;-)

regards,
Armin
-Original Message-
From: Armin Waibel [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 24, 2004 6:39 PM
To: OJB Users List
Subject: Re: sequence manager help (order of inserts to avoid FK
problems)
Hi again,

did you try latest version from CVS? Latest version of PlatformDb2Impl 
override method getLastInsertIdentityQuery and return the same query 
string you use.

If you don't want to use the sequence manager from OJB
primarykey=true, autoincrement="false" and access="readonly" should work 
(and do work with latest from CVS). What version of OJB do you use?

regards,
Armin
McCaffrey, John G. wrote:

Almost there!
Ok, I just made the changes you suggested, and it is working, kinda.
I insert table A first (because that's where I get my Id from)
I assign the ID from A into B
then I go to insert table B
if I try to tell it that the primarykey=true  and autoincrement="false"
(beacause I don't want it to try to get the Identity from the DB for this
table, because it is not an Identity)
I get the exception 

org.apache.ojb.broker.util.sequence.SequenceManagerException: Field does
not support autoincrement, please check repository: null
 >

so I set autoincrement="true" (just to see if that would work) and then it
works (Yay!) but I also see that it made the trip to the db to try to get
the Identity (because it thinks there is one for this table) and I would
like to avoid that unecessary trip (if possible).
Why does it get upset that autoincrement="false" ?

p.s.
I had to make a custom getLastInsertIdentityQuery() because thats the only
way that I could get OJB to call the DB with the statement I need for DB2
SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1
the PlatformDb2Impl doesn't have anything in that method, so I had to
extend

it and override.





-Original Message-
From: Armin Waibel [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 24, 2004 6:02 PM
To: OJB Users List
Subject: Re: sequence manager help (order of inserts to avoid FK
problems)
Hi John,

McCaffrey, John G. wrote:


I have a DB generated Identity column for Table A and I am able to use OJB
to insert that object A and see what the identity is with a custom
getLastInsertIdentityQuery() method. (Yay!)


Why you don't use SequenceManagerNativeImpl?
http://db.apache.org/ojb/sequencemanager.html#nativeSequenceManager


I have a table B that is associated to Table A, but its ID is not
generated.


When I insert into Table A and get the generated ID, I would like to
insert


into table B and use that same ID. 
in my mapping for Table A I have a reference descriptor to Table B, with
auto-XXX all true



You can't use auto-udate true in your case, because OJB needs the PK of 
B to set the FK in A before storing A (assume you declared an 1:1 
reference between A and B).
The SequenceManager interface contains two methods only for handle DB 
identity based key generation:
setReferenceFKs(Object obj, ClassDescriptor cld)
afterStore(JdbcAccess dbAccess, ClassDescriptor cld, Object



If I try to insert Obj A that has an Obj B inside of it, it appears that
OJB


tries to insert Obj B first. This will fail because the ID has not been
generated yet.
How can I get OJB to insert Obj A first, then assign that ID to Obj B ?



Think with your current solution it is only possible if you store all 
objects by hand and set auto-update false. Store B first then set FK in 
A and store A.

regards,
Armin


-
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

RE: sequence manager help (order of inserts to avoid FK problems)

2004-03-24 Thread McCaffrey, John G.
I am using rc 4. i can't get to CVS because I am behind a firewall (and my
manager only wants us to use the labled builds)

I tried your suggestion to set the 
primarykey=true, autoincrement="false" and access="readonly"
  for my key (EVNT_RQST_ID)

and got the exception 
Assignment of a NULL value to a NOT NULL column "EVNT_RQST_ID" is not
allowed.

do you think that upgrading to rc 5 would help?
Is there any other way I can tell OJB not to try to autoincrement the keys?

I appreciate your help on this, I see that you are getting a thousand emails
right now, and somehow you manage to answer them. Thanks!!

-Original Message-
From: Armin Waibel [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 24, 2004 6:39 PM
To: OJB Users List
Subject: Re: sequence manager help (order of inserts to avoid FK
problems)


Hi again,

did you try latest version from CVS? Latest version of PlatformDb2Impl 
override method getLastInsertIdentityQuery and return the same query 
string you use.

If you don't want to use the sequence manager from OJB
primarykey=true, autoincrement="false" and access="readonly" should work 
(and do work with latest from CVS). What version of OJB do you use?

regards,
Armin

McCaffrey, John G. wrote:
> Almost there!
> Ok, I just made the changes you suggested, and it is working, kinda.
> I insert table A first (because that's where I get my Id from)
> I assign the ID from A into B
> then I go to insert table B
> if I try to tell it that the primarykey=true  and autoincrement="false"
> (beacause I don't want it to try to get the Identity from the DB for this
> table, because it is not an Identity)
> I get the exception 
> 
>  org.apache.ojb.broker.util.sequence.SequenceManagerException: Field does
> not support autoincrement, please check repository: null
 >
> so I set autoincrement="true" (just to see if that would work) and then it
> works (Yay!) but I also see that it made the trip to the db to try to get
> the Identity (because it thinks there is one for this table) and I would
> like to avoid that unecessary trip (if possible).
> 
> Why does it get upset that autoincrement="false" ?
> 
> 
> p.s.
> I had to make a custom getLastInsertIdentityQuery() because thats the only
> way that I could get OJB to call the DB with the statement I need for DB2
> SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1
> the PlatformDb2Impl doesn't have anything in that method, so I had to
extend
> it and override.
> 
> 
> 
> 
> 
> -Original Message-
> From: Armin Waibel [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 24, 2004 6:02 PM
> To: OJB Users List
> Subject: Re: sequence manager help (order of inserts to avoid FK
> problems)
> 
> 
> Hi John,
> 
> McCaffrey, John G. wrote:
> 
>>I have a DB generated Identity column for Table A and I am able to use OJB
>>to insert that object A and see what the identity is with a custom
>>getLastInsertIdentityQuery() method. (Yay!)
>>
> 
> 
> Why you don't use SequenceManagerNativeImpl?
> http://db.apache.org/ojb/sequencemanager.html#nativeSequenceManager
> 
> 
>>I have a table B that is associated to Table A, but its ID is not
> 
> generated.
> 
>>When I insert into Table A and get the generated ID, I would like to
> 
> insert
> 
>>into table B and use that same ID. 
>>in my mapping for Table A I have a reference descriptor to Table B, with
>>auto-XXX all true
>>
> 
> 
> You can't use auto-udate true in your case, because OJB needs the PK of 
> B to set the FK in A before storing A (assume you declared an 1:1 
> reference between A and B).
> The SequenceManager interface contains two methods only for handle DB 
> identity based key generation:
> setReferenceFKs(Object obj, ClassDescriptor cld)
> afterStore(JdbcAccess dbAccess, ClassDescriptor cld, Object
> 
> 
>>If I try to insert Obj A that has an Obj B inside of it, it appears that
> 
> OJB
> 
>>tries to insert Obj B first. This will fail because the ID has not been
>>generated yet.
>>
>>How can I get OJB to insert Obj A first, then assign that ID to Obj B ?
>>
> 
> 
> Think with your current solution it is only possible if you store all 
> objects by hand and set auto-update false. Store B first then set FK in 
> A and store A.
> 
> regards,
> Armin
> 
> 
>>-
>>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]


Re: sequence manager help (order of inserts to avoid FK problems)

2004-03-24 Thread Armin Waibel
Hi again,

did you try latest version from CVS? Latest version of PlatformDb2Impl 
override method getLastInsertIdentityQuery and return the same query 
string you use.

If you don't want to use the sequence manager from OJB
primarykey=true, autoincrement="false" and access="readonly" should work 
(and do work with latest from CVS). What version of OJB do you use?

regards,
Armin
McCaffrey, John G. wrote:
Almost there!
Ok, I just made the changes you suggested, and it is working, kinda.
I insert table A first (because that's where I get my Id from)
I assign the ID from A into B
then I go to insert table B
if I try to tell it that the primarykey=true  and autoincrement="false"
(beacause I don't want it to try to get the Identity from the DB for this
table, because it is not an Identity)
I get the exception 

 org.apache.ojb.broker.util.sequence.SequenceManagerException: Field does
not support autoincrement, please check repository: null
>
so I set autoincrement="true" (just to see if that would work) and then it
works (Yay!) but I also see that it made the trip to the db to try to get
the Identity (because it thinks there is one for this table) and I would
like to avoid that unecessary trip (if possible).
Why does it get upset that autoincrement="false" ?

p.s.
I had to make a custom getLastInsertIdentityQuery() because thats the only
way that I could get OJB to call the DB with the statement I need for DB2
SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1
the PlatformDb2Impl doesn't have anything in that method, so I had to extend
it and override.




-Original Message-
From: Armin Waibel [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 24, 2004 6:02 PM
To: OJB Users List
Subject: Re: sequence manager help (order of inserts to avoid FK
problems)
Hi John,

McCaffrey, John G. wrote:

I have a DB generated Identity column for Table A and I am able to use OJB
to insert that object A and see what the identity is with a custom
getLastInsertIdentityQuery() method. (Yay!)


Why you don't use SequenceManagerNativeImpl?
http://db.apache.org/ojb/sequencemanager.html#nativeSequenceManager

I have a table B that is associated to Table A, but its ID is not
generated.

When I insert into Table A and get the generated ID, I would like to
insert

into table B and use that same ID. 
in my mapping for Table A I have a reference descriptor to Table B, with
auto-XXX all true



You can't use auto-udate true in your case, because OJB needs the PK of 
B to set the FK in A before storing A (assume you declared an 1:1 
reference between A and B).
The SequenceManager interface contains two methods only for handle DB 
identity based key generation:
setReferenceFKs(Object obj, ClassDescriptor cld)
afterStore(JdbcAccess dbAccess, ClassDescriptor cld, Object


If I try to insert Obj A that has an Obj B inside of it, it appears that
OJB

tries to insert Obj B first. This will fail because the ID has not been
generated yet.
How can I get OJB to insert Obj A first, then assign that ID to Obj B ?



Think with your current solution it is only possible if you store all 
objects by hand and set auto-update false. Store B first then set FK in 
A and store A.

regards,
Armin

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


Re: Collection Size Limit for Updates?

2004-03-24 Thread Armin Waibel
Hi Chris,

Chris Lewington wrote:

Hi all,

Does anyone know roughly what the biggest Collection size is that an
object can contain when doing an update? Around 1000 seems OK, but
20,000 throws an OutOfMemoryError. Since OJB does 'delete + insert' for
update, for an m:n relation with 20,000 objects you get 20,000 deletes,
then 20,000+ array copies then 20,000 inserts if you don't touch
anything in the Collection - thus changing eg only a String in the top
object results in this behaviour when all you really wanted was to
change a single column value in one table.
This is a result of the auto-update setting handling. There are two big 
threads on the dev-list discuss this behaviour.

http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgNo=6531
http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgNo=6538
Currently I refactoring the auto-xxx handling in OJB. We will introduce 
additional values for auto-update/delete. For more detailed info, please 
read the " auto-XXX setting (PART II)" thread on dev-list.

regards,
Armin
This is not an artifical situation - we have this in our project. We
cannot update a String in our top level object simply because it is
linked to 20,000 others, even though we are not touching those other
objects (or the relation between the two).
Cheers,

Chris

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


RE: sequence manager help (order of inserts to avoid FK problems)

2004-03-24 Thread McCaffrey, John G.

Almost there!
Ok, I just made the changes you suggested, and it is working, kinda.
I insert table A first (because that's where I get my Id from)
I assign the ID from A into B
then I go to insert table B
if I try to tell it that the primarykey=true  and autoincrement="false"
(beacause I don't want it to try to get the Identity from the DB for this
table, because it is not an Identity)
I get the exception 

 org.apache.ojb.broker.util.sequence.SequenceManagerException: Field does
not support autoincrement, please check repository: null

so I set autoincrement="true" (just to see if that would work) and then it
works (Yay!) but I also see that it made the trip to the db to try to get
the Identity (because it thinks there is one for this table) and I would
like to avoid that unecessary trip (if possible).

Why does it get upset that autoincrement="false" ?


p.s.
I had to make a custom getLastInsertIdentityQuery() because thats the only
way that I could get OJB to call the DB with the statement I need for DB2
SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1
the PlatformDb2Impl doesn't have anything in that method, so I had to extend
it and override.





-Original Message-
From: Armin Waibel [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 24, 2004 6:02 PM
To: OJB Users List
Subject: Re: sequence manager help (order of inserts to avoid FK
problems)


Hi John,

McCaffrey, John G. wrote:
> I have a DB generated Identity column for Table A and I am able to use OJB
> to insert that object A and see what the identity is with a custom
> getLastInsertIdentityQuery() method. (Yay!)
> 

Why you don't use SequenceManagerNativeImpl?
http://db.apache.org/ojb/sequencemanager.html#nativeSequenceManager

> I have a table B that is associated to Table A, but its ID is not
generated.
> When I insert into Table A and get the generated ID, I would like to
insert
> into table B and use that same ID. 
> in my mapping for Table A I have a reference descriptor to Table B, with
> auto-XXX all true
>

You can't use auto-udate true in your case, because OJB needs the PK of 
B to set the FK in A before storing A (assume you declared an 1:1 
reference between A and B).
The SequenceManager interface contains two methods only for handle DB 
identity based key generation:
setReferenceFKs(Object obj, ClassDescriptor cld)
afterStore(JdbcAccess dbAccess, ClassDescriptor cld, Object

> If I try to insert Obj A that has an Obj B inside of it, it appears that
OJB
> tries to insert Obj B first. This will fail because the ID has not been
> generated yet.
> 
> How can I get OJB to insert Obj A first, then assign that ID to Obj B ?
> 

Think with your current solution it is only possible if you store all 
objects by hand and set auto-update false. Store B first then set FK in 
A and store A.

regards,
Armin

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



Re: sequence manager help (order of inserts to avoid FK problems)

2004-03-24 Thread Armin Waibel
Hi John,

McCaffrey, John G. wrote:
I have a DB generated Identity column for Table A and I am able to use OJB
to insert that object A and see what the identity is with a custom
getLastInsertIdentityQuery() method. (Yay!)
Why you don't use SequenceManagerNativeImpl?
http://db.apache.org/ojb/sequencemanager.html#nativeSequenceManager
I have a table B that is associated to Table A, but its ID is not generated.
When I insert into Table A and get the generated ID, I would like to insert
into table B and use that same ID. 
in my mapping for Table A I have a reference descriptor to Table B, with
auto-XXX all true

You can't use auto-udate true in your case, because OJB needs the PK of 
B to set the FK in A before storing A (assume you declared an 1:1 
reference between A and B).
The SequenceManager interface contains two methods only for handle DB 
identity based key generation:
setReferenceFKs(Object obj, ClassDescriptor cld)
afterStore(JdbcAccess dbAccess, ClassDescriptor cld, Object

If I try to insert Obj A that has an Obj B inside of it, it appears that OJB
tries to insert Obj B first. This will fail because the ID has not been
generated yet.
How can I get OJB to insert Obj A first, then assign that ID to Obj B ?

Think with your current solution it is only possible if you store all 
objects by hand and set auto-update false. Store B first then set FK in 
A and store A.

regards,
Armin
-
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]


Re: MtoNCollectionPrefetcher.buildPrefetchCriteriaMultipleKeys(MtoNCollectionPrefetcher.java:338)

2004-03-24 Thread Armin Waibel
Hi Jakob,

this test is part of a new M2N-test case, so it's not possible to 
separate it. Hope I can check in the new auto-xxx stuff tomorrow. Then 
you can use the new test case.

regards,
Armin
Jakob Braeuchi wrote:
hi armin, edson,

it looks like the number of pk-fields and the number of columns in the 
indirection table pointing to the m-side class are not the same.

could you please send me the testcase ?

jakob

Armin Waibel wrote:

Hi Edson,

I have the same problem here is my stack trace

java.lang.ArrayIndexOutOfBoundsException: 1
at 
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchCriteriaMultipleKeys(MtoNCollectionPrefetcher.java:338) 

at 
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchCriteria(MtoNCollectionPrefetcher.java:259) 

at 
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchQuery(MtoNCollectionPrefetcher.java:115) 

at 
org.apache.ojb.broker.accesslayer.CollectionPrefetcher.buildPrefetchQueries(CollectionPrefetcher.java:93) 

seems the both are the same. I implemented a test case for the 
problem, but I'm currently working on the auto-xxx stuff so I can't 
send much time for that - put this on my imaginary todo-list for 1.0 ;-)

regards,
Armin
Edson Carlos Ericksson Richter wrote:

This bug is driving me crazy... Someone could point me what changed 
from rc5
to 1.0 in this method (so I can at least fix locally)?

The problem is a M:N mapping using composite pk pointing the M bean, 
and 1
field pk pointing to the N bean.
The stack trace is:

java.lang.ArrayIndexOutOfBoundsException: 1
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchCrit 

eriaMultipleKeys(MtoNCollectionPrefetcher.java:338)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchCrit 

eria(MtoNCollectionPrefetcher.java:259)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchQuer 

y(MtoNCollectionPrefetcher.java:115)
at
org.apache.ojb.broker.accesslayer.CollectionPrefetcher.buildPrefetchQueries( 

CollectionPrefetcher.java:93)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.prefetchRelations 

hip(MtoNCollectionPrefetcher.java:68)
at
org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(QueryR 

eferenceBroker.java:277)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryRe 

ferenceBroker.java:146)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryRe 

ferenceBroker.java:203)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Persis 

tenceBrokerImpl.java:1046)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery( 

DelegatingPersistenceBroker.java:321)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery( 

DelegatingPersistenceBroker.java:321)
at
org.apache.ojb.broker.accesslayer.CollectionProxy.loadData(CollectionProxy.j 

ava:109)
at
org.apache.ojb.broker.accesslayer.ListProxy.loadData(ListProxy.java:148)
at
org.apache.ojb.broker.accesslayer.CollectionProxy.getData(CollectionProxy.ja 

va:362)
at
org.apache.ojb.broker.accesslayer.ListProxy.getListData(ListProxy.java:140) 

at
org.apache.ojb.broker.accesslayer.ListProxy.get(ListProxy.java:71)
at
br.com.mgr.dialogs.ListBasedListModel.getElementAt(ListBasedListModel.java:6 

3)
at
javax.swing.plaf.basic.BasicListUI.updateLayoutState(BasicListUI.java:1147) 

at
javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(BasicListUI.java:1 

098)
at
javax.swing.plaf.basic.BasicListUI.getPreferredSize(BasicListUI.java:281) 

at javax.swing.JComponent.getPreferredSize(JComponent.java:1275)
at
javax.swing.JList.getPreferredScrollableViewportSize(JList.java:1913)
at
javax.swing.ViewportLayout.preferredLayoutSize(ViewportLayout.java:72)
at java.awt.Container.preferredSize(Container.java:1178)
at java.awt.Container.getPreferredSize(Container.java:1162)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1277)
at
javax.swing.ScrollPaneLayout.preferredLayoutSize(ScrollPaneLayout.java:475) 

at java.awt.Container.preferredSize(Container.java:1178)
at java.awt.Container.getPreferredSize(Container.java:1162)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1277)
at 
java.awt.BorderLayout.preferredLayoutSize(BorderLayout.java:572)
at java.awt.Container.preferredSize(Container.java:1178)
at java.awt.Container.getPreferredSize(Container.java:1162)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1277)
at
javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.calculateSize(Basi 

cTabbedPaneUI.java:2001)
at
javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.p

Re: Are collection-descriptors inherited or not?

2004-03-24 Thread Armin Waibel
Hi Steve,

seems to be the same problem as described in thread
"MtoNCollectionPrefetcher.buildPrefetchCriteriaMultipleKeys(MtoNCollectionPrefetcher.java:338)" 

Sounds like a bug in Prefetcher classes. Will try to fix this before the 
next upcoming release.

regards,
Armin
Steve Clark wrote:
I am having problems with a M:N collection which is defined in a
superclass and inherited by a subclass.  I am using RC5.
Here is my (pseudo-)repository:


  
  

  


  


  
  


  


  

When I try to materialize an instance of Sub, I get
ArrayIndexOutOfBoundsException:
java.lang.ArrayIndexOutOfBoundsException: 2
at 
org.apache.ojb.broker.core.QueryReferenceBroker.getFKQueryMtoN(QueryReferenceBroker.java:626)
at 
org.apache.ojb.broker.core.QueryReferenceBroker.getFKQuery(QueryReferenceBroker.java:574)
at 
org.apache.ojb.broker.core.QueryReferenceBroker.retrieveCollection(QueryReferenceBroker.java:509)
at 
org.apache.ojb.broker.core.QueryReferenceBroker.retrieveCollections(QueryReferenceBroker.java:696)
at 
org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(RsIterator.java:492)
at org.apache.ojb.broker.accesslayer.RsIterator.next(RsIterator.java:284)
at 
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:147)
at 
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:244)
at 
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:263)
at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:997)
at 
org.apache.ojb.broker.accesslayer.BasePrefetcher.prefetchRelationship(BasePrefetcher.java:153)
at 
org.apache.ojb.broker.core.QueryReferenceBroker$PBPrefetchingListener.prefetch(QueryReferenceBroker.java:835)
at 
org.apache.ojb.broker.core.QueryReferenceBroker$PBMaterializationListener.beforeMaterialization(QueryReferenceBroker.java:772)
at 
org.apache.ojb.broker.accesslayer.IndirectionHandler.beforeMaterialization(IndirectionHandler.java:146)
at 
org.apache.ojb.broker.accesslayer.IndirectionHandler.materializeSubject(IndirectionHandler.java:332)
at 
org.apache.ojb.broker.accesslayer.IndirectionHandler.getRealSubject(IndirectionHandler.java:309)
at 
org.apache.ojb.broker.accesslayer.IndirectionHandler.invoke(IndirectionHandler.java:284)
at $Proxy15.getAccompKey(Unknown Source)
...
Looking at the offending line in QueryReferenceBroker, it appears that
itemClassFks has (at least) two entries, while refCld.getPkFields()
has only one.  So it appears that the collection descriptor believes
that it has multiple key fields pointing at Element, while Element
itself has only a single key.  I assume this has to do with the
repeated  in both Super and Sub.  Is
this true?
Can somebody post a summary of the correct way to deal with inherited
collections and relationships in OJB?
thanks,
-steve
--
Steve Clark
Technology Applications Team
Natural Resources Research Center/USGS
[EMAIL PROTECTED]
(970)226-9291
-
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]


Re: OJB with Spring

2004-03-24 Thread Armin Waibel
Robert S. Sfeir wrote:

This is based on comparison reading that I've done, not actual use.  
What I don't like is that they use their own SQL language, and I don't 
want to learn yet another SQL language, or I would use JDBC.  Their own 
query language is just a pain too as far as I'm concerned.  as an 
example to do a find:

List mates = sess.find(
   "select mate from Cat as cat join cat.mate as mate " +
   "where cat.name = ?",
   name,
   Hibernate.STRING
);
it's almost as much typing as SQL.

Now they've recently added ODMG3 support, and it does make it more 
interesting.

AFAIK Hibernate will no longer support ODMG (I'm not sure, so ask the 
Hibernate guys). But they started with an Criteria based Query API 
similar to PB-api.

regards,
Armin
Like I said, the language seems easier for me in OJB.  I might be wrong.

R

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


sequence manager help (order of inserts to avoid FK problems)

2004-03-24 Thread McCaffrey, John G.
I have a DB generated Identity column for Table A and I am able to use OJB
to insert that object A and see what the identity is with a custom
getLastInsertIdentityQuery() method. (Yay!)

I have a table B that is associated to Table A, but its ID is not generated.
When I insert into Table A and get the generated ID, I would like to insert
into table B and use that same ID. 
in my mapping for Table A I have a reference descriptor to Table B, with
auto-XXX all true

If I try to insert Obj A that has an Obj B inside of it, it appears that OJB
tries to insert Obj B first. This will fail because the ID has not been
generated yet.

How can I get OJB to insert Obj A first, then assign that ID to Obj B ?

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Are collection-descriptors inherited or not?

2004-03-24 Thread Steve Clark
I am having problems with a M:N collection which is defined in a
superclass and inherited by a subclass.  I am using RC5.

Here is my (pseudo-)repository:


  

  

  


  



  

  


  



  


When I try to materialize an instance of Sub, I get
ArrayIndexOutOfBoundsException:

java.lang.ArrayIndexOutOfBoundsException: 2
at 
org.apache.ojb.broker.core.QueryReferenceBroker.getFKQueryMtoN(QueryReferenceBroker.java:626)
at 
org.apache.ojb.broker.core.QueryReferenceBroker.getFKQuery(QueryReferenceBroker.java:574)
at 
org.apache.ojb.broker.core.QueryReferenceBroker.retrieveCollection(QueryReferenceBroker.java:509)
at 
org.apache.ojb.broker.core.QueryReferenceBroker.retrieveCollections(QueryReferenceBroker.java:696)
at 
org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(RsIterator.java:492)
at org.apache.ojb.broker.accesslayer.RsIterator.next(RsIterator.java:284)
at 
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:147)
at 
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:244)
at 
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:263)
at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:997)
at 
org.apache.ojb.broker.accesslayer.BasePrefetcher.prefetchRelationship(BasePrefetcher.java:153)
at 
org.apache.ojb.broker.core.QueryReferenceBroker$PBPrefetchingListener.prefetch(QueryReferenceBroker.java:835)
at 
org.apache.ojb.broker.core.QueryReferenceBroker$PBMaterializationListener.beforeMaterialization(QueryReferenceBroker.java:772)
at 
org.apache.ojb.broker.accesslayer.IndirectionHandler.beforeMaterialization(IndirectionHandler.java:146)
at 
org.apache.ojb.broker.accesslayer.IndirectionHandler.materializeSubject(IndirectionHandler.java:332)
at 
org.apache.ojb.broker.accesslayer.IndirectionHandler.getRealSubject(IndirectionHandler.java:309)
at 
org.apache.ojb.broker.accesslayer.IndirectionHandler.invoke(IndirectionHandler.java:284)
at $Proxy15.getAccompKey(Unknown Source)
...

Looking at the offending line in QueryReferenceBroker, it appears that
itemClassFks has (at least) two entries, while refCld.getPkFields()
has only one.  So it appears that the collection descriptor believes
that it has multiple key fields pointing at Element, while Element
itself has only a single key.  I assume this has to do with the
repeated  in both Super and Sub.  Is
this true?

Can somebody post a summary of the correct way to deal with inherited
collections and relationships in OJB?

thanks,
-steve

--
Steve Clark
Technology Applications Team
Natural Resources Research Center/USGS
[EMAIL PROTECTED]
(970)226-9291

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OJB with Spring

2004-03-24 Thread Robert S. Sfeir
Angus Berry wrote:

I was wondering what you don't like about Hibernate? I have a couple of
OJB projects, but hear a lot of talk about Hibernate. Someone close to
Hibernate said that their caching was better.
I don't plan on switch anything, but I'd appreciate any insight from
folks who know both products.
This is based on comparison reading that I've done, not actual use.  
What I don't like is that they use their own SQL language, and I don't 
want to learn yet another SQL language, or I would use JDBC.  Their own 
query language is just a pain too as far as I'm concerned.  as an 
example to do a find:

List mates = sess.find(
   "select mate from Cat as cat join cat.mate as mate " +
   "where cat.name = ?",
   name,
   Hibernate.STRING
);
it's almost as much typing as SQL.

Now they've recently added ODMG3 support, and it does make it more 
interesting.

Like I said, the language seems easier for me in OJB.  I might be wrong.

R

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: PersistenceBrokerImpl and Proxies

2004-03-24 Thread Armin Waibel
Hi Chris,

currently I'm working on the auto-xxx handling. Please remind me if this 
behaviour will be the same in the upcoming release (or better in CVS, I 
will check in the changes in a few days).

regards,
Armin
Chris Lewington wrote:

Hi all,

I have a problem with the following scenario:

Suppose I have a class A which contains a collections of Bs, but the
element class of this Collection is declared to be a user-defined Proxy
type (in other words, the class descriptor for B has a user-defined
proxy specified for it). Also suppose the relation between As and Bs is
m:n. Thus when retrieving an instance of A, I also get with it an
associated Collection of proxies to the Bs.
Assuming use of the PB (ie auto-update defaults to 'false') I now change
something in the A instance (does not matter what), then call pb.store
on A to register the change. Looking at the code the 'store()' method
correctly checks for a top-level Proxy - however when we get to the
'storeCollections' method, and then the call to 'storeCollectionObject'
there is NO check for a Proxy in the 'storeCollectionObject' method.
This is caught in the top-level 'store' method *but only* if auto-update
is set to 'true' - otherwise the method drops out and proceeds to the
'storeMtoNImplementor' call, which first attempts to find a Proxy class
descriptor and then throws a ClassNotPersistenceCapableException.
Have I read the code correctly here? Has anyone else experienced this?
This has cropped up with our application on OJB 0.9.7, but I have
checked the rc5 code and the relevant parts look pretty much the same.
Comments welcome.

Cheers,

Chris

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


Re: soft-deleting objects

2004-03-24 Thread Tino Schöllhorn
Hello Charles,

honestly I don't understand how this could help me as I don't have any 
subclassing in my use-case. As I understand the mapping you showed me is 
 for mapping class-hierarchies - which is definetely not what I want. 
But thank for your help anyway - I think I am on the right way now 
(using a custom Criteria and a QueryCustomizer).

Tino

Charles N. Harvey III wrote:

Tino,
Are your tables joined?  It sounds like they should be.  Like, 
department_id
is the foreign key in SUB_DEPARTMENT.  That's what it seems like the 
setup is.
If so, you should take a look at this:
http://db.apache.org/ojb/tutorial3.html#Mapping%20Classes%20on%20Multiple%20Joined%20Tables 

If your tables are setup this way, you can add criteria to your query based
on either table.  So...
Criteria crit = new MyCriteria();
crit.addEqualTo( "department", "A" );  // adds "WHERE dept.department = 
'A'"
crit.addEqualTo( "deleted", "false" ); // adds "WHERE sub.deleted = 
'false'"

Take a look at the tutorial, its really helpful in describing better 
ways to
setup your data and how to query it.

Charlie



Tino Schöllhorn wrote:

Hi,

I just tried what you suggested and it seems to work fine.

1.) I extended Criteria and use only my subclass to query extents
2.) I am using a QueryCustomizer to load only those references which 
have not been deleted.

But now I encounter some more difficulties when I am using decomposed 
relations.

I have a class Department. Departments can have subdeparments and I 
have an association-class DepartmentDepartment which store some 
information about the relationship.

For the sake of clearity say I have the following departments: A, B, C 
(deleted) and relations A->C, A->B

What I expect is, that when I access Department A it only has 1 
departments (namely B) because C has been marked as deleted. But my 
(quite simple) query-customizer cannot handle this case. At the moment 
it is implemented like this:

public Query customizeQuery(
Object obj, PersistenceBroker pb, CollectionDescriptor cd, 
Query q) {
   Criteria res = new RespectDeletedCriteria();
   Criteria org = q.getCriteria();
   org.addAndCriteria(res);
   return QueryFactory.newQuery(q.getBaseClass(), org);
}

Do you have any suggestions how to handle this ?

Tino





Charles N. Harvey III wrote:

I don't think you can tell OJB to always use a certain Criteria object.
 From your example below, I would change it to this:
MyCriteria crit = new MyCriteria();
Query q = QueryFactory.newQuery( MyClass, crit );
Collection objects = pb.getCollectionByQuery( q );
As long as you always do "new MyCriteria()" instead of "new Criteria()"
you should be fine.  The only other thing I would suggest is to abstract
the PersistenceBroker into a general use class so you don't have to
instantiate it all the time.
---
public class MyRepository
{
   public MyRepository getInstance()
   {   return new MyRepository();
   }
   protected PersistenceBroker getPersistenceBroker()
   {   PersistenceBroker broker = 
PersistenceBrokerFactory.createPersistenceBroker( this.pbKey );
   return broker;
   }
   protected void releasePersistenceBroker( PersistenceBroker broker )
   {   if( broker != null )
   broker.close();
   }
   public Collection selectMyObjects( Class myClass )
   throws OJBException
   {MyCriteria crit = new MyCriteria();
Query q = QueryFactory.newQuery( myClass, crit );
return selectObjects( q );
   }
   public Collection selectObjects( Query query )
   throws OJBException
   {   PersistenceBroker broker = null;
   try
   {   broker = this.getPersistenceBroker();
   return broker.getCollectionByQuery( query );
   }
   catch( Throwable e )
   {   throw new OJBException( e );
   }
   finally
   {   this.releasePersistenceBroker( broker );
   }
   }
}
---

Then, your queries would be as simple as this:

MyRepository repo = MyRepository.getInstance();
Collection objects = repo.selectMyObjects( MyClass.class );
Well, that's how I do it anyway.  You might not like that as much.  
But that
makes sure your queries are always the same, and I really like not 
having to fuss
about with the PersistenceBroker all the time.

Charlie





Tino Schöllhorn wrote:

Hi,

that sounds great. Is there a way to tell OJB that it always should 
use MyCriteria from the QueryFactory?

Or do I have to implement an own version of it?

Regards
Tino
Charles N. Harvey III wrote:

Extend Criteria with a MyCriteria.

public class MyCriteria extends Criteria
{
   public MyCriteria()
   {
   addDeletedEqualTo( true );
   }
   public addDeletedEqualTo( boolean bValue )
   {
   this.addEqualTo( "deleted", bValue );
   }
}
Works for me.  I usually create a Criteria object for each OJB 
Object that
I have.  I add a 

Changing Loading Behaviour for N-M-Relations

2004-03-24 Thread Tino Schöllhorn
Hi,

I am trying to change the behaviour of loading N-M-Relations - but I 
have some trouble here.

Essentially I have one class "Department" and a relationship 
"subdepartment" (so I have 2 tables Department and 
Department_Department). Now I want that OJB loads only those 
subdepartments of a Department D which have a certain flag set (here: 
deleted).

I tried to use a QueryCustomizer to modify the Query - but I am stuck. I 
thought I could modify the Query which loads the relations in the way I 
want. But I don't know how to modify the QueryByMtoNCriteria-Object 
which comes by.

I think this approach should work (at least it does with 1:N) - any 
suggestions?

Tino



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: soft-deleting objects

2004-03-24 Thread Charles N. Harvey III
Tino,
Are your tables joined?  It sounds like they should be.  Like, department_id
is the foreign key in SUB_DEPARTMENT.  That's what it seems like the 
setup is.
If so, you should take a look at this:
http://db.apache.org/ojb/tutorial3.html#Mapping%20Classes%20on%20Multiple%20Joined%20Tables

If your tables are setup this way, you can add criteria to your query based
on either table.  So...
Criteria crit = new MyCriteria();
crit.addEqualTo( "department", "A" );  // adds "WHERE dept.department = 'A'"
crit.addEqualTo( "deleted", "false" ); // adds "WHERE sub.deleted = 'false'"
Take a look at the tutorial, its really helpful in describing better ways to
setup your data and how to query it.
Charlie



Tino Schöllhorn wrote:

Hi,

I just tried what you suggested and it seems to work fine.

1.) I extended Criteria and use only my subclass to query extents
2.) I am using a QueryCustomizer to load only those references which 
have not been deleted.

But now I encounter some more difficulties when I am using decomposed 
relations.

I have a class Department. Departments can have subdeparments and I 
have an association-class DepartmentDepartment which store some 
information about the relationship.

For the sake of clearity say I have the following departments: A, B, C 
(deleted) and relations A->C, A->B

What I expect is, that when I access Department A it only has 1 
departments (namely B) because C has been marked as deleted. But my 
(quite simple) query-customizer cannot handle this case. At the moment 
it is implemented like this:

public Query customizeQuery(
Object obj, PersistenceBroker pb, CollectionDescriptor cd, 
Query q) {
   
Criteria res = new RespectDeletedCriteria();
   
Criteria org = q.getCriteria();
   
org.addAndCriteria(res);
   
return QueryFactory.newQuery(q.getBaseClass(), org);
}

Do you have any suggestions how to handle this ?

Tino





Charles N. Harvey III wrote:

I don't think you can tell OJB to always use a certain Criteria object.
 From your example below, I would change it to this:
MyCriteria crit = new MyCriteria();
Query q = QueryFactory.newQuery( MyClass, crit );
Collection objects = pb.getCollectionByQuery( q );
As long as you always do "new MyCriteria()" instead of "new Criteria()"
you should be fine.  The only other thing I would suggest is to abstract
the PersistenceBroker into a general use class so you don't have to
instantiate it all the time.
---
public class MyRepository
{
   public MyRepository getInstance()
   {   return new MyRepository();
   }
   protected PersistenceBroker getPersistenceBroker()
   {   PersistenceBroker broker = 
PersistenceBrokerFactory.createPersistenceBroker( this.pbKey );
   return broker;
   }
   protected void releasePersistenceBroker( PersistenceBroker broker )
   {   if( broker != null )
   broker.close();
   }
   public Collection selectMyObjects( Class myClass )
   throws OJBException
   {MyCriteria crit = new MyCriteria();
Query q = QueryFactory.newQuery( myClass, crit );
return selectObjects( q );
   }
   public Collection selectObjects( Query query )
   throws OJBException
   {   PersistenceBroker broker = null;
   try
   {   broker = this.getPersistenceBroker();
   return broker.getCollectionByQuery( query );
   }
   catch( Throwable e )
   {   throw new OJBException( e );
   }
   finally
   {   this.releasePersistenceBroker( broker );
   }
   }
}
---

Then, your queries would be as simple as this:

MyRepository repo = MyRepository.getInstance();
Collection objects = repo.selectMyObjects( MyClass.class );
Well, that's how I do it anyway.  You might not like that as much.  
But that
makes sure your queries are always the same, and I really like not 
having to fuss
about with the PersistenceBroker all the time.

Charlie





Tino Schöllhorn wrote:

Hi,

that sounds great. Is there a way to tell OJB that it always should 
use MyCriteria from the QueryFactory?

Or do I have to implement an own version of it?

Regards
Tino
Charles N. Harvey III wrote:

Extend Criteria with a MyCriteria.

public class MyCriteria extends Criteria
{
   public MyCriteria()
   {
   addDeletedEqualTo( true );
   }
   public addDeletedEqualTo( boolean bValue )
   {
   this.addEqualTo( "deleted", bValue );
   }
}
Works for me.  I usually create a Criteria object for each OJB 
Object that
I have.  I add a bunch of convenience methods to add values to the 
criteria.

Charlie

Tino Schöllhorn wrote:

Hallo Daniel,

that sound great. But still I do have one question: how could you 
then load all non-deleted object *without* using the deleted-flag. 
I mean something like

Criteria crit = new Criteria();
// I can use any criteria here but I don't want to have to use 
"deleted"


Query q = 

Re: 1.0 - one more bug

2004-03-24 Thread Edson Carlos Ericksson Richter
Ops, the correct is "The afterstore method is NOT being called".

Tkx,
Edson Richter

- Original Message - 
From: "Edson Carlos Ericksson Richter" <[EMAIL PROTECTED]>
To: "'OJB Users List'" <[EMAIL PROTECTED]>
Sent: Wednesday, March 24, 2004 4:25 PM
Subject: 1.0 - one more bug


The afterstore method is being called. This is very embaracing since we need
this for the RemovalAwareCollection (and RemovalAwareList).

This is a known bug, is there a workaround?

Thanks in advantage,

Edson Richter



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.637 / Virus Database: 408 - Release Date: 20/3/2004


smime.p7s
Description: S/MIME cryptographic signature


1.0 - one more bug

2004-03-24 Thread Edson Carlos Ericksson Richter
The afterstore method is being called. This is very embaracing since we need
this for the RemovalAwareCollection (and RemovalAwareList).

This is a known bug, is there a workaround?

Thanks in advantage,

Edson Richter



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.637 / Virus Database: 408 - Release Date: 20/3/2004


smime.p7s
Description: S/MIME cryptographic signature


1 - many without a unique key...

2004-03-24 Thread Guerrero, Axel
I have two tables (let's say person and address) .. there is a 1 to many relationship 
(one person, many addresses)
however, the address table does not have a PK (it does have a FK to person id)..
the layout is similar to:

Person
--
person_id varchar(10) not null primary key
first_name varchar(20)
last_name varchar(20)



Address
--
person_id varchar(10)  // points back to person table
address_line_1 varchar(20)
city varchar(20)



I do have a collection relationship from person to address through person_id... 
defined as follows





The problem is that if I query for a person object, I get N copies of the same address 
instead of N different addresses.

I have no option to modify the tables as they are used in numerous different 
applications.
Is there anything that I can try?

Axel Guerrero


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: soft-deleting objects

2004-03-24 Thread Tino Schöllhorn
Hi,

I just tried what you suggested and it seems to work fine.

1.) I extended Criteria and use only my subclass to query extents
2.) I am using a QueryCustomizer to load only those references which 
have not been deleted.

But now I encounter some more difficulties when I am using decomposed 
relations.

I have a class Department. Departments can have subdeparments and I have 
an association-class DepartmentDepartment which store some information 
about the relationship.

For the sake of clearity say I have the following departments: A, B, C 
(deleted) and relations A->C, A->B

What I expect is, that when I access Department A it only has 1 
departments (namely B) because C has been marked as deleted. But my 
(quite simple) query-customizer cannot handle this case. At the moment 
it is implemented like this:

public Query customizeQuery(
Object obj, PersistenceBroker pb, CollectionDescriptor cd, 
Query q) {

Criteria res = new RespectDeletedCriteria();

Criteria org = q.getCriteria();

org.addAndCriteria(res);

return QueryFactory.newQuery(q.getBaseClass(), org);
}
Do you have any suggestions how to handle this ?

Tino





Charles N. Harvey III wrote:

I don't think you can tell OJB to always use a certain Criteria object.
 From your example below, I would change it to this:
MyCriteria crit = new MyCriteria();
Query q = QueryFactory.newQuery( MyClass, crit );
Collection objects = pb.getCollectionByQuery( q );
As long as you always do "new MyCriteria()" instead of "new Criteria()"
you should be fine.  The only other thing I would suggest is to abstract
the PersistenceBroker into a general use class so you don't have to
instantiate it all the time.
---
public class MyRepository
{
   public MyRepository getInstance()
   {   return new MyRepository();
   }
   protected PersistenceBroker getPersistenceBroker()
   {   PersistenceBroker broker = 
PersistenceBrokerFactory.createPersistenceBroker( this.pbKey );
   return broker;
   }
   protected void releasePersistenceBroker( PersistenceBroker broker )
   {   if( broker != null )
   broker.close();
   }
   public Collection selectMyObjects( Class myClass )
   throws OJBException
   {MyCriteria crit = new MyCriteria();
Query q = QueryFactory.newQuery( myClass, crit );
return selectObjects( q );
   }
   public Collection selectObjects( Query query )
   throws OJBException
   {   PersistenceBroker broker = null;
   try
   {   broker = this.getPersistenceBroker();
   return broker.getCollectionByQuery( query );
   }
   catch( Throwable e )
   {   throw new OJBException( e );
   }
   finally
   {   this.releasePersistenceBroker( broker );
   }
   }
}
---

Then, your queries would be as simple as this:

MyRepository repo = MyRepository.getInstance();
Collection objects = repo.selectMyObjects( MyClass.class );
Well, that's how I do it anyway.  You might not like that as much.  But 
that
makes sure your queries are always the same, and I really like not 
having to fuss
about with the PersistenceBroker all the time.

Charlie





Tino Schöllhorn wrote:

Hi,

that sounds great. Is there a way to tell OJB that it always should 
use MyCriteria from the QueryFactory?

Or do I have to implement an own version of it?

Regards
Tino
Charles N. Harvey III wrote:

Extend Criteria with a MyCriteria.

public class MyCriteria extends Criteria
{
   public MyCriteria()
   {
   addDeletedEqualTo( true );
   }
   public addDeletedEqualTo( boolean bValue )
   {
   this.addEqualTo( "deleted", bValue );
   }
}
Works for me.  I usually create a Criteria object for each OJB Object 
that
I have.  I add a bunch of convenience methods to add values to the 
criteria.

Charlie

Tino Schöllhorn wrote:

Hallo Daniel,

that sound great. But still I do have one question: how could you 
then load all non-deleted object *without* using the deleted-flag. I 
mean something like

Criteria crit = new Criteria();
// I can use any criteria here but I don't want to have to use 
"deleted"


Query q = QueryFactory.newQuery(MyClass, myCriteria);

Collection objects = pb.getCollectionByQuery(q);

// the result are all Objects which have the deleted-flag == false

Any suggestions?

regards
Tino
Daniel Perry wrote:

I am using this in a complex app (due to idiot admin users deleting 
stuff
they shouldnt!).  All objects have a boolean (mapped to int) 
"deleted".  For
all queries i look for objects with deleted=false.  For 
relationships, i
wrote a querycustomizer which adds deleted=false to collections. 
(see below
example)

It;s very simple and works a treat!

If you have a 'base' bean, which all other beans inherit, you can 
put the
'del

Re: MtoNCollectionPrefetcher.buildPrefetchCriteriaMultipleKeys(MtoNCollectionPrefetcher.java:338)

2004-03-24 Thread Edson Carlos Ericksson Richter
Here is excerpt for the collection-descriptor :

  
 
 
 
 
 
  

As you can see, the fk-pointing-to-this-class uses 2 fields, and the 
fk-pointing-to-element-class uses 3 fields.

I don't have a test case (but I think armin has one). The collection-descriptor I show 
here was takes directly from my production code.


Best regards,

Edson Richter

  - Original Message - 
  From: Jakob Braeuchi 
  To: OJB Users List 
  Sent: Wednesday, March 24, 2004 3:25 PM
  Subject: Re: 
MtoNCollectionPrefetcher.buildPrefetchCriteriaMultipleKeys(MtoNCollectionPrefetcher.java:338)


  hi armin, edson,

  it looks like the number of pk-fields and the number of columns in the 
  indirection table pointing to the m-side class are not the same.

  could you please send me the testcase ?

  jakob

  Armin Waibel wrote:

  > Hi Edson,
  > 
  > I have the same problem here is my stack trace
  > 
  > java.lang.ArrayIndexOutOfBoundsException: 1
  > at 
  > 
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchCriteriaMultipleKeys(MtoNCollectionPrefetcher.java:338)
 
  > 
  > at 
  > 
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchCriteria(MtoNCollectionPrefetcher.java:259)
 
  > 
  > at 
  > 
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchQuery(MtoNCollectionPrefetcher.java:115)
 
  > 
  > at 
  > 
org.apache.ojb.broker.accesslayer.CollectionPrefetcher.buildPrefetchQueries(CollectionPrefetcher.java:93)
 
  > 
  > 
  > seems the both are the same. I implemented a test case for the problem, 
  > but I'm currently working on the auto-xxx stuff so I can't send much 
  > time for that - put this on my imaginary todo-list for 1.0 ;-)
  > 
  > regards,
  > Armin
  > 
  > 
  > Edson Carlos Ericksson Richter wrote:
  > 
  >> This bug is driving me crazy... Someone could point me what changed 
  >> from rc5
  >> to 1.0 in this method (so I can at least fix locally)?
  >>
  >> The problem is a M:N mapping using composite pk pointing the M bean, 
  >> and 1
  >> field pk pointing to the N bean.
  >> The stack trace is:
  >>
  >> java.lang.ArrayIndexOutOfBoundsException: 1
  >> at
  >> org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchCrit 
  >>
  >> eriaMultipleKeys(MtoNCollectionPrefetcher.java:338)
  >> at
  >> org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchCrit 
  >>
  >> eria(MtoNCollectionPrefetcher.java:259)
  >> at
  >> org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchQuer 
  >>
  >> y(MtoNCollectionPrefetcher.java:115)
  >> at
  >> org.apache.ojb.broker.accesslayer.CollectionPrefetcher.buildPrefetchQueries( 
  >>
  >> CollectionPrefetcher.java:93)
  >> at
  >> org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.prefetchRelations 
  >>
  >> hip(MtoNCollectionPrefetcher.java:68)
  >> at
  >> org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(QueryR 
  >>
  >> eferenceBroker.java:277)
  >> at
  >> org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryRe 
  >>
  >> ferenceBroker.java:146)
  >> at
  >> org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryRe 
  >>
  >> ferenceBroker.java:203)
  >> at
  >> org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Persis 
  >>
  >> tenceBrokerImpl.java:1046)
  >> at
  >> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery( 
  >>
  >> DelegatingPersistenceBroker.java:321)
  >> at
  >> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery( 
  >>
  >> DelegatingPersistenceBroker.java:321)
  >> at
  >> org.apache.ojb.broker.accesslayer.CollectionProxy.loadData(CollectionProxy.j 
  >>
  >> ava:109)
  >> at
  >> org.apache.ojb.broker.accesslayer.ListProxy.loadData(ListProxy.java:148)
  >> at
  >> org.apache.ojb.broker.accesslayer.CollectionProxy.getData(CollectionProxy.ja 
  >>
  >> va:362)
  >> at
  >> org.apache.ojb.broker.accesslayer.ListProxy.getListData(ListProxy.java:140) 
  >>
  >> at
  >> org.apache.ojb.broker.accesslayer.ListProxy.get(ListProxy.java:71)
  >> at
  >> br.com.mgr.dialogs.ListBasedListModel.getElementAt(ListBasedListModel.java:6 
  >>
  >> 3)
  >> at
  >> javax.swing.plaf.basic.BasicListUI.updateLayoutState(BasicListUI.java:1147) 
  >>
  >> at
  >> javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(BasicListUI.java:1 
  >>
  >> 098)
  >> at
  >> javax.swing.plaf.basic.BasicListUI.getPreferredSize(BasicListUI.java:281)
  >> at javax.swing.JComponent.getPreferredSize(JComponent.java:1275)
  >> at
  >> javax.swing.JList.getPreferredScrollableViewportSize(JList.java:1913)
  >> at
  >> javax.swing.ViewportLayout.preferredLayoutSize(ViewportLayout.java:72)
  >> at java.awt.Container.pr

Re: Insertion semantics

2004-03-24 Thread Laurie Harper
Is there more information I can provide so someone can help me 
understand what I'm doing wrong here? I'm completely blocked at the 
moment :-(

To re-iterate:

- persisting new objects which collide with previously existing objects 
results in an error, but not where I'd expect

- persisting multiple objects to the database that violate unique 
constraints doesn't raise any errors

- I can't delete newly inserted objects; OJB keys on column data it 
doesn't have available

Currently, this means that data entry is intrinsically unreliable in my 
app, since the data you just entered may or may not ever make it into 
the database, and I can't recover from errors by cleaning up earlier 
transactions because deletes don't work.

Any help would be appreciated.

L.

Laurie Harper wrote:
What are the expected semantics for object insertion? I'm a bit confused 
by what I'm seeing here  Here's some sample code:

Player p1 = null, p2 = null, p3 = null;

Implementation odmg = OJB.getInstance();
Database db = odmg.newDatabase();
db.open("repository.xml", Database.OPEN_READ_ONLY);
try {
System.out.println("insert p1 (pre-existing)");
p1 = new Player("name1", "player11", "pwd");
Transaction txn = odmg.newTransaction();
txn.begin();
txn.lock(p1, Transaction.WRITE);
System.out.println("commit");
txn.commit();
System.out.println("ok");
} catch (Throwable t) {
System.out.println("got a "+t.getClass().getName());
}
try {
System.out.println("insert p2 (new)");
Transaction txn = odmg.newTransaction();
txn.begin();
p2 = new Player("name3", "player3", "pwd");
txn.lock(p2, Transaction.WRITE);
System.out.println("insert p2 (again)");
p3 = new Player("name3", "player3", "pwd");
txn.lock(p3, Transaction.WRITE);
System.out.println("commit");
txn.commit();
System.out.println("ok");
} catch (Throwable t) {
System.out.println("got a "+t.getClass().getName());
t.printStackTrace();
}
System.out.println("clean-up");
try {
Transaction txn = odmg.newTransaction();
txn.begin();
db.deletePersistent(p2);
txn.commit();
} catch (Throwable t) {
System.out.println("got a "+t.getClass().getName());
}
db.close();
}
Assume player1 exists and player3 doesn't. I'm getting several surprises 
with this.

First, the insertion of player1 fails, as it should. But I expected it 
to fail on the call to lock(). It doesn't fail until the commit() at 
which point I get a org.apache.ojb.odmg.TransactionAbortedExceptionOJB. 
Is this the expected behaviour?

Next, the insertion of player3. This succeeds. What I was expecting was 
an error on the second call to lock(). I could see it failing in 
commit() instead for consistency with what I saw on player1, but it 
ought to fail somewhere shouldn't it?

Finally, the call to deletePersistent is having no effect. I'm unable to 
delete objects after I insert them. Am I doing something wrong or is 
this an OJB bug?

I suspect some or all of these problems may be to do with OJB's primary 
key handling. I'm using database native sequences and OJB seems not to 
cope with that correctly, going on the SQL statements P6Spy is reporting:

1079658237422|1|0|statement|SELECT password,email,name,ID FROM PLAYER 
WHERE ID = ? |SELECT password,email,name,ID FROM PLAYER WHERE ID = ''
[from the first call to lock() on player3; the second call generates no 
SQL]

1079658237473|2|0|statement|DELETE FROM PLAYER WHERE ID = ? |DELETE FROM 
PLAYER WHERE ID = ''
[on the call to deletePersistent, which explains why it's not doing much]

ID is an anonymous property on Player; could that be a factor? Here's 
the repository entry for the class:














If you need more info to diagnose what's going on, let me know.

L.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: MtoNCollectionPrefetcher.buildPrefetchCriteriaMultipleKeys(MtoNCollectionPrefetcher.java:338)

2004-03-24 Thread Jakob Braeuchi
hi armin, edson,

it looks like the number of pk-fields and the number of columns in the 
indirection table pointing to the m-side class are not the same.

could you please send me the testcase ?

jakob

Armin Waibel wrote:

Hi Edson,

I have the same problem here is my stack trace

java.lang.ArrayIndexOutOfBoundsException: 1
at 
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchCriteriaMultipleKeys(MtoNCollectionPrefetcher.java:338) 

at 
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchCriteria(MtoNCollectionPrefetcher.java:259) 

at 
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchQuery(MtoNCollectionPrefetcher.java:115) 

at 
org.apache.ojb.broker.accesslayer.CollectionPrefetcher.buildPrefetchQueries(CollectionPrefetcher.java:93) 

seems the both are the same. I implemented a test case for the problem, 
but I'm currently working on the auto-xxx stuff so I can't send much 
time for that - put this on my imaginary todo-list for 1.0 ;-)

regards,
Armin
Edson Carlos Ericksson Richter wrote:

This bug is driving me crazy... Someone could point me what changed 
from rc5
to 1.0 in this method (so I can at least fix locally)?

The problem is a M:N mapping using composite pk pointing the M bean, 
and 1
field pk pointing to the N bean.
The stack trace is:

java.lang.ArrayIndexOutOfBoundsException: 1
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchCrit 

eriaMultipleKeys(MtoNCollectionPrefetcher.java:338)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchCrit 

eria(MtoNCollectionPrefetcher.java:259)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchQuer 

y(MtoNCollectionPrefetcher.java:115)
at
org.apache.ojb.broker.accesslayer.CollectionPrefetcher.buildPrefetchQueries( 

CollectionPrefetcher.java:93)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.prefetchRelations 

hip(MtoNCollectionPrefetcher.java:68)
at
org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(QueryR 

eferenceBroker.java:277)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryRe 

ferenceBroker.java:146)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryRe 

ferenceBroker.java:203)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Persis 

tenceBrokerImpl.java:1046)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery( 

DelegatingPersistenceBroker.java:321)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery( 

DelegatingPersistenceBroker.java:321)
at
org.apache.ojb.broker.accesslayer.CollectionProxy.loadData(CollectionProxy.j 

ava:109)
at
org.apache.ojb.broker.accesslayer.ListProxy.loadData(ListProxy.java:148)
at
org.apache.ojb.broker.accesslayer.CollectionProxy.getData(CollectionProxy.ja 

va:362)
at
org.apache.ojb.broker.accesslayer.ListProxy.getListData(ListProxy.java:140) 

at
org.apache.ojb.broker.accesslayer.ListProxy.get(ListProxy.java:71)
at
br.com.mgr.dialogs.ListBasedListModel.getElementAt(ListBasedListModel.java:6 

3)
at
javax.swing.plaf.basic.BasicListUI.updateLayoutState(BasicListUI.java:1147) 

at
javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(BasicListUI.java:1 

098)
at
javax.swing.plaf.basic.BasicListUI.getPreferredSize(BasicListUI.java:281)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1275)
at
javax.swing.JList.getPreferredScrollableViewportSize(JList.java:1913)
at
javax.swing.ViewportLayout.preferredLayoutSize(ViewportLayout.java:72)
at java.awt.Container.preferredSize(Container.java:1178)
at java.awt.Container.getPreferredSize(Container.java:1162)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1277)
at
javax.swing.ScrollPaneLayout.preferredLayoutSize(ScrollPaneLayout.java:475) 

at java.awt.Container.preferredSize(Container.java:1178)
at java.awt.Container.getPreferredSize(Container.java:1162)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1277)
at 
java.awt.BorderLayout.preferredLayoutSize(BorderLayout.java:572)
at java.awt.Container.preferredSize(Container.java:1178)
at java.awt.Container.getPreferredSize(Container.java:1162)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1277)
at
javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.calculateSize(Basi 

cTabbedPaneUI.java:2001)
at
javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.preferredLayoutSiz 

e(BasicTabbedPaneUI.java:1975)
at java.awt.Container.preferredSize(Container.java:1178)
at java.awt.Container.getPreferredSize(Container.java:1162)
at javax.swing.JComponent.get

Re: Two Collections of Same Object Types

2004-03-24 Thread Jakob Braeuchi
hi gary,

you could try to use a quer-customizer.

hth
jakob
Gary wrote:

I need to have an object (say, CollegeCourse) that
contains two collections of Students: one that has all
registered students, and the other unregistered
students.
I know I can just do this separation in Java - is
there a way I can have OJB separate the two when it
loads the collections?
Thanks, Gary

__
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html
-
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]


Re: MtoNCollectionPrefetcher.buildPrefetchCriteriaMultipleKeys(MtoNCollectionPrefetcher.java:338)

2004-03-24 Thread Edson Carlos Ericksson Richter
Hum... There is some instability here.
I don't know what combination of dynamic proxies/collection proxies is
causing this bug. I've fixed using either proxy=true in the collections
inside each bean...

Why? I really don't know. I'll need to compare each of the 12 collections
involved in this beans to know what's give the stack trace...
I'll need sometime to restart the app 132 times to know :(

Anyway, if someone could send me the rc5 implementation of the method, so I
can compare with actual, I'll appreciate.

Thanks in advantage.


Edson Richter


- Original Message - 
From: Edson Carlos Ericksson Richter
To: 'OJB Users List'
Sent: Wednesday, March 24, 2004 2:46 PM
Subject:
MtoNCollectionPrefetcher.buildPrefetchCriteriaMultipleKeys(MtoNCollectionPre
fetcher.java:338)


This bug is driving me crazy... Someone could point me what changed from rc5
to 1.0 in this method (so I can at least fix locally)?

The problem is a M:N mapping using composite pk pointing the M bean, and 1
field pk pointing to the N bean.
The stack trace is:

java.lang.ArrayIndexOutOfBoundsException: 1
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchCrit
eriaMultipleKeys(MtoNCollectionPrefetcher.java:338)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchCrit
eria(MtoNCollectionPrefetcher.java:259)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchQuer
y(MtoNCollectionPrefetcher.java:115)
at
org.apache.ojb.broker.accesslayer.CollectionPrefetcher.buildPrefetchQueries(
CollectionPrefetcher.java:93)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.prefetchRelations
hip(MtoNCollectionPrefetcher.java:68)
at
org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(QueryR
eferenceBroker.java:277)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryRe
ferenceBroker.java:146)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryRe
ferenceBroker.java:203)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Persis
tenceBrokerImpl.java:1046)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(
DelegatingPersistenceBroker.java:321)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(
DelegatingPersistenceBroker.java:321)
at
org.apache.ojb.broker.accesslayer.CollectionProxy.loadData(CollectionProxy.j
ava:109)
at
org.apache.ojb.broker.accesslayer.ListProxy.loadData(ListProxy.java:148)
at
org.apache.ojb.broker.accesslayer.CollectionProxy.getData(CollectionProxy.ja
va:362)
at
org.apache.ojb.broker.accesslayer.ListProxy.getListData(ListProxy.java:140)
at
org.apache.ojb.broker.accesslayer.ListProxy.get(ListProxy.java:71)
at
br.com.mgr.dialogs.ListBasedListModel.getElementAt(ListBasedListModel.java:6
3)
at
javax.swing.plaf.basic.BasicListUI.updateLayoutState(BasicListUI.java:1147)
at
javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(BasicListUI.java:1
098)
at
javax.swing.plaf.basic.BasicListUI.getPreferredSize(BasicListUI.java:281)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1275)
at
javax.swing.JList.getPreferredScrollableViewportSize(JList.java:1913)
at
javax.swing.ViewportLayout.preferredLayoutSize(ViewportLayout.java:72)
at java.awt.Container.preferredSize(Container.java:1178)
at java.awt.Container.getPreferredSize(Container.java:1162)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1277)
at
javax.swing.ScrollPaneLayout.preferredLayoutSize(ScrollPaneLayout.java:475)
at java.awt.Container.preferredSize(Container.java:1178)
at java.awt.Container.getPreferredSize(Container.java:1162)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1277)
at java.awt.BorderLayout.preferredLayoutSize(BorderLayout.java:572)
at java.awt.Container.preferredSize(Container.java:1178)
at java.awt.Container.getPreferredSize(Container.java:1162)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1277)
at
javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.calculateSize(Basi
cTabbedPaneUI.java:2001)
at
javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.preferredLayoutSiz
e(BasicTabbedPaneUI.java:1975)
at java.awt.Container.preferredSize(Container.java:1178)
at java.awt.Container.getPreferredSize(Container.java:1162)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1277)
at java.awt.GridBagLayout.GetLayoutInfo(GridBagLayout.java:892)
at java.awt.GridBagLayout.getLayoutInfo(GridBagLayout.java:806)
at java.awt.GridBagLayout.ArrangeGrid(GridBagLayout.java:1374)
at java.awt.GridBagLayout.arrangeGrid(GridBagLayout.java:1337)
at java.awt.Gr

Re: soft-deleting objects

2004-03-24 Thread Charles N. Harvey III
I don't think you can tell OJB to always use a certain Criteria object.
From your example below, I would change it to this:
MyCriteria crit = new MyCriteria();
Query q = QueryFactory.newQuery( MyClass, crit );
Collection objects = pb.getCollectionByQuery( q );
As long as you always do "new MyCriteria()" instead of "new Criteria()"
you should be fine.  The only other thing I would suggest is to abstract
the PersistenceBroker into a general use class so you don't have to
instantiate it all the time.
---
public class MyRepository
{
   public MyRepository getInstance()
   {   return new MyRepository();
   }
   protected PersistenceBroker getPersistenceBroker()
   {   PersistenceBroker broker = 
PersistenceBrokerFactory.createPersistenceBroker( this.pbKey );
   return broker;
   }
   protected void releasePersistenceBroker( PersistenceBroker broker )
   {   if( broker != null )
   broker.close();
   }
   public Collection selectMyObjects( Class myClass )
   throws OJBException
   {MyCriteria crit = new MyCriteria();
Query q = QueryFactory.newQuery( myClass, crit );
return selectObjects( q );
   }
   public Collection selectObjects( Query query )
   throws OJBException
   {   PersistenceBroker broker = null;
   try
   {   broker = this.getPersistenceBroker();
   return broker.getCollectionByQuery( query );
   }
   catch( Throwable e )
   {   throw new OJBException( e );
   }
   finally
   {   this.releasePersistenceBroker( broker );
   }
   }
}
---

Then, your queries would be as simple as this:

MyRepository repo = MyRepository.getInstance();
Collection objects = repo.selectMyObjects( MyClass.class );
Well, that's how I do it anyway.  You might not like that as much.  But that
makes sure your queries are always the same, and I really like not 
having to fuss
about with the PersistenceBroker all the time.

Charlie





Tino Schöllhorn wrote:

Hi,

that sounds great. Is there a way to tell OJB that it always should 
use MyCriteria from the QueryFactory?

Or do I have to implement an own version of it?

Regards
Tino
Charles N. Harvey III wrote:

Extend Criteria with a MyCriteria.

public class MyCriteria extends Criteria
{
   public MyCriteria()
   {
   addDeletedEqualTo( true );
   }
   public addDeletedEqualTo( boolean bValue )
   {
   this.addEqualTo( "deleted", bValue );
   }
}
Works for me.  I usually create a Criteria object for each OJB Object 
that
I have.  I add a bunch of convenience methods to add values to the 
criteria.

Charlie

Tino Schöllhorn wrote:

Hallo Daniel,

that sound great. But still I do have one question: how could you 
then load all non-deleted object *without* using the deleted-flag. I 
mean something like

Criteria crit = new Criteria();
// I can use any criteria here but I don't want to have to use 
"deleted"


Query q = QueryFactory.newQuery(MyClass, myCriteria);

Collection objects = pb.getCollectionByQuery(q);

// the result are all Objects which have the deleted-flag == false

Any suggestions?

regards
Tino
Daniel Perry wrote:

I am using this in a complex app (due to idiot admin users deleting 
stuff
they shouldnt!).  All objects have a boolean (mapped to int) 
"deleted".  For
all queries i look for objects with deleted=false.  For 
relationships, i
wrote a querycustomizer which adds deleted=false to collections. 
(see below
example)

It;s very simple and works a treat!

If you have a 'base' bean, which all other beans inherit, you can 
put the
'deleted' attribute there, and can use a delete method for deleting 
any
beans! (note: i dont use extents for this in the repository, just 
map it for
all beans)


element-class-ref="com.netcase.pdp.bo.JobSubFamily" proxy="true">


class="com.netcase.pdp.ojb.NestedElementCustomQuery">

attribute-value="deleted"/>




-Original Message-
From: Brian McCallister [mailto:[EMAIL PROTECTED]
Sent: 23 March 2004 14:01
To: OJB Users List
Subject: Re: soft-deleting objects
If you have a "deleted" style flag in the database for the soft delete
you can probably accomplish this via a query customizer. If you 
mean to
not flag the delete in the database at all, but only treat it as such
in the application -- that is a bit trickier, but can probably be done
via pb callbacks/row readers.

-Brian

On Mar 23, 2004, at 6:21 AM, Tino Schöllhorn wrote:


Hi,

I want to implement something like a soft-delete:

Objects should be marked as "deleted" in its corresponing table and
OJB should just ignore them when it is materializing or querying 
them.

Where would be the best point to start when I want to implement this
feature? I just played around with the RowReader-Concept - but I have
the feeling that this is not the right place to start, because I 
think
I have to modify the queries O

Re: MtoNCollectionPrefetcher.buildPrefetchCriteriaMultipleKeys(MtoNCollectionPrefetcher.java:338)

2004-03-24 Thread Armin Waibel
Hi Edson,

I have the same problem here is my stack trace

java.lang.ArrayIndexOutOfBoundsException: 1
	at 
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchCriteriaMultipleKeys(MtoNCollectionPrefetcher.java:338)
	at 
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchCriteria(MtoNCollectionPrefetcher.java:259)
	at 
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchQuery(MtoNCollectionPrefetcher.java:115)
	at 
org.apache.ojb.broker.accesslayer.CollectionPrefetcher.buildPrefetchQueries(CollectionPrefetcher.java:93)

seems the both are the same. I implemented a test case for the problem, 
but I'm currently working on the auto-xxx stuff so I can't send much 
time for that - put this on my imaginary todo-list for 1.0 ;-)

regards,
Armin
Edson Carlos Ericksson Richter wrote:

This bug is driving me crazy... Someone could point me what changed from rc5
to 1.0 in this method (so I can at least fix locally)?
The problem is a M:N mapping using composite pk pointing the M bean, and 1
field pk pointing to the N bean.
The stack trace is:
java.lang.ArrayIndexOutOfBoundsException: 1
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchCrit
eriaMultipleKeys(MtoNCollectionPrefetcher.java:338)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchCrit
eria(MtoNCollectionPrefetcher.java:259)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchQuer
y(MtoNCollectionPrefetcher.java:115)
at
org.apache.ojb.broker.accesslayer.CollectionPrefetcher.buildPrefetchQueries(
CollectionPrefetcher.java:93)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.prefetchRelations
hip(MtoNCollectionPrefetcher.java:68)
at
org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(QueryR
eferenceBroker.java:277)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryRe
ferenceBroker.java:146)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryRe
ferenceBroker.java:203)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Persis
tenceBrokerImpl.java:1046)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(
DelegatingPersistenceBroker.java:321)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(
DelegatingPersistenceBroker.java:321)
at
org.apache.ojb.broker.accesslayer.CollectionProxy.loadData(CollectionProxy.j
ava:109)
at
org.apache.ojb.broker.accesslayer.ListProxy.loadData(ListProxy.java:148)
at
org.apache.ojb.broker.accesslayer.CollectionProxy.getData(CollectionProxy.ja
va:362)
at
org.apache.ojb.broker.accesslayer.ListProxy.getListData(ListProxy.java:140)
at
org.apache.ojb.broker.accesslayer.ListProxy.get(ListProxy.java:71)
at
br.com.mgr.dialogs.ListBasedListModel.getElementAt(ListBasedListModel.java:6
3)
at
javax.swing.plaf.basic.BasicListUI.updateLayoutState(BasicListUI.java:1147)
at
javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(BasicListUI.java:1
098)
at
javax.swing.plaf.basic.BasicListUI.getPreferredSize(BasicListUI.java:281)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1275)
at
javax.swing.JList.getPreferredScrollableViewportSize(JList.java:1913)
at
javax.swing.ViewportLayout.preferredLayoutSize(ViewportLayout.java:72)
at java.awt.Container.preferredSize(Container.java:1178)
at java.awt.Container.getPreferredSize(Container.java:1162)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1277)
at
javax.swing.ScrollPaneLayout.preferredLayoutSize(ScrollPaneLayout.java:475)
at java.awt.Container.preferredSize(Container.java:1178)
at java.awt.Container.getPreferredSize(Container.java:1162)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1277)
at java.awt.BorderLayout.preferredLayoutSize(BorderLayout.java:572)
at java.awt.Container.preferredSize(Container.java:1178)
at java.awt.Container.getPreferredSize(Container.java:1162)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1277)
at
javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.calculateSize(Basi
cTabbedPaneUI.java:2001)
at
javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.preferredLayoutSiz
e(BasicTabbedPaneUI.java:1975)
at java.awt.Container.preferredSize(Container.java:1178)
at java.awt.Container.getPreferredSize(Container.java:1162)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1277)
at java.awt.GridBagLayout.GetLayoutInfo(GridBagLayout.java:892)
at java.awt.GridBagLayout.getLayoutInfo(GridBagLayout.java:806)
at java.awt.GridBagLayout.ArrangeGrid(GridBagLayout.java:1374)
at java.awt.GridBagLayout.arra

MtoNCollectionPrefetcher.buildPrefetchCriteriaMultipleKeys(MtoNCollectionPrefetcher.java:338)

2004-03-24 Thread Edson Carlos Ericksson Richter
This bug is driving me crazy... Someone could point me what changed from rc5
to 1.0 in this method (so I can at least fix locally)?

The problem is a M:N mapping using composite pk pointing the M bean, and 1
field pk pointing to the N bean.
The stack trace is:

java.lang.ArrayIndexOutOfBoundsException: 1
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchCrit
eriaMultipleKeys(MtoNCollectionPrefetcher.java:338)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchCrit
eria(MtoNCollectionPrefetcher.java:259)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchQuer
y(MtoNCollectionPrefetcher.java:115)
at
org.apache.ojb.broker.accesslayer.CollectionPrefetcher.buildPrefetchQueries(
CollectionPrefetcher.java:93)
at
org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.prefetchRelations
hip(MtoNCollectionPrefetcher.java:68)
at
org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(QueryR
eferenceBroker.java:277)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryRe
ferenceBroker.java:146)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryRe
ferenceBroker.java:203)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Persis
tenceBrokerImpl.java:1046)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(
DelegatingPersistenceBroker.java:321)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(
DelegatingPersistenceBroker.java:321)
at
org.apache.ojb.broker.accesslayer.CollectionProxy.loadData(CollectionProxy.j
ava:109)
at
org.apache.ojb.broker.accesslayer.ListProxy.loadData(ListProxy.java:148)
at
org.apache.ojb.broker.accesslayer.CollectionProxy.getData(CollectionProxy.ja
va:362)
at
org.apache.ojb.broker.accesslayer.ListProxy.getListData(ListProxy.java:140)
at
org.apache.ojb.broker.accesslayer.ListProxy.get(ListProxy.java:71)
at
br.com.mgr.dialogs.ListBasedListModel.getElementAt(ListBasedListModel.java:6
3)
at
javax.swing.plaf.basic.BasicListUI.updateLayoutState(BasicListUI.java:1147)
at
javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(BasicListUI.java:1
098)
at
javax.swing.plaf.basic.BasicListUI.getPreferredSize(BasicListUI.java:281)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1275)
at
javax.swing.JList.getPreferredScrollableViewportSize(JList.java:1913)
at
javax.swing.ViewportLayout.preferredLayoutSize(ViewportLayout.java:72)
at java.awt.Container.preferredSize(Container.java:1178)
at java.awt.Container.getPreferredSize(Container.java:1162)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1277)
at
javax.swing.ScrollPaneLayout.preferredLayoutSize(ScrollPaneLayout.java:475)
at java.awt.Container.preferredSize(Container.java:1178)
at java.awt.Container.getPreferredSize(Container.java:1162)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1277)
at java.awt.BorderLayout.preferredLayoutSize(BorderLayout.java:572)
at java.awt.Container.preferredSize(Container.java:1178)
at java.awt.Container.getPreferredSize(Container.java:1162)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1277)
at
javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.calculateSize(Basi
cTabbedPaneUI.java:2001)
at
javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.preferredLayoutSiz
e(BasicTabbedPaneUI.java:1975)
at java.awt.Container.preferredSize(Container.java:1178)
at java.awt.Container.getPreferredSize(Container.java:1162)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1277)
at java.awt.GridBagLayout.GetLayoutInfo(GridBagLayout.java:892)
at java.awt.GridBagLayout.getLayoutInfo(GridBagLayout.java:806)
at java.awt.GridBagLayout.ArrangeGrid(GridBagLayout.java:1374)
at java.awt.GridBagLayout.arrangeGrid(GridBagLayout.java:1337)
at java.awt.GridBagLayout.layoutContainer(GridBagLayout.java:706)
at java.awt.Container.layout(Container.java:1020)
at java.awt.Container.doLayout(Container.java:1010)
at java.awt.Container.validateTree(Container.java:1092)
at java.awt.Container.validateTree(Container.java:1099)
at java.awt.Container.validateTree(Container.java:1099)
at java.awt.Container.validateTree(Container.java:1099)
at java.awt.Container.validate(Container.java:1067)
at
javax.swing.RepaintManager.validateInvalidComponents(RepaintManager.java:353
)
at
javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQu
eueUtilities.java:116)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQu

Re: soft-deleting objects

2004-03-24 Thread Tino Schöllhorn
Hi,

that sounds great. Is there a way to tell OJB that it always should use 
MyCriteria from the QueryFactory?

Or do I have to implement an own version of it?

Regards
Tino
Charles N. Harvey III wrote:

Extend Criteria with a MyCriteria.

public class MyCriteria extends Criteria
{
   public MyCriteria()
   {
   addDeletedEqualTo( true );
   }
   public addDeletedEqualTo( boolean bValue )
   {
   this.addEqualTo( "deleted", bValue );
   }
}
Works for me.  I usually create a Criteria object for each OJB Object that
I have.  I add a bunch of convenience methods to add values to the 
criteria.

Charlie

Tino Schöllhorn wrote:

Hallo Daniel,

that sound great. But still I do have one question: how could you then 
load all non-deleted object *without* using the deleted-flag. I mean 
something like

Criteria crit = new Criteria();
// I can use any criteria here but I don't want to have to use "deleted"

Query q = QueryFactory.newQuery(MyClass, myCriteria);

Collection objects = pb.getCollectionByQuery(q);

// the result are all Objects which have the deleted-flag == false

Any suggestions?

regards
Tino
Daniel Perry wrote:

I am using this in a complex app (due to idiot admin users deleting 
stuff
they shouldnt!).  All objects have a boolean (mapped to int) 
"deleted".  For
all queries i look for objects with deleted=false.  For relationships, i
wrote a querycustomizer which adds deleted=false to collections. (see 
below
example)

It;s very simple and works a treat!

If you have a 'base' bean, which all other beans inherit, you can put 
the
'deleted' attribute there, and can use a delete method for deleting any
beans! (note: i dont use extents for this in the repository, just map 
it for
all beans)


element-class-ref="com.netcase.pdp.bo.JobSubFamily" proxy="true">


class="com.netcase.pdp.ojb.NestedElementCustomQuery">

attribute-value="deleted"/>




-Original Message-
From: Brian McCallister [mailto:[EMAIL PROTECTED]
Sent: 23 March 2004 14:01
To: OJB Users List
Subject: Re: soft-deleting objects
If you have a "deleted" style flag in the database for the soft delete
you can probably accomplish this via a query customizer. If you mean to
not flag the delete in the database at all, but only treat it as such
in the application -- that is a bit trickier, but can probably be done
via pb callbacks/row readers.
-Brian

On Mar 23, 2004, at 6:21 AM, Tino Schöllhorn wrote:


Hi,

I want to implement something like a soft-delete:

Objects should be marked as "deleted" in its corresponing table and
OJB should just ignore them when it is materializing or querying them.
Where would be the best point to start when I want to implement this
feature? I just played around with the RowReader-Concept - but I have
the feeling that this is not the right place to start, because I think
I have to modify the queries OJB is submitting to the database.
Any ideas?

Regards
Tino


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


Collection Size Limit for Updates?

2004-03-24 Thread Chris Lewington
Hi all,

Does anyone know roughly what the biggest Collection size is that an
object can contain when doing an update? Around 1000 seems OK, but
20,000 throws an OutOfMemoryError. Since OJB does 'delete + insert' for
update, for an m:n relation with 20,000 objects you get 20,000 deletes,
then 20,000+ array copies then 20,000 inserts if you don't touch
anything in the Collection - thus changing eg only a String in the top
object results in this behaviour when all you really wanted was to
change a single column value in one table.

This is not an artifical situation - we have this in our project. We
cannot update a String in our top level object simply because it is
linked to 20,000 others, even though we are not touching those other
objects (or the relation between the two).

Cheers,

Chris


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Two Collections of Same Object Types

2004-03-24 Thread Gary
I need to have an object (say, CollegeCourse) that
contains two collections of Students: one that has all
registered students, and the other unregistered
students.

I know I can just do this separation in Java - is
there a way I can have OJB separate the two when it
loads the collections?

Thanks, Gary

__
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Complex (for me) OJB Problem

2004-03-24 Thread Gary
Thanks for all your help, Jakob - I'll give it a try!

Gary

--- Jakob Braeuchi <[EMAIL PROTECTED]> wrote:
> hi gary,
> 
> i propose you define a m:n mapping between Test and
> Test_Panel with 
> Panel_Test_Table as intermediate table.
> 
> i'm not sure about the pk Panel_Test_Table. in our
> examples the pk is the 
> combined pk of the linked tables. afaik it's not
> possible to define a special pk 
> for the intermediate table, but you could probably
> use an autoincrement feature 
> of your dbms.
> 
> the other point is that Test ans Test_Panel are
> mapped to the same table. ojb 
> uses the column ojbConcreteClass to distiguish the
> class in the table. this 
> column is automatically added in QueryFactory and
> it's also used by 
> RowReaderDefaultImpl to get the class to be
> instantiated.
> 
> protected ClassDescriptor selectClassDescriptor(Map
> row) throws 
> PersistenceBrokerException
>  {
>  // check if there is an attribute which
> tells us which concrete class 
> is to be instantiated
>  FieldDescriptor concreteClassFD =
> m_cld.getOjbConcreteClassField();
> 
>  if (concreteClassFD == null)
>  return m_cld;
>  else
>  {
> 
> 
> you'll have to implement your own row-reader using
> the column 'category' to 
> decide which class to use.
> 
> hth
> 
> jakob
> 
> Gary wrote:
> 
> > Jakob:
> > 
> > 
> >>>Thanks for your quick reply.
> > 
> > 
> > --- Jakob Braeuchi <[EMAIL PROTECTED]> wrote:
> > 
> >>hi gary,
> >>
> >>imo the table Panel_Test_Table is a link table to
> >>connect rows in Test_table, is 
> >>that correct ?
> >>
> >>>Yes
> >>
> >>Test_table
> >>test_key / category
> >>
> >>55 / PA
> >>10 / TE
> >>15 / TE
> >>66 / PA
> >>
> >>Panel_Test_Table
> >>panel_test_key / panel_key / test_key
> >>
> >>1 / 55 / 10
> >>2 / 55 / 15
> >>3 / 66 / 10
> >>
> >>a test can be connected to multiple panels ?
> >>
> >>>Yes
> >>
> >>is it a m:n relationship between Test_table rows ?
> >>
> >>>Yes, if I understand the question, when the
> > 
> > category >> is "PA"
> > 
> >>what's the meaning of the panel_test_key ?
> >>
> >>>No meaning, just a unique ID for the row.
> >>
> >>jakob
> >>
> >>
> >>Gary wrote:
> >>
> >>
> >>>I have a, for me, complex OJB problem, and am
> >>
> >>looking
> >>
> >>>for pointers.
> >>>
> >>>I have two classes: a Test, and a PanelOfTests. 
> I
> >>>have two tables: Tests_Table, and
> >>
> >>Panel_Test_Table.
> >>
> >>>Here is the pseudocode:
> >>>
> >>>public class Test {
> >>>   int testID;
> >>>   String category; // can be "TE" for test, "PA"
> >>
> >>for
> >>
> >>>panel
> >>>}
> >>>
> >>>public class PanelOfTests extends Test {
> >>>   Collection tests; // a collection of Test
> objects
> >>>}
> >>>
> >>>table Tests_Table
> >>>   test_key, int
> >>>   category, varchar
> >>>
> >>>table Panel_Test_Table
> >>>   panel_test_key, int
> >>>   panel_key, int
> >>>   test_key, int
> >>>
> >>>A PanelOfTests then is in fact a Test, one that
> >>
> >>has a
> >>
> >>>category of "PA," and which contains 1-n other
> >>
> >>Tests. 
> >>
> >>>To find the tests that a given panel (say, 55)
> >>>contains I get all the rows in Panel_Test_Table
> >>
> >>where
> >>
> >>>panel_key = 55 and instantiate a Test object for
> >>
> >>each
> >>
> >>>of the test_keys.
> >>>
> >>>Any good ideas on how to do this in OJB
> >>
> >>metadata/row
> >>
> >>>readers/?  I am unable to change the database
> >>
> >>layout.
> >>
> >>>Thanks, Gary
> >>>
> >>>__
> >>>Do you Yahoo!?
> >>>Yahoo! Mail - More reliable, more storage, less
> >>
> >>spam
> >>
> >>>http://mail.yahoo.com
> >>>
> >>>
> >>
> >
>
-
> > 
> >>>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]
> >>
> > 
> > 
> > 
> > __
> 
=== message truncated ===


__
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: soft-deleting objects

2004-03-24 Thread Charles N. Harvey III
Extend Criteria with a MyCriteria.

public class MyCriteria extends Criteria
{
   public MyCriteria()
   {
   addDeletedEqualTo( true );
   }
   public addDeletedEqualTo( boolean bValue )
   {
   this.addEqualTo( "deleted", bValue );
   }
}
Works for me.  I usually create a Criteria object for each OJB Object that
I have.  I add a bunch of convenience methods to add values to the criteria.
Charlie

Tino Schöllhorn wrote:

Hallo Daniel,

that sound great. But still I do have one question: how could you then 
load all non-deleted object *without* using the deleted-flag. I mean 
something like

Criteria crit = new Criteria();
// I can use any criteria here but I don't want to have to use "deleted"

Query q = QueryFactory.newQuery(MyClass, myCriteria);

Collection objects = pb.getCollectionByQuery(q);

// the result are all Objects which have the deleted-flag == false

Any suggestions?

regards
Tino
Daniel Perry wrote:

I am using this in a complex app (due to idiot admin users deleting 
stuff
they shouldnt!).  All objects have a boolean (mapped to int) 
"deleted".  For
all queries i look for objects with deleted=false.  For relationships, i
wrote a querycustomizer which adds deleted=false to collections. (see 
below
example)

It;s very simple and works a treat!

If you have a 'base' bean, which all other beans inherit, you can put 
the
'deleted' attribute there, and can use a delete method for deleting any
beans! (note: i dont use extents for this in the repository, just map 
it for
all beans)


element-class-ref="com.netcase.pdp.bo.JobSubFamily" proxy="true">


class="com.netcase.pdp.ojb.NestedElementCustomQuery">

attribute-value="deleted"/>




-Original Message-
From: Brian McCallister [mailto:[EMAIL PROTECTED]
Sent: 23 March 2004 14:01
To: OJB Users List
Subject: Re: soft-deleting objects
If you have a "deleted" style flag in the database for the soft delete
you can probably accomplish this via a query customizer. If you mean to
not flag the delete in the database at all, but only treat it as such
in the application -- that is a bit trickier, but can probably be done
via pb callbacks/row readers.
-Brian

On Mar 23, 2004, at 6:21 AM, Tino Schöllhorn wrote:


Hi,

I want to implement something like a soft-delete:

Objects should be marked as "deleted" in its corresponing table and
OJB should just ignore them when it is materializing or querying them.
Where would be the best point to start when I want to implement this
feature? I just played around with the RowReader-Concept - but I have
the feeling that this is not the right place to start, because I think
I have to modify the queries OJB is submitting to the database.
Any ideas?

Regards
Tino


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


Re: soft-deleting objects

2004-03-24 Thread Tino Schöllhorn
Hallo Daniel,

that sound great. But still I do have one question: how could you then 
load all non-deleted object *without* using the deleted-flag. I mean 
something like

Criteria crit = new Criteria();
// I can use any criteria here but I don't want to have to use "deleted"

Query q = QueryFactory.newQuery(MyClass, myCriteria);

Collection objects = pb.getCollectionByQuery(q);

// the result are all Objects which have the deleted-flag == false

Any suggestions?

regards
Tino
Daniel Perry wrote:
I am using this in a complex app (due to idiot admin users deleting stuff
they shouldnt!).  All objects have a boolean (mapped to int) "deleted".  For
all queries i look for objects with deleted=false.  For relationships, i
wrote a querycustomizer which adds deleted=false to collections. (see below
example)
It;s very simple and works a treat!

If you have a 'base' bean, which all other beans inherit, you can put the
'deleted' attribute there, and can use a delete method for deleting any
beans! (note: i dont use extents for this in the repository, just map it for
all beans)







-Original Message-
From: Brian McCallister [mailto:[EMAIL PROTECTED]
Sent: 23 March 2004 14:01
To: OJB Users List
Subject: Re: soft-deleting objects
If you have a "deleted" style flag in the database for the soft delete
you can probably accomplish this via a query customizer. If you mean to
not flag the delete in the database at all, but only treat it as such
in the application -- that is a bit trickier, but can probably be done
via pb callbacks/row readers.
-Brian

On Mar 23, 2004, at 6:21 AM, Tino Schöllhorn wrote:


Hi,

I want to implement something like a soft-delete:

Objects should be marked as "deleted" in its corresponing table and
OJB should just ignore them when it is materializing or querying them.
Where would be the best point to start when I want to implement this
feature? I just played around with the RowReader-Concept - but I have
the feeling that this is not the right place to start, because I think
I have to modify the queries OJB is submitting to the database.
Any ideas?

Regards
Tino


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


Rechtekonzept

2004-03-24 Thread Tino Schöllhorn
Hallo,

ich habe mal versucht, das Rechtekonzept nochmal zusammenzufassen. Wäre 
gut, wenn ihr Euch es mal anschauen würdet.

Ihr findet es im Projekt "1.Release" im Intranet unter dem Order "Konzepte".

Gruss
Tino


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: OJB with Spring

2004-03-24 Thread Angus Berry
I was wondering what you don't like about Hibernate? I have a couple of
OJB projects, but hear a lot of talk about Hibernate. Someone close to
Hibernate said that their caching was better.

I don't plan on switch anything, but I'd appreciate any insight from
folks who know both products.

On Wed, 2004-03-24 at 08:00, Robert S. Sfeir wrote:
> Has anyone successfully implemented OJB with the Spring framework, and 
> can you tell me if you found that experience excruciatingly painful, 
> easy, or what ever, and if found the results satisfactory?
> 
> I am considering a switch to Spring, but Hibernate is of no interest to 
> me, and I would much rather not make the switch without OJB.
> 
> Thanks
> R
> 
> -
> 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]



Re: OJB with Spring

2004-03-24 Thread Brian McCallister
I have played with OJB and Spring a couple times, but never for a major 
app.

Using OJB in Spring is no problem. If you want to use Spring's unified 
transaction system, OJB does not presently have hooks directly into it. 
I have talked (over a couple beers) with Thomas Risberg, who wrote most 
of the JDBC DAO stuff in Spring, about providing an OJB template 
(whatever that is) for Spring and the other hooks to make it more 
seemless and IoC'd -- just have never had sufficient itch to really do 
it. Juergen has indicated that adding OJB support into Spring's distro 
would be great, so there is nothing blocking a level of integration 
like what iBatis, Hibernate, etc have -- just no one has felt like 
doing it yet.

If you want to do integrate it more transparently into Spring I will 
happily contribute to that effort, though I don't have the time 
required to really spearhead the task right now. I expect that I will 
get a lot of nudges next Tuesday when I present (with Thomas Risberg) 
on OJB and Spring at a JUG meeting though.

-Brian

On Mar 24, 2004, at 8:00 AM, Robert S. Sfeir wrote:

Has anyone successfully implemented OJB with the Spring framework, and 
can you tell me if you found that experience excruciatingly painful, 
easy, or what ever, and if found the results satisfactory?

I am considering a switch to Spring, but Hibernate is of no interest 
to me, and I would much rather not make the switch without OJB.

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


Re: Problem in PersistenceBrokerImpl

2004-03-24 Thread Edson Carlos Ericksson Richter
Ops, I'm sorry. I think I'm overcharged :-( ... The problem occur when
storing.
I have no stack trace at all to send to you in this moment.

When I recompile OJB, I'll send it to you (if it occur).

Thanks by your attention.

Edson Richter



- Original Message - 
From: Armin Waibel
To: OJB Users List
Sent: Wednesday, March 24, 2004 9:36 AM
Subject: Re: Problem in PersistenceBrokerImpl


Edson Carlos Ericksson Richter wrote:

> I had not so much time to investigate: I fixed because I need to upgrade
> to 1.0.0 ASAP (due to other fixes).
>

ok, no problem. Could you send me the stack trace?

> I'll double check the stack trace because the problems is occurring when
> querying, not storing neither deleting.
>

hmm querying, that's strange again. The query methods never use
getCollectionIterator method.

regards,
Armin

> Best regards,
>
> Edson Richter
>
>
>
> -
> 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]


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.637 / Virus Database: 408 - Release Date: 20/3/2004


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



OJB with Spring

2004-03-24 Thread Robert S. Sfeir
Has anyone successfully implemented OJB with the Spring framework, and 
can you tell me if you found that experience excruciatingly painful, 
easy, or what ever, and if found the results satisfactory?

I am considering a switch to Spring, but Hibernate is of no interest to 
me, and I would much rather not make the switch without OJB.

Thanks
R
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Building OJB using maven

2004-03-24 Thread Leandro Rodrigo Saad Cruz
You have to download this dependencies manually.
OBS: AFAIK, the maven build is not supported. Use ant.

On Wed, 2004-03-24 at 08:09, [EMAIL PROTECTED] wrote:
> With OJB 1.0.rc5, in the maven's project.xml file, the following
> dependencies can't be found, even trying other site like www.ibiblio.org :
> 
>   ejb
>   1.0
>   ejb.jar
>   http://java.sun.com/j2ee/
>   
> 
> 
> 
>   jdo
>   1_0-fcs
>   http://java.sun.com/products/jdo/
>   
> 
> 
> 
>   jdo
>   jdori
>   1_0-fcs
>   http://java.sun.com/products/jdo/
>   
> 
> 
> 
>   jta
>   1.0.1
>   http://java.sun.com/products/jta/
>   
> 
> 
> 
>   p6spy
>   1.0
>   http://www.p6spy.com/
>   
> 
> 
> 
>   xalan
>   2.4
>   http://xml.apache.org/xalan-j/
> 
> 
> So, the process ends unsuccesfull ; could you tell me a right way to build
> OJB with maven ?
> 
> 
> 
> 
> 
> #
> Ce courrier et les documents qui y sont joints peuvent contenir des informations 
> confidentielles.
>  Au cas ou vous n'en seriez pas le bon destinataire, vous etes prie de le detruire 
> et de nous en
>  informer immediatement.
> 
> This email and any attached documents may contain confidential information. If you 
> are not the 
> correct addressee, please advise us immediately and delete it.
> #
> 
> 
> 
> ...
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
-- 
Leandro Rodrigo Saad Cruz
InterBusiness Tecnologia e Serviços
IB- www.ibnetwork.com.br
DB- www.digitalbrand.com.br
OJB   - db.apache.org/ojb
XINGU - xingu.sf.net


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Building OJB using maven

2004-03-24 Thread Joe Germuska
At 12:09 PM +0100 3/24/04, [EMAIL PROTECTED] wrote:
With OJB 1.0.rc5, in the maven's project.xml file, the following
dependencies can't be found, even trying other site like www.ibiblio.org :
Those are all JARs which have licenses which forbid them from being 
distributed from www.ibiblio.org.  You'll have to download each one 
and place it in your local Maven repository (on UNIX systems, this 
defaults to ~/.maven/repository/; on Windows, it's in the equivalent 
"home" directory)

In the "repository" folder, make one directory for each "groupId" -- 
in cases where there is no "groupId" but only an "id", make a 
directory with that name.  Then in each of those directories, make a 
jars directory.  A UNIX example:

cd ~/.maven/repository
mkdir -p ejb/jars
mkdir -p jdo/jars
mkdir -p jta/jars
and so on
Then, copy each of the downloaded jars into the corresponding 
directory.  You may also need to rename the JAR in the form 
{artifactId}-{version}.jar, except in the case of "ejb" where the 
dependency overrides the naming convention.

This part is a little tricky the first time, but you only have to do 
it once, and it becomes pretty natural.

Joe



  ejb
  1.0
  ejb.jar
  http://java.sun.com/j2ee/
  


  jdo
  1_0-fcs
  http://java.sun.com/products/jdo/
  


  jdo
  jdori
  1_0-fcs
  http://java.sun.com/products/jdo/
  


  jta
  1.0.1
  http://java.sun.com/products/jta/
  


  p6spy
  1.0
  http://www.p6spy.com/
  


  xalan
  2.4
  http://xml.apache.org/xalan-j/

So, the process ends unsuccesfull ; could you tell me a right way to build
OJB with maven ?




#
Ce courrier et les documents qui y sont joints peuvent contenir des 
informations confidentielles.
 Au cas ou vous n'en seriez pas le bon destinataire, vous etes prie 
de le detruire et de nous en
 informer immediatement.

This email and any attached documents may contain confidential 
information. If you are not the
correct addressee, please advise us immediately and delete it.
#



...

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
Joe Germuska
[EMAIL PROTECTED]  
http://blog.germuska.com
  "Imagine if every Thursday your shoes exploded if you tied them 
the usual way.  This happens to us all the time with computers, and 
nobody thinks of complaining."
-- Jef Raskin

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Problem in PersistenceBrokerImpl

2004-03-24 Thread Armin Waibel
Edson Carlos Ericksson Richter wrote:

I had not so much time to investigate: I fixed because I need to upgrade
to 1.0.0 ASAP (due to other fixes).
ok, no problem. Could you send me the stack trace?

I'll double check the stack trace because the problems is occurring when
querying, not storing neither deleting.
hmm querying, that's strange again. The query methods never use 
getCollectionIterator method.

regards,
Armin
Best regards,

Edson Richter



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


Re: Problem in PersistenceBrokerImpl

2004-03-24 Thread Edson Carlos Ericksson Richter
I had not so much time to investigate: I fixed because I need to upgrade
to 1.0.0 ASAP (due to other fixes).

I'll double check the stack trace because the problems is occurring when
querying, not storing neither deleting.

Best regards,

Edson Richter



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Building OJB using maven

2004-03-24 Thread alain . perry
With OJB 1.0.rc5, in the maven's project.xml file, the following
dependencies can't be found, even trying other site like www.ibiblio.org :

  ejb
  1.0
  ejb.jar
  http://java.sun.com/j2ee/
  



  jdo
  1_0-fcs
  http://java.sun.com/products/jdo/
  



  jdo
  jdori
  1_0-fcs
  http://java.sun.com/products/jdo/
  



  jta
  1.0.1
  http://java.sun.com/products/jta/
  



  p6spy
  1.0
  http://www.p6spy.com/
  



  xalan
  2.4
  http://xml.apache.org/xalan-j/


So, the process ends unsuccesfull ; could you tell me a right way to build
OJB with maven ?





#
Ce courrier et les documents qui y sont joints peuvent contenir des informations 
confidentielles.
 Au cas ou vous n'en seriez pas le bon destinataire, vous etes prie de le detruire et 
de nous en
 informer immediatement.

This email and any attached documents may contain confidential information. If you are 
not the 
correct addressee, please advise us immediately and delete it.
#



...


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



PersistenceBrokerImpl and Proxies

2004-03-24 Thread Chris Lewington
Hi all,

I have a problem with the following scenario:

Suppose I have a class A which contains a collections of Bs, but the
element class of this Collection is declared to be a user-defined Proxy
type (in other words, the class descriptor for B has a user-defined
proxy specified for it). Also suppose the relation between As and Bs is
m:n. Thus when retrieving an instance of A, I also get with it an
associated Collection of proxies to the Bs.

Assuming use of the PB (ie auto-update defaults to 'false') I now change
something in the A instance (does not matter what), then call pb.store
on A to register the change. Looking at the code the 'store()' method
correctly checks for a top-level Proxy - however when we get to the
'storeCollections' method, and then the call to 'storeCollectionObject'
there is NO check for a Proxy in the 'storeCollectionObject' method.
This is caught in the top-level 'store' method *but only* if auto-update
is set to 'true' - otherwise the method drops out and proceeds to the
'storeMtoNImplementor' call, which first attempts to find a Proxy class
descriptor and then throws a ClassNotPersistenceCapableException.

Have I read the code correctly here? Has anyone else experienced this?
This has cropped up with our application on OJB 0.9.7, but I have
checked the rc5 code and the relevant parts look pretty much the same.

Comments welcome.

Cheers,

Chris


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]