RE: Thoughts on OJB licensing

2003-12-11 Thread Robert J Celestino
Hello All, 

As promised, here is the follow-up as explained to me by our Lawyers. 

According to our lawyers, the problem with the license is in the "Reciprocity" section 
(section 5) in regard to patents. Here is an example (paraphrased by me): 

- - - - - - - - - - - - - - - - - - - - -
Suppose that company x contributed some code to the Apache project we want to use (OJB 
in this case). 

Later company x comes out with a product completely unrelated to OJB that infringes 
one of [our] patents. [we] cannot bring a lawsuit against company x to protect our 
patent without losing the right to use OJB (since company x contributed to it) 
- - - - - - - - - - - - - - - - - - - - -

So in this example we would be left with a choice: 
1 - protect our patent and give up the right to use OJB. 
Or 
2 - continue to use OJB but do nothing to protect the patent. 

Reading over that section (on Reciprocity) I can see the point. Basically Our lawyers 
are saying that we (as a company) have great value in our patents, and cannot take the 
risk. Btw the Mozilla Public License poses a similar risk. 

The really bad news is that this applies to both source and binary distributions. 

Here is another example:
http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgNo=35

And put another way ... 
http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgNo=18

And here is the discussion list: 
http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&by=thread


I do not mean to imply that the license is bad in anyway. However, this is bad news 
for *me*! 


Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know


-Original Message-
From: Thomas Mahler [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 11, 2003 1:59 AM
To: OJB Users List
Subject: Re: Thoughts on OJB licensing


Hi Bob,

The ASF Licence, being based on the BSD license, is one of the most 
liberal license available in the open source arena.

It's one of the declared aims of the ASF to allow any usage that does 
not violate copyrights even in commercial projects.

So your company could even take OJB, add some bells and whistles and 
give it another label and sell it under a different brand as commercial 
product. As long as you maintain the authorship notice in all files. (That's what IBM 
is doing with Apache HTTP and Tomcat)

I firmly believe that future versions of the ASF License will continue 
this liberal style. Otherwise it won't make sense for big companies to 
contribute their manpower into the Apache projects.

I've no idea what your lawyers are talking about. They should give us 
some more details...

cheers,
Thomas

Robert J Celestino wrote:
> Hello All,
> 
> I was wondering what everyone's thoughts were on the licensing of OJB. 
> I would very much like to incorporate OJB into our next project, a comercial 
> project. However the legal department is balking at the proposed changes to the 
> Apache License. Their position is that the current Apache license is acceptable, but 
> *proposed* changes are not.
> 
> I am not a lawyer (much to my Dad's dismay) but I am wondering what 
> everyone out there is doing.
> 
> Thanks
> Bob c
> 
> 
> Bob Celestino
> SAS Research and Development
> 919 - 531 - 9425
> [EMAIL PROTECTED]
> 
> SAS - The Power to Know
> 
> -
> 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: Thoughts on OJB licensing

2003-12-10 Thread Robert J Celestino
Maybe I should not say unacceptable ... The license "is what it is". 

The legal department is saying that "...if the proposed modification goes through, we 
may no longer be able to use Apache code in our products."

So I do not mean to imply that there is a problem with the license, just that the 
proposed changes mean that we (and possibly others) will not be able to use OBJ and 
other Apache software in commercial products. 

I will get more info from the legal folks and let you know the details of WHY the 
proposed license is problematic for us.  


Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know


-Original Message-
From: Brian McCallister [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 10, 2003 4:53 PM
To: OJB Users List
Subject: Re: Thoughts on OJB licensing


Are they willing to provide feedback to the ASF as to why it is 
unacceptable? If they found a real problem we should know about it!

-Brian

On Dec 10, 2003, at 4:42 PM, Robert J Celestino wrote:

> Proposed:
>   license itself:
> http://www.apache.org/licenses/proposed/LICENSE-2.0.txt
>   General info: http://www.apache.org/licenses/proposed/
>
> Current
>   license itself: http://www.apache.org/licenses/LICENSE
>   General info: http://www.apache.org/licenses/
>
> 
> Bob Celestino
> SAS Research and Development
> 919 - 531 - 9425
> [EMAIL PROTECTED]
>
> SAS - The Power to Know
>
>
> -Original Message-
> From: Lance Eason [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 10, 2003 4:39 PM
> To: OJB Users List
> Subject: RE: Thoughts on OJB licensing
>
>
> Urh, that sounds alarming.  What are the proposed changes to the
> Apache license?  Do you have a link?
>
> -Original Message-
> From: Robert J Celestino [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 10, 2003 3:37 PM
> To: OJB Users List
> Subject: Thoughts on OJB licensing
>
>
> Hello All,
>
> I was wondering what everyone's thoughts were on the licensing of OJB.
> I would very much like to incorporate OJB into our next project, a 
> comercial project. However the legal department is balking at the 
> proposed changes to the Apache License. Their position is that the 
> current Apache license is acceptable, but *proposed* changes are not.
>
> I am not a lawyer (much to my Dad's dismay) but I am wondering what
> everyone out there is doing.
>
> Thanks
> Bob c
>
> 
> Bob Celestino
> SAS Research and Development
> 919 - 531 - 9425
> [EMAIL PROTECTED]
>
> SAS - The Power to Know
>
> -
> 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]


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



RE: Thoughts on OJB licensing

2003-12-10 Thread Robert J Celestino
Proposed: 
license itself: http://www.apache.org/licenses/proposed/LICENSE-2.0.txt
General info: http://www.apache.org/licenses/proposed/

Current
license itself: http://www.apache.org/licenses/LICENSE
General info: http://www.apache.org/licenses/


Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know


-Original Message-
From: Lance Eason [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 10, 2003 4:39 PM
To: OJB Users List
Subject: RE: Thoughts on OJB licensing


Urh, that sounds alarming.  What are the proposed changes to the Apache license?  Do 
you have a link?

-Original Message-
From: Robert J Celestino [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 10, 2003 3:37 PM
To: OJB Users List
Subject: Thoughts on OJB licensing


Hello All, 

I was wondering what everyone's thoughts were on the licensing of OJB. I would very 
much like to incorporate OJB into our next project, a comercial project. However the 
legal department is balking at the proposed changes to the Apache License. Their 
position is that the current Apache license is acceptable, but *proposed* changes are 
not. 

I am not a lawyer (much to my Dad's dismay) but I am wondering what everyone out there 
is doing. 

Thanks
Bob c


Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know

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



Thoughts on OJB licensing

2003-12-10 Thread Robert J Celestino
Hello All, 

I was wondering what everyone's thoughts were on the licensing of OJB. I would very 
much like to incorporate OJB into our next project, a comercial project. However the 
legal department is balking at the proposed changes to the Apache License. Their 
position is that the current Apache license is acceptable, but *proposed* changes are 
not. 

I am not a lawyer (much to my Dad's dismay) but I am wondering what everyone out there 
is doing. 

Thanks
Bob c


Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know

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



RE: OJB Exception but insert is successful

2003-11-18 Thread Robert J Celestino
You are right, you don't want (or need) to iterate through the collection to 
explicitly store the collection. You also do not want to explicitly set the ids (as in 
your update). 

I think your mapping for ObjectB is wrong. 
- It needs a field descriptor similar to ObjectA like this: 
  > >   > > >   >  >   > > >   > class="com.codaware.ObjectB"
  > >   > > >   > table="ObjectB"
  > >   > > >   > >
  > >   > > >   >  >   > > >   > name="id"
  > >   > > >   > column="id"
  > >   > > >   > jdbc-type="INTEGER"
  > >   > > >   > primarykey="true"
  > >   > > >   > autoincrement="true"
  > >   > > >   > />

ObjectA has a reference descriptor to ObjectB using field "id", but ObjectB does not 
have a field named "id". So I guess that is why you lost the relation between the two. 
I think that only the first objectB got written because it just happened to have an ID 
of "0".

So use this code: 
  > tx.begin() ;   
  > // 4. acquire write lock on new object
  > tx.lock( o, Transaction.WRITE ) ;
  > tx.commit() ;

And get the mapping right. OJB will do the rest


Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know


  > -Original Message-
  > From: Sukesh Garg [mailto:[EMAIL PROTECTED] 
  > Sent: Tuesday, November 18, 2003 6:43 PM
  > To: OJB Users List
  > Subject: RE: OJB Exception but insert is successful
  > 
  > 
  > Dear Bob,
  > 
  > Thanks for the reply.
  > 
  > Object MainObject{
  >   Collection ObjectACollection;
  > }
  > 
  > Object A{
  >   int id;
  >   ObjectB objectB;
  > }
  > 
  > ObjectB{
  >   int id;
  > }
  > I started with :-
  > 
  > tx.begin() ;   
  > // 4. acquire write lock on new object
  > tx.lock( o, Transaction.WRITE ) ;
  > tx.commit() ; 
  > 
  > Effects: MainObject, ObjectA got  written but only one 
  > ObjectB (belonging to the first element of the collection) 
  > got written. The Pk field of ObjectB was 0.
  > 
  > So i changed it to 
  > 
  > tx.begin() ;   
  > // 4. acquire write lock on new object
  > tx.lock( o, Transaction.WRITE ) ;
  > o.update();
  > tx.commit() ;
  > 
  > 
  > Here the update function explicitly does ObjectB.id = 
  > ObjectA.id. Still the update function only writes only one 
  > ObjectB belonging to the first element of the collection) 
  > got written but the pk is correct.
  > 
  > Now what i have is a hacked solution..
  > 
  > 
  >     tx.begin() ;   
  > // 4. acquire write lock on new object
  > tx.lock( o, Transaction.WRITE ) ;
  > o.update();
  > tx.commit() ;
  > 
  > tx.begin();
  >  o.add(tx);
  > tx.commit() ;
  > 
  > 
  > o.add(tx).. explicitly iterates through the collection and 
  > writes each one of them.
  > 
  > I wished I had a better solution.
  > 
  > thanks,
  > Sukesh
  >  
  > 
  > On Tue, 2003-11-18 at 12:52, Robert J Celestino wrote:
  > > Hello sukesh,
  > > 
  > > I suspect that you are doing this:
  > > 
  > >   // write object "o"
  > >   tx.begin() ;   
  > >   // 4. acquire write lock on new object
  > >   tx.lock( o, Transaction.WRITE ) ;
  > >   tx.commit() ;
  > > 
  > > In which case you can try this: 
  > >   // write object "o"
  > >   tx.begin() ;   
  > >   // 4. acquire write lock on new object
  > >   tx.lock( o, Transaction.WRITE ) ;
  > >   // tell ODMG that it is dirty. 
  > >   Object dirtyInstance = o ;   
  > >   ((TransactionImpl) tx).markDirty(dirtyInstance);
  > >   tx.commit() ;
  > > 
  > > The problem that I ran into with ODMG is that changes to 
  > the object 
  > > must happen within a transaction.  But this drags 
  > persistence code 
  > > into the domain model which I really don't like. To get 
  > around it I 
  > > end up asking ODMG to mark the whole > thing as dirty.
  > > 
  > > This works but I wonder if it imposes a performance 
  > penalty? Anyone?
  > > 
  > > 
  > > 
  > > Bob Celestino
  > > SAS Research and Development
  > > 91

RE: OJB Exception but insert is successful

2003-11-18 Thread Robert J Celestino
Hello sukesh, 

I suspect that you are doing this: 

// write object "o"
tx.begin() ;   
// 4. acquire write lock on new object
tx.lock( o, Transaction.WRITE ) ;
tx.commit() ; 

In which case you can try this: 
// write object "o"
tx.begin() ;   
// 4. acquire write lock on new object
tx.lock( o, Transaction.WRITE ) ;
// tell ODMG that it is dirty. 
Object dirtyInstance = o ;   
((TransactionImpl) tx).markDirty(dirtyInstance);
tx.commit() ; 

The problem that I ran into with ODMG is that changes to the object must happen within 
a transaction. But this drags persistence code into the domain model which I really 
don't like. To get around it I end up asking ODMG to mark the whole thing as dirty. 

This works but I wonder if it imposes a performance penalty? Anyone? 



Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know


  > -Original Message-
  > From: Sukesh Garg [mailto:[EMAIL PROTECTED] 
  > Sent: Tuesday, November 18, 2003 1:38 PM
  > To: OJB Users List
  > Subject: RE: OJB Exception but insert is successful
  > 
  > 
  > Thx Bob.
  > 
  > I set it explicitly to false and it worked.  Thx.
  > 
  > However, another problem came up...
  > 
  > The  Object A is part of a collection. The complete 
  > collection gets committed but only one Object B(referenced 
  > by first ObjectA) gets committed. 
  > 
  > 
  > thx,
  > sukesh
  > 
  > (ps. i also had to set the primary key of ObjectB to that 
  > of Object A
  > explicitly) 
  > 
  > 
  > 
  > 
  > 
  > 
  > 
  > On Tue, 2003-11-18 at 09:48, Sukesh Garg wrote:
  > > I tried doing so but still the same problem. It seems as 
  > if the same 
  > > sql statement is being sent twice.
  > > 
  > > Thanks,
  > > sukesh
  > > 
  > > On Mon, 2003-11-17 at 18:03, Robert J Celestino wrote:
  > > > Hello,
  > > > 
  > > > From your traceback it looks like you are using ODMG. 
  > You must set 
  > > > suto-update="false" when using ODMG. (or delete the line, since 
  > > > false is the default)
  > > > 
  > > > Bob c
  > > > 
  > > > 
  > > > Bob Celestino
  > > > SAS Research and Development
  > > > 919 - 531 - 9425
  > > > [EMAIL PROTECTED]
  > > > 
  > > > SAS - The Power to Know
  > > > 
  > > > 
  > > >   > -Original Message-
  > > >   > From: Sukesh Garg [mailto:[EMAIL PROTECTED] 
  > > >   > Sent: Monday, November 17, 2003 9:01 PM
  > > >   > To: OJB Users List
  > > >   > Subject: OJB Exception but insert is successful
  > > >   > 
  > > >   > 
  > > >   > Hi,
  > > >   > 
  > > >   > I have the following relationship. 
  > > >   > 
  > > >   > ObjectA { 
  > > >   > int  id,  //primary key of A
  > > >   > String name
  > > >   > }
  > > >   > 
  > > >   > ObjectB {
  > > >   >  int objectAid , // primary key with A.id=B.objectAid 
  > > >   >  String address 
  > > >   > }
  > > >   > 
  > > >   > When i perform an insert, i get the enclosed error but the 
  > > >   > insert happens successfully.
  > > >   > 
  > > >   > the dd is..
  > > >   >  > >   > class="com.codaware.ObjectA"
  > > >   > table="ObjectA"
  > > >   > >
  > > >   >  > >   > name="id"
  > > >   > column="id"
  > > >   > jdbc-type="INTEGER"
  > > >   > primarykey="true"
  > > >   > autoincrement="true"
  > > >   > />
  > > >   >   > >   > name="objectB"
  > > >   > class-ref="com.codaware.ObjectB"
  > > >   > auto-update="true"
  > > >   > auto-delete="true"
  > > >   > >
  > > >   > 
  > > >   > 
  > > >   > 
  > > >   >  > >   > class="com.codaware.ObjectB"
  > > >   > table="ObjectB"
  > > >   > >
  > > >   >   

RE: OJB Exception but insert is successful

2003-11-17 Thread Robert J Celestino
Hello, 

>From your traceback it looks like you are using ODMG. You must set 
>suto-update="false" when using ODMG. (or delete the line, since false is the default)

Bob c


Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know


  > -Original Message-
  > From: Sukesh Garg [mailto:[EMAIL PROTECTED] 
  > Sent: Monday, November 17, 2003 9:01 PM
  > To: OJB Users List
  > Subject: OJB Exception but insert is successful
  > 
  > 
  > Hi,
  > 
  > I have the following relationship. 
  > 
  > ObjectA { 
  > int  id,  //primary key of A
  > String name
  > }
  > 
  > ObjectB {
  >  int objectAid , // primary key with A.id=B.objectAid 
  >  String address 
  > }
  > 
  > When i perform an insert, i get the enclosed error but the 
  > insert happens successfully.
  > 
  > the dd is..
  >  class="com.codaware.ObjectA"
  > table="ObjectA"
  > >
  >  name="id"
  > column="id"
  > jdbc-type="INTEGER"
  > primarykey="true"
  > autoincrement="true"
  > />
  >   name="objectB"
  > class-ref="com.codaware.ObjectB"
  > auto-update="true"
  > auto-delete="true"
  > >
  > 
  > 
  > 
  >  class="com.codaware.ObjectB"
  > table="ObjectB"
  > >
  >  name="objectAid"
  > column="objectAid"
  > jdbc-type="BIGINT"
  > primarykey="true"
  > />
  > 
  > 
  > 
  > I would really appreciate it if someone could help on this one.. ..
  > 
  > thanks,
  > sukesh
  > 
  > ps. I need this for an extend relationship. (trying to get 
  > scenario 3)
  > 
  > 
  > 
  > [java] java.sql.SQLException: Invalid argument value,  message from
  > server: "Duplicate entry '321' for key 1"
  > [java] at 
  > com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1626)
  > [java] at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:886)
  > [java] [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] 
  > ERROR: SQLException during the execution of the insert (for a
  > com.codaware.ObjectB): Invalid argument value,  message 
  > from server: "Duplicate entry '321' for key1"  [java] 
  > Invalid argument value, 
  > message from server: "Duplicate entry '321' for key 1"
  > [java] at 
  > com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:945)
  > [java] at 
  > com.mysql.jdbc.Connection.execSQL(Connection.java:1844)
  > [java] [org.apache.ojb.odmg.ObjectEnvelopeTable] ERROR: 
  > Commit on object level failed for tx 
  > [EMAIL PROTECTED]
  > [java] at
  > com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatem
  > ent.java:1602)
  > [java] at
  > com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatem
  > ent.java:1488)
  > [java] at
  > org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeInser
  > t(Unknown Source)
  > [java] at
  > org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(Un
  > known Source)
  >  [java] at
  > org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknow
  > n Source)
  >  [java] at
  > org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknow
  > n Source)
  >  [java] at
  > org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(
  > Unknown Source)
  >  [java] at
  > org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(
  > Unknown Source)
  >  [java] at
  > org.apache.ojb.odmg.states.StateNewDirty.commit(Unknown Sourc
  > e)
  >  [java] at
  > org.apache.ojb.odmg.ObjectEnvelopeTable.commitAllEnvelopes(Un
  > known Source)
  >  [java] at
  > org.apache.ojb.odmg.ObjectEnvelopeTable.commit(Unknown Source
  > )
  >  [java] at
  > org.apache.ojb.odmg.TransactionImpl.doCommitOnObjects(Unknown
  >  Source)
  >  [java] at 
  > org.apache.ojb.odmg.TransactionImpl.prepare(Unknown
  > Source)
  >  [java] at 
  > org.apache.ojb.odmg.TransactionImpl.commit(Unknown
  > Source)
  > 
  > 
  > 
  > 
  > -
  > 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: Which database to use - PostgreSQL or MySQL?

2003-11-17 Thread Robert J Celestino
As far as ease of use with ojb, all are equal. 

So the following is just about preference, but take this with a grain of salt since I 
am, by no means, a database "expert" (could that be why I am using OJB? :-) ).

I have used both postgresql and mysql on real production products. The impression I 
get from most DB types, is that mysql is a "toy database" and postgress is more 
"industrial strength". This may have been true 5 years ago, but I don't think that is 
true anymore.  

I find that mysql has nicer tools. 

Given my experience I would vote for mysql. I find it up to any task I throw at it. 


Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know


  > -Original Message-
  > From: Jewett, Diane C [mailto:[EMAIL PROTECTED] 
  > Sent: Monday, November 17, 2003 3:35 PM
  > To: OJB Users List
  > Subject: Which database to use - PostgreSQL or MySQL?
  > 
  > 
  > What is the best and most reliable open-source database to use?
  > 
  > Is one easier to use with OJB?
  > 
  > 
  > -
  > 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]



ODMG question

2003-11-14 Thread Robert J Celestino
Hello All, 

Trying to get my own example running using ODMG and I feel like I am missing something 
very basic. 

My simple class has 2 simple string attributes (field descriptors), one referenced 
attribute (reference descriptor), and one collection (collection descriptor)

Here is what happens: 

1 - Insert, retrieve, and cascading delete work correctly. 
2 - I read from the DB, change a string attribute and store. The DB is NOT updated. 
3 - I read from the DB, change the reference attribute and store. The DB is NOT 
updated. 
4 - I read from the DB, add an element to the collection and store. The DB *IS* 
updated! 
5 - I read from the DB, delete an element from the collection and store. The DB is NOT 
updated. 

It does not throw any exceptions, it just does not seem to do what I expect. Which is 
basically to update an existing object. 

Now, all of the above scenarios work correctly using the PB. I am currently using the 
PB for all of my "real" work and it works perfectly. But just for my own curiosity, 
and interest, what could I be going wrong here? 

I did make the changes to the repository_user.xml as suggested. 

Note that the changes to the objects that I describe are not happening within the 
transaction lock as shown in the tutorial. For the sake of completeness, I did try 
that as well with the same results. Although I do not know how I would that in a real 
application. 

Thanks again!
Bob c


Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know

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



RE: OJB NPE On Double Table Insert

2003-11-14 Thread Robert J Celestino
Hello Robert, 

Would it work to simply let userLoginBean reference User in the repository_user.xml? 
Then you would simply store the bean, and ojb would do the rest. Example:  

  
  
  

  
  
  
  
 
   
  
  
   


Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know


  > -Original Message-
  > From: Robert S. Sfeir [mailto:[EMAIL PROTECTED] 
  > Sent: Friday, November 14, 2003 7:34 PM
  > To: OJB Users List
  > Subject: OJB NPE On Double Table Insert
  > 
  > 
  > -BEGIN PGP SIGNED MESSAGE-
  > Hash: SHA1
  > 
  > Folks,
  > 
  > I'm trying to do an double insert in 2 tables and for some 
  > reason I'm getting a NullPointerException.  The way I go 
  > about it is below:
  > 
  > //Open transaction
  > tx = getOdmgImpl().newTransaction();
  > 
  > //Transaction begins
  > tx.begin();
  > //Do first Insert
  > tx.lock( user, Transaction.WRITE );
  > //Get User ID after insert and set it in the second Bean 
  > userLoginBean.setUserID( user.getUserID() ); //Do second 
  > insert tx.lock( userLoginBean, Transaction.WRITE ); 
  > //commit tx.commit();
  > 
  > The problem, from my debugging investigation, is that OJB 
  > seems to think that userID is empty, it's not, because as I 
  > was stepping through the debugger, I could see that 
  > userLoginBean.getUserID() returned a correct value, the one 
  > from the first insert.
  > 
  > I do have a catch clause so that if an exception is thrown 
  > it will do
  > tx.abort() but it seems that if I don't catch some 
  > exception, like one I haven't accounted for yet, and an 
  > exception gets thrown, then the first insert is commited 
  > anyway... Is this correct behavior?
  > 
  > Is this the right way of doing a double table insert?
  > 
  > Thanks
  > R
  > -BEGIN PGP SIGNATURE-
  > Version: GnuPG v1.2.3 (MingW32)
  > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
  > 
  > iD8DBQE/tXRp+cV9vuB27SARAhy8AJ42hoS9ip23sLzhLmWbfE+8/obKSQCgrEpl
  > xzk9G4JUM27njZMwn3iVoUs=
  > =aiYd
  > -END PGP SIGNATURE-
  > 
  > 
  > 
  > -
  > 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: PB vs ODMG

2003-11-14 Thread Robert J Celestino
Hello,

I am bit confused about this ... 

1 - using the PB and setting auto-update="true", is the entire object graph stored in 
one transaction? (it was my understanding that it was). 

2 - similarly, using the PB with auto-delete="true" is the delete performed in one 
transaction? 

3 - using ODMG is it ok to set auto-delete="true", so that the entire object graph is 
deleted? When I try it, it works fine, but the docs indicate not to deviate from the 
default settings (which would include auto-delete="false") when using ODMG.

Thanks
Bob c



Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know


  > -Original Message-
  > From: Mahler Thomas [mailto:[EMAIL PROTECTED] 
  > Sent: Friday, November 14, 2003 7:18 AM
  > To: 'OJB Users List'
  > Subject: RE: PB vs ODMG
  > 
  > 
  > Hi Gary,
  > 
  > > Is there information available as to why one must not
  > > use auto-update with ODMG?
  > 
  > The difference between PB/ODMG regarding auto-update is 
  > documented here: 
  > http://db.apache.org/ojb/tutorial3.html#setting%20load-,%20u
  > pdate-%20and%20d
  > elete-cascading
  > 
  > The reason for this is simple.
  > ODMG provides transparent persistence for complete Objects 
  > graphs. If an Object A is locked by an ODMG transaction, 
  > all associated objects get also registered into the transaction.
  > 
  > If a change to such an associated objects happens within 
  > the transaction, the ODMG transaction mager is responsible 
  > to detect it and to perform the appropriate PB calls to make the.
  > 
  > If you set auto-update to true the PB performs store 
  > operations for all elements of an 1:n association on 
  > storing the 1-side instance.
  > 
  > So if you use ODMG *and* auto-update="true" persistence 
  > operations like inserts and updates will be performed 
  > twice. In case of inserts this may lead to primary key violations.
  > 
  > cheers,
  > thomas
  > 
  > 
  > 
  > 
  > > Thanks, Gary
  > > 
  > > --- Robert J Celestino <[EMAIL PROTECTED]>
  > > wrote:
  > > > Thomas,
  > > > 
  > > > Thanks very much. I am very happy with the PB api,
  > > > and prefer the query style so I will be happy to
  > > > stick with PB. Until I switch to JDO :-)
  > > > 
  > > > You were right about the "auto-update" as well.
  > > > 
  > > > Thanks!
  > > > Bob c
  > > > 
  > > >
  > > 
  > > > Bob Celestino
  > > > SAS Research and Development
  > > > 919 - 531 - 9425
  > > > [EMAIL PROTECTED]
  > > > 
  > > > SAS - The Power to Know
  > > > 
  > > > 
  > > >   > -Original Message-
  > > >   > From: Mahler Thomas
  > > > [mailto:[EMAIL PROTECTED] 
  > > >   > Sent: Thursday, November 13, 2003 4:05 AM
  > > >   > To: 'OJB Users List'
  > > >   > Subject: RE: PB vs ODMG
  > > >   > 
  > > >   > 
  > > >   > Hi Roberto,
  > > >   > 
  > > >   > > Hello,
  > > >   > > 
  > > >   > > My understanding that the ODMG API is
  > > > preferred over the
  > > >   > > PersistenceBroker in production. 
  > > >   > 
  > > >   > The PB API is quite mature and it's absolutely
  > > > fine to use 
  > > >   > it in production. The ODMG API is build on top
  > > > of PB. So 
  > > >   > how could the ODMG API be "better" for
  > > > production?
  > > >   > 
  > > >   > It really depends on your API requirements if
  > > > you chosse 
  > > >   > PB, ODMG, OTM or JDO as your API. If you feel
  > > > fine with the 
  > > >   > PB API there is no reason not to use it in
  > > > production.
  > > >   > 
  > > >   > > To that end I have been
  > > >   > > converting a fair amount of code (that is
  > > > currently working 
  > > >   > > using the PersistenceBroker API) to the ODMG
  > > > API. 
  > > >   > > 
  > > >   > > The code works perfectly using the PB API. So
  > > > I assume that
  > > >   > > the mappings and configurations are correct. 
  > > >   > 
  > > >   > There are some subtle differences 

RE: PB vs ODMG

2003-11-13 Thread Robert J Celestino
Thomas, 

Thanks very much. I am very happy with the PB api, and prefer the query style so I 
will be happy to stick with PB. Until I switch to JDO :-) 

You were right about the "auto-update" as well. 

Thanks!
Bob c


Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know


  > -Original Message-
  > From: Mahler Thomas [mailto:[EMAIL PROTECTED] 
  > Sent: Thursday, November 13, 2003 4:05 AM
  > To: 'OJB Users List'
  > Subject: RE: PB vs ODMG
  > 
  > 
  > Hi Roberto,
  > 
  > > Hello,
  > > 
  > > My understanding that the ODMG API is preferred over the
  > > PersistenceBroker in production. 
  > 
  > The PB API is quite mature and it's absolutely fine to use 
  > it in production. The ODMG API is build on top of PB. So 
  > how could the ODMG API be "better" for production?
  > 
  > It really depends on your API requirements if you chosse 
  > PB, ODMG, OTM or JDO as your API. If you feel fine with the 
  > PB API there is no reason not to use it in production.
  > 
  > > To that end I have been
  > > converting a fair amount of code (that is currently working 
  > > using the PersistenceBroker API) to the ODMG API. 
  > > 
  > > The code works perfectly using the PB API. So I assume that
  > > the mappings and configurations are correct. 
  > 
  > There are some subtle differences in the mapping of 
  > Reference and collection descriptors. You must not use 
  > auto-update="true" in an ODMG based app!
  > 
  > > 
  > > The simplest case that I can describe is this:
  > > 
  > > 
  > >   omdg = OJB.getInstance() ; 
  > >   db = _omdg.newDatabase() ; 
  > >   db.open( "default", Database.OPEN_READ_WRITE);
  > >   Transaction tx = omdg.newTransaction() ; 
  > >   Person person = new Person() ; // creates default with
  > > default addr, etc
  > >   tx.begin() ; 
  > >   tx.lock( person, Transaction.WRITE ) ; 
  > >   tx.commit() ; < throws SQL Exception
  > > 
  > > The exception that is thrown is "duplicate entry for key"
  > > (note the table is empty) 
  > > 
  > > I did write my own SequenceManger. But it works flawlessly
  > > using the PB API. 
  > > 
  > > The corresponding code (that works) is here: 
  > >   // include the user and password here: 
  > >   PBKey pbKey = new PBKey( "default" ) ; 
  > >   broker =
  > > PersistenceBrokerFactory.createPersistenceBroker(pbKey);
  > >   // 1. open transaction
  > >   broker.beginTransaction();
  > >   // 2. make the new object persistent
  > >   broker.store( person ) ; 
  > >   broker.commitTransaction();
  > >   
  > > More information:
  > > If I comment out the reference-descriptor and 
  > > collection-descriptor in the repository_user.xml the store 
  > > works (but of course I get no relationships). However the 
  > > update does not work. If I change the name of the person and 
  > > store it again the database is not updated. 
  > 
  > try to set auto-update="false" in the reference-descriptor 
  > and collection-descriptor
  > 
  > cheers,
  > Thomas
  > 
  > > 
  > > I must be missing something ...
  > > 
  > > Thanks
  > > Bob c
  > > 
  > > 
  > > Bob Celestino
  > > SAS Research and Development
  > > 919 - 531 - 9425
  > > [EMAIL PROTECTED]
  > > 
  > > SAS - The Power to Know
  > > 
  > > 
  > 
  > -
  > > 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: more build.xml issues

2003-11-13 Thread Robert J Celestino
Hi Gus, 

It looks a variable was not set in the buildfile. It was expecting "archive" to be set 
to something. Easy enough to fix. But I just looked at my "contrib" dir and it is 
empty ... So that's why the tar file that gets built is empty ... 



Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know


  > -Original Message-
  > From: Gus Heck [mailto:[EMAIL PROTECTED] 
  > Sent: Thursday, November 13, 2003 11:11 AM
  > To: OJB Users List
  > Subject: more build.xml issues
  > 
  > 
  > Looks like some dependancy for the contrib target is missing or for 
  > whatever reason the archive property never gets defined. The target 
  > seems to work but the filenames are rather funny looking. 
  > It als seems 
  > to be 10k of nothing. Shell output appended.
  > 
  > -Gus
  > 
  > [EMAIL PROTECTED] db-ojb-1.0.rc4]$ ant contrib
  > Buildfile: build.xml
  > 
  > contrib:
  >   [tar] Building tar: 
  > /home/gus/zip/db-ojb-1.0.rc4/dist/${archive}-contrib.tar
  >  [gzip] Building: 
  > /home/gus/zip/db-ojb-1.0.rc4/dist/${archive}-contrib.tgz
  >[delete] Deleting: 
  > /home/gus/zip/db-ojb-1.0.rc4/dist/${archive}-contrib.tar
  > 
  > BUILD SUCCESSFUL
  > Total time: 1 second
  > [EMAIL PROTECTED] db-ojb-1.0.rc4]$ ls
  > ${archive}-contrib.tgz
  > [EMAIL PROTECTED] dist]$ gunzip \$\{archive\}-contrib.tgz
  > [EMAIL PROTECTED] dist]$ ls
  > ${archive}-contrib.tar
  > [EMAIL PROTECTED] dist]$ ll
  > total 12
  > -rw-rw-r--1 gus  gus 10240 Nov 13 11:04 
  > ${archive}-contrib.tar
  > [EMAIL PROTECTED] dist]$ emacs \$\{archive\}-contrib.tar
  > [EMAIL PROTECTED] dist]$ tar -xvf \$\{archive\}-contrib.tar
  > [EMAIL PROTECTED] dist]$ ls
  > ${archive}-contrib.tar
  > [EMAIL PROTECTED] dist]$
  > 
  > 
  > 
  > -
  > 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]



PB vs ODMG

2003-11-12 Thread Robert J Celestino
Hello, 

My understanding that the ODMG API is preferred over the PersistenceBroker in 
production. To that end I have been converting a fair amount of code (that is 
currently working using the PersistenceBroker API) to the ODMG API. 

The code works perfectly using the PB API. So I assume that the mappings and 
configurations are correct. 

The simplest case that I can describe is this: 


omdg = OJB.getInstance() ; 
db = _omdg.newDatabase() ; 
db.open( "default", Database.OPEN_READ_WRITE);
Transaction tx = omdg.newTransaction() ; 
Person person = new Person() ; // creates default with default addr, etc
tx.begin() ; 
tx.lock( person, Transaction.WRITE ) ; 
tx.commit() ; < throws SQL Exception

The exception that is thrown is "duplicate entry for key" (note the table is empty) 

I did write my own SequenceManger. But it works flawlessly using the PB API. 

The corresponding code (that works) is here: 
// include the user and password here: 
PBKey pbKey = new PBKey( "default" ) ; 
broker = PersistenceBrokerFactory.createPersistenceBroker(pbKey);
// 1. open transaction
broker.beginTransaction();
// 2. make the new object persistent
broker.store( person ) ; 
broker.commitTransaction();

More information: 
If I comment out the reference-descriptor and collection-descriptor in the 
repository_user.xml the store works (but of course I get no relationships). However 
the update does not work. If I change the name of the person and store it again the 
database is not updated. 

I must be missing something ... 

Thanks
Bob c


Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know

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



RE: Mysql4.0?

2003-11-12 Thread Robert J Celestino
Hi Gus, 

I have not run the unit tests in a while .. But I suspect you have a configuraton 
problem .. Can you post your repository_database.xml? 

I hear you about getting burned, but I have been very happy with OJB. The JDO stuff is 
new but the rest seems very solid, and well supported here. I have been using OJB for 
about 2 months now so I am still a newbie, but so far it has been able to do 
everything I need it to do. 

Bob c


Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know


  > -Original Message-
  > From: Gus Heck [mailto:[EMAIL PROTECTED] 
  > Sent: Wednesday, November 12, 2003 10:57 AM
  > To: OJB Users List
  > Subject: Re: Mysql4.0?
  > 
  > 
  > Bob, Thanks for the reply :).
  > 
  > Do you get the same failures with the regression tests? I'm 
  > wondering if 
  > it could have anything to do with my setup... If you
  > 
  > As for JDO I was afraid someone would say that Though I 
  > seem to have 
  > picked yet another emerging technology that looked ready 
  > until I dug 
  > into it. (The last one I tried to play with was RDF/OWL 
  > which featured a 
  > bug a day for a week and a half... and sourceforge wouldn't 
  > let me into 
  > the cvs to get the fixes anyway.). I should probably take 
  > these problems 
  > to bugzilla and see if they have been reported...  or the 
  > dev list I 
  > suppose. Perhaps they are fixed in CVS.
  > 
  > -Gus
  > 
  > Robert J Celestino wrote:
  > 
  > >Hello Gus,
  > >
  > >As far as the newsgroup: its quality not quantity here :-)
  > >
  > >I am using MySql4.0 with OJB. I am using the 
  > PersistenceBroker and ODMG 
  > >APIs with good success. I am waiting until the JDO support 
  > is a little more solid before I switch over to that API.
  > >
  > >Bob c
  > >  
  > >
  > >
  > >Bob Celestino
  > >SAS Research and Development
  > >919 - 531 - 9425
  > >[EMAIL PROTECTED]
  > >
  > >SAS - The Power to Know
  > >
  > >
  > >  > -Original Message-
  > >  > From: Gus Heck [mailto:[EMAIL PROTECTED]
  > >  > Sent: Tuesday, November 11, 2003 2:44 PM
  > >  > To: OJB Users List
  > >  > Subject: Re: Mysql4.0?
  > >  > 
  > >  > 
  > >  > Wow this list is quiet. I'm used to Ant lists that are 
  > >  > 80+message a day 
  > >  > :)
  > >  > 
  > >  > Is anyone out there using MySQL 4.0 with OJB 
  > (particular for JDO) ?
  > >  > 
  > >  > -Gus
  > >  > 
  > >  > Gus Heck wrote:
  > >  > 
  > >  > > Is MySQL 4.0 supported?
  > >  > >
  > >  > > I ran the regression tests against my database 
  > >  > (/usr/sbin/mysqld  Ver 
  > >  > > 4.0.14-standard for pc-linux on i686) and got the following:
  > >  > >
  > >  > > junit-no-compile-no-prepare:
  > >  > >[junit] Running org.apache.ojb.broker.AllTests
  > >  > >[junit] Tests run: 247, Failures: 5, Errors: 2, 
  > Time elapsed:
  > >  > > 41.511 sec
  > >  > >
  > >  > >
  > >  > >[junit] TEST org.apache.ojb.broker.AllTests FAILED
  > >  > >[junit] Running org.apache.ojb.odmg.AllTests
  > >  > >[junit] [BOOT] INFO: OJB.properties: 
  > >  > > 
  > file:/home/gus/zip/db-ojb-1.0.rc4/target/test/ojb/OJB.properties
  > >  > >[junit] Tests run: 160, Failures: 2, Errors: 0, 
  > Time elapsed:
  > >  > > 11.521 sec
  > >  > >
  > >  > >
  > >  > >[junit] TEST org.apache.ojb.odmg.AllTests FAILED
  > >  > >[junit] Running org.apache.ojb.soda.AllTests
  > >  > >[junit] [BOOT] INFO: OJB.properties: 
  > >  > > 
  > file:/home/gus/zip/db-ojb-1.0.rc4/target/test/ojb/OJB.properties
  > >  > >[junit] Tests run: 3, Failures: 0, Errors: 0, Time 
  > >  > elapsed: 2.474 
  > >  > > sec
  > >  > >
  > >  > >
  > >  > >[junit] Running org.apache.ojb.otm.AllTests
  > >  > >[junit] Tests run: 73, Failures: 0, Errors: 0, Time 
  > >  > elapsed: 14.209
  > >  > > sec
  > >  > >
  > >  > > when I tracked down the failing tests they turned out to be:
  > >  > >
  > >  > >  in broker.AllTests:
  > >  > >
  > > 

RE: Mysql4.0?

2003-11-11 Thread Robert J Celestino
Hello Gus, 

As far as the newsgroup: its quality not quantity here :-)

I am using MySql4.0 with OJB. I am using the PersistenceBroker and ODMG APIs with good 
success. I am waiting until the JDO support is a little more solid before I switch 
over to that API. 

Bob c


Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know


  > -Original Message-
  > From: Gus Heck [mailto:[EMAIL PROTECTED] 
  > Sent: Tuesday, November 11, 2003 2:44 PM
  > To: OJB Users List
  > Subject: Re: Mysql4.0?
  > 
  > 
  > Wow this list is quiet. I'm used to Ant lists that are 
  > 80+message a day 
  > :)
  > 
  > Is anyone out there using MySQL 4.0 with OJB (particular for JDO) ?
  > 
  > -Gus
  > 
  > Gus Heck wrote:
  > 
  > > Is MySQL 4.0 supported?
  > >
  > > I ran the regression tests against my database 
  > (/usr/sbin/mysqld  Ver 
  > > 4.0.14-standard for pc-linux on i686) and got the following:
  > >
  > > junit-no-compile-no-prepare:
  > >[junit] Running org.apache.ojb.broker.AllTests
  > >[junit] Tests run: 247, Failures: 5, Errors: 2, Time elapsed:
  > > 41.511 sec
  > >
  > >
  > >[junit] TEST org.apache.ojb.broker.AllTests FAILED
  > >[junit] Running org.apache.ojb.odmg.AllTests
  > >[junit] [BOOT] INFO: OJB.properties: 
  > > file:/home/gus/zip/db-ojb-1.0.rc4/target/test/ojb/OJB.properties
  > >[junit] Tests run: 160, Failures: 2, Errors: 0, Time elapsed:
  > > 11.521 sec
  > >
  > >
  > >[junit] TEST org.apache.ojb.odmg.AllTests FAILED
  > >[junit] Running org.apache.ojb.soda.AllTests
  > >[junit] [BOOT] INFO: OJB.properties: 
  > > file:/home/gus/zip/db-ojb-1.0.rc4/target/test/ojb/OJB.properties
  > >[junit] Tests run: 3, Failures: 0, Errors: 0, Time 
  > elapsed: 2.474 
  > > sec
  > >
  > >
  > >[junit] Running org.apache.ojb.otm.AllTests
  > >[junit] Tests run: 73, Failures: 0, Errors: 0, Time 
  > elapsed: 14.209
  > > sec
  > >
  > > when I tracked down the failing tests they turned out to be:
  > >
  > >  in broker.AllTests:
  > >
  > > Testcase: testSubQuery2 took 0.056 sec
  > >Caused an ERROR
  > > Syntax error or access violation,  message from server: 
  > "You have an 
  > > error in your SQL syntax.  Check the manual that 
  > corresponds to your 
  > > MySQL server version for the right syntax to use near 
  > 'SELECT DISTINCT 
  > > A0.Kategorie_Nr FROM Artikel A0)' at line 1"
  > >
  > > Testcase: testSubQuery2Testcase: testSubQuery1 took 0.018 sec
  > >Caused an ERROR
  > > Syntax error or access violation,  message from server: 
  > "You have an 
  > > error in your SQL syntax.  Check the manual that 
  > corresponds to your 
  > > MySQL server version for the right syntax to use near 'SELECT
  > > avg(A0.Einzelpreis) FROM Artikel A0 WHERE A0.Artikelname"
  > >
  > > Testcase: testReportPathExpressionForExtents2 took 0.005 sec
  > >FAILED
  > > Testcase: testDeleteWithRemovalAwareCollection took 0.018 sec
  > >FAILED
  > > Testcase: testUserRollbackClearCache took 0.299 sec
  > >FAILED
  > > Testcase: testUserRollbackClearCacheTestcase: 
  > testUserRollback took 
  > > 0.198 sec
  > >FAILED
  > > Testcase: testUserRollbackTestcase: testRollback took 0.031 sec
  > >FAILED
  > >
  > >  in odmg.AllTests:
  > >
  > >
  > > Testcase: testStoreThreePersons took 0.017 sec
  > >FAILED
  > > Testcase: testUserRollbackWithCheckpoint took 0.1 sec
  > >FAILED
  > >
  > >
  > > Are these known problems? Are they known to be harmless? 
  > or am I in 
  > > trouble here?
  > >
  > > -Gus
  > >
  > >
  > >
  > > 
  > 
  > -
  > > 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: Still not understanding why getCollectionByQuery() is not getting sub-object.

2003-11-06 Thread Robert J Celestino
John,

I think the proper syntax for nested fields is "::" not "->" 
eg "status::modified" instead of "status->modified"


-Original Message-
From: LAURENT Stephane [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 05, 2003 5:38 AM
To: OJB Users List
Subject: Re: Still not understanding why getCollectionByQuery() is not getting 
sub-object.


Hi,
I'm now in RC4 but never have this kind of pb with RC2.
Just a difference for me, my repository contain this :  Not 
this :  But if 
you can retrieve objects "manually", it's probably not your pb ...

I never seen this syntax before :" -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, November 04, 2003 2:03 PM
> To: OJB Users List
> Subject: Still not understanding why getCollectionByQuery() 
> is not getting sub-object.
> 
> 
> 
> 
> 
> Is anybody aware of anything in RC2 that would prevent 
> getCollectionByQuery() from realizing sub-objects?   I get 
> N records using getCollectionByQuery() successfully, but 
> this OfferVO subobject continues to not show its ugly head 
> unless I manually get each sub-object.
> 
> I have auto-retrieve="true" everywhere.
> 
> I successfully get a different sub-reference on a different 
> non-collection object. My mapping is correct in that manual 
> retieval works.
> 
> I thought sub-objects would be realized with 
> getCollectionByQuery() unlike with getIteratorByQuery().
> 
> 
> I am wondering if it could have something to do with the 
> fact that the Collection of OrderItemVO has 3 primary keys 
> or something to do with the below setting in the 
> OJB.properties I needed to allow for '->' Single Table 
> Aggregation.  '->' was only allowed as far as I know in RC2 
> using this setting.  I don't know if it was implemented in 
> the default setting since.
> 
> PersistentFieldClass=org.apache.ojb.broker.metadata.fieldacc
> ess.PersistentNestedFieldMaxPerformanceImpl
> 
> 
> My repository.xml as it is today for the two important 
> tables follows:
> 
> 
> 
>  
>  class="com.jobbank.jobbank.model.order.OrderItemVO" 
> table="orderitem">
>  name="offerId"
> column="offerid"
> jdbc-type="INTEGER"
> primarykey="true"
> />
>  name="memberId"
> column="mid"
> jdbc-type="INTEGER"
> primarykey="true"
> />
>  name="orderId"
> column="orderid"
> jdbc-type="INTEGER"
> primarykey="true"
> />
>  name="offerQuantity"
> column="offerquantity"
> jdbc-type="INTEGER"
> />
>  name="buyLater"
> column="buylater"
> jdbc-type="INTEGER"
> 
> conversion="org.apache.ojb.broker.accesslayer.conversions.Bo
> olean2IntFieldConversion"
> />
>  name="status->modified"
> column="modified"
> jdbc-type="TIMESTAMP"
> />
>  name="status->added"
> column="added"
> jdbc-type="TIMESTAMP"
> />
>  name="status->disabled"
> column="disabled"
> jdbc-type="INTEGER"
> 
> conversion="org.apache.ojb.broker.accesslayer.conversions.Bo
> olean2IntFieldConversion"
> />
>  name="offer"
> class-ref="com.jobbank.jobbank.model.offer.OfferVO"
> auto-retrieve="true"
> auto-update="false"
> auto-delete="false">
>   
> 
> 
> 
> 
> 
> 
>   class="com.jobbank.jobbank.model.offer.OfferVO" table="offer"
>   auto-retrieve="true" auto-update="false" 
> auto-delete="false">
>  name="offerId"
> column="offerid"
> jdbc-type="INTEGER"
> primarykey="true"
> />
>  name="name"
> column="name"
> jdbc-type="VARCHAR"
> />
>  name="offerPrice"
> column="offerprice"
> jdbc-type="DOUBLE"
> />
>  name="offerStarts"
> column="offerstarts"
> jdbc-type="TIMESTAMP"
> />
>  name="offerEnds"
> column="offerends"
> jdbc-type="TIMESTAMP"
> />
>  name="exposure"
> column="exposure"
> jdbc-type="INTEGER"
> />
>  name="url"
> column="url"
> jdbc-type="VARCHAR"
> />
>  name="description"
> column="description"
> jdbc-type="VARCHAR"
> />
>  name="status->modified"

RE: Still not understanding why getCollectionByQuery() is not getting sub-object.

2003-11-04 Thread Robert J Celestino
Hello John, 

I am stumped too (not that says very much, I am a newbie to OJB). 

Have you tried RC4? 

Bob c

Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know


  > -Original Message-
  > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
  > Sent: Tuesday, November 04, 2003 2:03 PM
  > To: OJB Users List
  > Subject: Still not understanding why getCollectionByQuery() 
  > is not getting sub-object.
  > 
  > 
  > 
  > 
  > 
  > Is anybody aware of anything in RC2 that would prevent 
  > getCollectionByQuery() from realizing sub-objects?   I get 
  > N records using getCollectionByQuery() successfully, but 
  > this OfferVO subobject continues to not show its ugly head 
  > unless I manually get each sub-object.
  > 
  > I have auto-retrieve="true" everywhere.
  > 
  > I successfully get a different sub-reference on a different 
  > non-collection object. My mapping is correct in that manual 
  > retieval works.
  > 
  > I thought sub-objects would be realized with 
  > getCollectionByQuery() unlike with getIteratorByQuery().
  > 
  > 
  > I am wondering if it could have something to do with the 
  > fact that the Collection of OrderItemVO has 3 primary keys 
  > or something to do with the below setting in the 
  > OJB.properties I needed to allow for '->' Single Table 
  > Aggregation.  '->' was only allowed as far as I know in RC2 
  > using this setting.  I don't know if it was implemented in 
  > the default setting since.
  > 
  > PersistentFieldClass=org.apache.ojb.broker.metadata.fieldacc
  > ess.PersistentNestedFieldMaxPerformanceImpl
  > 
  > 
  > My repository.xml as it is today for the two important 
  > tables follows:
  > 
  > 
  > 
  >  
  >  class="com.jobbank.jobbank.model.order.OrderItemVO" 
  > table="orderitem">
  >  name="offerId"
  > column="offerid"
  > jdbc-type="INTEGER"
  > primarykey="true"
  > />
  >  name="memberId"
  > column="mid"
  > jdbc-type="INTEGER"
  > primarykey="true"
  > />
  >  name="orderId"
  > column="orderid"
  > jdbc-type="INTEGER"
  > primarykey="true"
  > />
  >  name="offerQuantity"
  > column="offerquantity"
  > jdbc-type="INTEGER"
  > />
  >  name="buyLater"
  > column="buylater"
  > jdbc-type="INTEGER"
  > 
  > conversion="org.apache.ojb.broker.accesslayer.conversions.Bo
  > olean2IntFieldConversion"
  > />
  >  name="status->modified"
  > column="modified"
  > jdbc-type="TIMESTAMP"
  > />
  >  name="status->added"
  > column="added"
  > jdbc-type="TIMESTAMP"
  > />
  >  name="status->disabled"
  > column="disabled"
  > jdbc-type="INTEGER"
  > 
  > conversion="org.apache.ojb.broker.accesslayer.conversions.Bo
  > olean2IntFieldConversion"
  > />
  >  name="offer"
  > class-ref="com.jobbank.jobbank.model.offer.OfferVO"
  > auto-retrieve="true"
  > auto-update="false"
  > auto-delete="false">
  >   
  > 
  > 
  > 
  > 
  > 
  > 
  >   class="com.jobbank.jobbank.model.offer.OfferVO" table="offer"
  >   auto-retrieve="true" auto-update="false" 
  > auto-delete="false">
  >  name="offerId"
  > column="offerid"
  > jdbc-type="INTEGER"
  > primarykey="true"
  > />
  >  name="name"
  > column="name"
  > jdbc-type="VARCHAR"
  > />
  >  name="offerPrice"
  > column="offerprice"
  > jdbc-type="DOUBLE"
  > />
  >  name="offerStarts"
  > column="offerstarts"
  > jdbc-type="TIMESTAMP"
  > />
  >  name="offerEnds"
  > column="offerends"
  > jdbc-type="TIMESTAMP"
  > />
  >  name="exposure"
  > column="exposure"
  > jdbc-type="INTEGER"
  > />
  >  name="url"
  > column="url"
  > jdbc-type="VARCHAR"
  > />
  >  name="description"
  > column="description"
  > jdbc-type="VARCHAR"
  > />
  >  name="status->modified"
  > column="modified"
  > jdbc-type="TIMESTAMP"
  > />
  >  name="status->added"
  > column="added"
  > jdbc-type="TIMESTAMP"
  > />
  >  name="status->disabled"
  > column="disabled"
  > jdbc-type="INTEGER"
  > 
  > conversion="org.apache.ojb.broker.accesslayer.conversions.Bo
  > olean2IntFieldConversion"
  > />
  >  name="offeredProducts"
  > 
  > element-class-ref="com.jobbank.jobbank.model.offer.OfferedProductVO"
  > proxy="true">
  > 
  > 
  >

Configuring a non-standard connection source

2003-11-04 Thread Robert J Celestino
Hello All, 

First I want to thank the devlopers for an awesome product. Second I want to thank all 
the users on this mailing list for the wonderful advice and help. 

I have a quick question: 
We have an in house technique for obtaining a connection: 

ConnectionInfo ci = new ConnectionInfo() ; 
ci.setJndiName( "MyDataSource" ) ; 
ci.setPooling( true ) ; 
.
.
. 
Connection conn = DataFactory.getConnection( ci ) ; 

I have found (to my delight) that almost everything in OBJ is configurable or 
extendable. Is it posible to have OJB use our DataFactory to obtain connections? If so 
how? 

Thanks again
Bobc


Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know

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



weblogic/mysql authentication

2003-11-04 Thread Robert J Celestino
Hello, 

I have a few questions on authentication: 

I am using MySql 4.x and Weblogic 8.x. 

In the resource_database.xml file I must specify the userid and password to *weblogic* 
rather than to mysql. I would much prefer to use mysql user/passwd. Is there anyway to 
specify the mysql users instead? Do other appserver/database combinations have this 
same quirk? 

Also, Is there any way around putting passords in the clear in the xml file? 

Thanks!
Bob c


Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know

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



RE: mapping many classes to one table

2003-10-31 Thread Robert J Celestino
David, 

I believe that you must write 30 class descriptors all exactly the same except for the 
class name :-( I have not been able to get this sort of scenario to work any other 
way. 

It seems odd, since ojb "should" know the inheritance structure due to the 
extent-class tag. It would be nice if extent classes need only add field-descriptors 
for the attributes that are different.  

Bob c


Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know


  > -Original Message-
  > From: David Corbin [mailto:[EMAIL PROTECTED] 
  > Sent: Friday, October 31, 2003 2:37 PM
  > To: OJB Users List; Jakob Braeuchi
  > Subject: Re: mapping many classes to one table
  > 
  > 
  > On Friday 31 October 2003 14:11, Jakob Braeuchi wrote:
  > > hi david,
  > >
  > 
  > > why don't you use ojbConcreteClass ?
  > 
  > I don't understand.  I fully plan on having something like 
  > this so I can 
  > materialize the correct type object.  That has little (as 
  > far as I can tell) 
  > to do with my problem.  As far as I can tell, unless I write 30 
  > class-descriptors, those objects of that class are believe 
  > to not be 
  > persistable.
  > 
  > 
  > >
  > > David Corbin wrote:
  > > > I have a class heirarchy, and there are 30 different concrete 
  > > > classes in it. There is NO difference in the data, just 
  > in behavior.  
  > > > I'm well aware of how to read these in from a common 
  > table using a 
  > > > RowReader.
  > > >
  > > > Do I have to write 30 class-descriptors all of which 
  > look exactly 
  > > > the same except for the class name?
  > >
  > > yes, if you do not want to copy paste ;)
  > >
  > > jakob
  > >
  > > > Thanks
  > >
  > > 
  > 
  > -
  > > To unsubscribe, e-mail: [EMAIL PROTECTED]
  > > For additional commands, e-mail: [EMAIL PROTECTED]
  > 
  > -- 
  > David Corbin <[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]



Mapping a hashmap?

2003-10-31 Thread Robert J Celestino
Potentially stupid question, but I could not find anything on mapping a 
hashmap/hashtable. Consider this

Item has an ItemPrice. 
ItemPrice contains a HashMap of condition/price pairs. 

So you can do stuff like: 
anItemPrice.getPriceForCondition( "Good" ) 
anItemPrice.getPriceForCondition( "Fair" )

The itemprice table has columns: Id, ItemId, Condition, Price

Prices for item #12 would look like this in the db: 
| 1 | 12 | Excellent | $200 |   
| 2 | 12 | Good  | $150 |   
| 3 | 12 | Fair  | $100 |   
| 4 | 12 | Poor  | $50  |

Any pointers or tips for mapping ItemPrice? Specifially is there a general technique 
for mapping Maps using ojb? 



Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know

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



RE: Another silly newbie mapping question

2003-10-31 Thread Robert J Celestino
Hello John, 

I think you want auto-update="true" instead of "false" here: 

  > > > > >name="offer"
  > > >class-ref="com.jobbank.jobbank.model.offer.OfferVO"
  > > >auto-retrieve="true"
  > > >auto-update="false"
  > > >auto-delete="false">
  > > >  
  > > >

my thinking is that when you store the OrderItem the Offer is not writen bacause 
auto-update is false. Then when reading the OrderItem back out, the Offer is not 
there. 

Bob c



Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know


  > -Original Message-
  > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
  > Sent: Friday, October 31, 2003 5:01 AM
  > To: OJB Users List
  > Subject: Re: Another silly newbie mapping question
  > 
  > 
  > I give up for the night.   BTW I am using Release Candidate 2.
  > 
  > Not sure it matters, but I am using 
  > PersistentFieldClass=org.apache.ojb.broker.metadata.fieldacc
  > ess.PersistentNestedFieldMaxPerformanceImpl so that I could 
  > use '->' Single Table Aggregation as it wasn't implemented 
  > in the default implementation.
  > 
  > From the archives it seemed ok to map multiple primary keys 
  > to one primary key.
  > 
  > 
  > - Original Message -
  > From: [EMAIL PROTECTED]
  > Date: Friday, October 31, 2003 2:49 am
  > Subject: Re: Another silly newbie mapping question
  > 
  > > Still no luck.  I noticed that my primary key order might have
  > > something to do with it so I switched the order within the 
  > > OrderItemVO mapping, but it didn't seem to help.   I 
  > realized that 
  > > based on the logging that OJB does not seem to even be trying to 
  > > materialize the OfferVO object as no notice is printed about it 
  > > trying.   Here is my logging:
  > > 
  > > 
  > > [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG:
  > > executeQuery : Query from class 
  > > com.jobbank.jobbank.model.order.OrderItemVO where 
  > > 
  > [EMAIL PROTECTED]
  > oker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: 
  > SQL:SELECT A0.modified,A0.offerid,A0.disabled,A0.mid,A0.offerq
  > > uantity,A0.orderid,A0.buylater,A0.added FROM orderitem A0 WHERE 
  > > (mid =  ? ) AND orderid =  ?
  > > [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: 
  > > executeQuery: [EMAIL PROTECTED]: SELECT 
  > > 
  > A0.modified,A0.offerid,A0.disabled,A0.mid,A0.offerquantity,A
  > 0.orderid,A0.buylater,A0.added FROM orderitem A0 WHERE (mid 
  > =  2 ) AND orderid =  0
  > > [org.apache.ojb.broker.accesslayer.RsIterator] DEBUG: 
  > hasNext() -> 
  > > true[org.apache.ojb.broker.accesslayer.RsIterator] DEBUG: 
  > > hasNext() -> false
  > > [org.apache.ojb.broker.core.PersistenceBrokerImpl] DEBUG: 
  > PB.close 
  > > was called: [EMAIL PROTECTED]
  > > 8
  > > TEST CartItem: [2|0|1|1|false|[2003-10-31 02:50:11.515|2003-10-31 
  > > 02:50:11.515|false]|]WITH OFFER: null
  > > TEST:  After ShoppingCartActions.populateMemberShoppingCart()
  > > 
  > > 
  > > 
  > > 
  > > 
  > > 
  > > - Original Message -
  > > From: [EMAIL PROTECTED]
  > > Date: Friday, October 31, 2003 1:56 am
  > > Subject: Another silly newbie mapping question
  > > 
  > > > 
  > > > I have worked out much harder mapping problems then this, but
  > > for
  > > > some reason I am still a bit new on this stuff and making no
  > > > headway.  I would appreciate a more seasoned glance.
  > > > 
  > > > Problem:  OfferVO is not being materialized after succesfully
  > > > retrieving the Collection of OrderItemVO by using 
  > > > getCollectionByQuery(query).  Each OrderItemVO should have 
  > > exactly
  > > > one OfferVO, but the reference to the OfferVO only returns null.
  > > > 
  > > > 
  > > > 
  > > >  
  >  > > class="com.jobbank.jobbank.model.order.OrderItemVO" 
  > > table="orderitem">> > >name="memberId"
  > > >column="mid"
  > > >jdbc-type="INTEGER"
  > > >primarykey="true"
  > > >/>
  > > > > >name="orderId"
  > > >column="orderid"
  > > >jdbc-type="INTEGER"
  > > >primarykey="true"
  > > >/>
  > > > > >name="offerId"
  > > >column="offerid"
  > > >jdbc-type="INTEGER"
  > > >primarykey="true"
  > > >/>
  > > > > >name="offer"
  > > >class-ref="com.jobbank.jobbank.model.offer.OfferVO"
  > > >auto-retrieve="true"
  > > >auto-update="false"
  > > >auto-delete="false">
  > > >  
  > > >
  > > > 
  > > > 
  > > > 
  > > > 
  > > > 
  > > >   > class="com.jobbank.jobbank.model.offer.OfferVO"
  > > > table="offer"  auto-retrieve="true" auto-
  > > > update="false" auto-delete="false">
  > > > > >name="offerId"
  > > >column="offerid"
  > > >jdbc-type="INTEGER"
  > > >primarykey="t

RE: Default values

2003-10-31 Thread Robert J Celestino
I see what you mean but, yea, I really do want this :-) 

This is legacy stuff, so I am not totally defending it. But the idea was to define the 
default in the database. If the default were to change, it would be a change in one 
place (the database). 

You are right that the object model and the db are slightly out of whack until the 
object is materialized. But with security things, the object is not usable until it 
was looked up and read from the db. So the fact that the security use type is null in 
a newly created object is OK. 

OK in the sense that the system will "work". 

But the more I think of it, the default values SHOULD be in the object model and NOT 
in the DB. So I am changing my position: I really *don't* want this :-) 

Btw given this, what use is the DEFAULT keyword in the database?  

Thanks all


Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know


  > -Original Message-
  > From: [EMAIL PROTECTED] 
  > [mailto:[EMAIL PROTECTED] 
  > Sent: Friday, October 31, 2003 2:19 AM
  > To: [EMAIL PROTECTED]
  > Subject: RE: Default values
  > 
  > 
  > Do you really want this? Your object would not reflect the 
  > value in the database! Set the 'N' as default in your 
  > object (e.g. at creation time) and everything is fine,isn't it?
  > 
  > -Original Message-
  > From: Robert J Celestino [mailto:[EMAIL PROTECTED]
  > Sent: Donnerstag, 30. Oktober 2003 23:16
  > To: OJB Users List; [EMAIL PROTECTED]
  > Subject: Default values
  > 
  > 
  > Hello All, 
  > 
  > I am wondering how to get ojb to respect default fields. 
  > (if it matters, I am using MySql and Weblogic). 
  > 
  > I have a table that has a field defined as non-nullable and 
  > with a default like so: 
  > SecurityUseType varchar(1) NOT NULL DEFAULT 'N'
  > 
  > My domain class has a field of the same name. The intent is 
  > to have the database supply the default when it is not 
  > explicitly set. For example, an insert like this would work: 
  > 
  > insert into mytable ( Id ) values ( 123 ) ;
  > 
  > And the resulting record would have a value of 'N' (the 
  > default) set for the SecurityUseType. 
  > 
  > However, using ojb (both PersistenceBroker and ODMG 
  > interfaces) when the ld is not set, ojb will attempt to set 
  > it to null. So I assume it is doing something like this: 
  > 
  > insert into mytable ( Id, SecurityUseType ) values( 
  > 123, null ) ; 
  > 
  > Indeed the value on the java side is null. 
  > 
  > Is there some way to tell ojb to not explicitly set it to null? 
  > 
  > Thanks!
  > bobc
  > 
  > 
  > Bob Celestino
  > SAS Research and Development
  > 919 - 531 - 9425
  > [EMAIL PROTECTED]
  > 
  > SAS - The Power to Know
  > 
  > 
  > 
  > -
  > 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: o/r mapping question

2003-10-31 Thread Robert J Celestino
Brian and Lance, 

Thanks very much! 


Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know


  > -Original Message-
  > From: Brian McCallister [mailto:[EMAIL PROTECTED] 
  > Sent: Thursday, October 30, 2003 9:48 PM
  > To: OJB Users List
  > Subject: Re: o/r mapping question
  > 
  > 
  > Solution 1:
  > Implement AddressGroup as a custom collection (implementing 
  > Manageable  
  > Collection) used to hold the address instances. This 
  > muddies the domain  
  > model a bit as AddressGroup then needs to know about  
  > ManageableCollection.
  > 
  > Solution 2:
  > Map two classes to the same table (I used an existing 
  > application hence  
  > the names of tables):
  > 
  > kim=# \d users
  > \d   Table "public.users"
  > Column   |  Type  | Modifiers
  > ++---
  >   id | integer| not null
  >   handle | character varying(32)  |
  >   password   | character varying(255) |
  >   first_name | character varying(255) |
  >   last_name  | character varying(255) |
  >   aim_name   | character varying(255) |
  >   email  | character varying(255) |
  > Indexes: users_pkey primary key btree (id)
  > 
  > kim=# \d gifts
  >   Table "public.gifts"
  >   Column  |  Type   | Modifiers
  > -+-+---
  >   id  | integer | not null
  >   name| character varying(255)  |
  >   description | character varying(2000) |
  >   level_of_desire | integer | default 0
  >   where_to_buy| character varying(2000) |
  >   cost| character varying(255)  |
  >   for_user_id | integer | not null
  >   from_user_id| integer |
  >   suggest_user_id | integer |
  > Indexes: gifts_pkey primary key btree (id)
  > Foreign Key constraints: gifts_fk_1 FOREIGN KEY (suggest_user_id)  
  > REFERENCES users(id) ON UPDATE NO ACTION ON DELETE NO ACTION,
  >   gifts_fk_2 FOREIGN KEY (for_user_id)  
  > REFERENCES users(id) ON UPDATE NO ACTION ON DELETE NO ACTION,
  >   gifts_fk_3 FOREIGN KEY (from_user_id)  
  > REFERENCES users(id) ON UPDATE NO ACTION ON DELETE NO ACTION
  > 
  > kim=#
  > 
  > 
  > 
  >   primarykey="true" autoincrement="true"/>
  >   class-ref="org.skife.kim.model.Bar">
  >  
  >  
  > 
  > 
  > 
  >   primarykey="true" autoincrement="true"/>
  >   element-class-ref="org.skife.kim.model.Gift"
  >   
  > collection- 
  > class="org.apache.ojb.broker.util.collections.ManageableHashSet">
  >  
  >  
  > 
  > 
  > 
  >   primarykey="true" autoincrement="true"/>
  >   jdbc-type="INTEGER" access="anonymous"/>
  >   class-ref="org.skife.kim.model.User">
  >  
  >  
  > 
  > 
  > 
  > public class Foo
  > {
  >  public Integer id;
  >  public Bar bar;
  > }
  > 
  > public class Bar
  > {
  >  public Integer id;
  >  public Set gifts;
  > }
  > 
  > public class Bang
  > {
  >  public Integer id;
  >  public Bar bar;
  > }
  > 
  >  public void testFooBar() throws Exception
  >  {
  >  foo = new Foo();
  >  bar = new Bar();
  >  bang = new Bang();
  > 
  >  PersistenceBroker broker =  
  > PersistenceBrokerFactory.defaultPersistenceBroker();
  >  foo.bar = bar;
  >  bar.gifts = new HashSet();
  >  bar.gifts.add(bang);
  >  bang.bar = bar;
  >  broker.store(foo);
  >  broker.store(bar);
  >  broker.store(bang);
  >  broker.clearCache();
  > 
  >  Criteria crit = new Criteria();
  >  crit.addEqualTo("id", this.foo.id);
  >  Query query = new QueryByCriteria(Foo.class, crit);
  >  Foo thing = (Foo) broker.getObjectByQuery(query);
  >  Assert.assertEquals(thing.id, foo.id);
  >  Assert.assertEquals(1, foo.bar.gifts.size());
  >  }
  > 
  > .
  > Time: 2.108
  > 
  > OK (1 test)
  > 
  > Neither one is ideal, but the ideal is having the data 
  > model and object  
  > model match up perfectly. The second leaves your object model  
  > 

o/r mapping question

2003-10-30 Thread Robert J Celestino
Hello all,

I am stumped by what is posibly a very simple mapping problem. 

Consider something like this
Person is stored in the person table
Person has-a AddressGroup. AddressGroup is not stored in the DB
AddressGroup has a list of Addresses
Address is stored in the address table. Has a column 
called PersonId that indicates the person it belongs to

This is a little contrived but bear with me. 

Clearly Person could have a list of addresses, but for various reasons it has the 
intermediate class AddressGroup instead. 

I know how to solve this if AddressGroup was stored in the DB, but it is not. It is 
purely a domain class. 

How can I get ojb to create and write this class without actually writing it to the 
db? 

Thanks very much
Bob c


Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know

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



Default values

2003-10-30 Thread Robert J Celestino
Hello All, 

I am wondering how to get ojb to respect default fields. (if it matters, I am using 
MySql and Weblogic). 

I have a table that has a field defined as non-nullable and with a default like so: 
SecurityUseType varchar(1) NOT NULL DEFAULT 'N'

My domain class has a field of the same name. The intent is to have the database 
supply the default when it is not explicitly set. For example, an insert like this 
would work: 

insert into mytable ( Id ) values ( 123 ) ;

And the resulting record would have a value of 'N' (the default) set for the 
SecurityUseType. 

However, using ojb (both PersistenceBroker and ODMG interfaces) when the ld is not 
set, ojb will attempt to set it to null. So I assume it is doing something like this: 

insert into mytable ( Id, SecurityUseType ) values( 123, null ) ; 

Indeed the value on the java side is null. 

Is there some way to tell ojb to not explicitly set it to null? 

Thanks!
bobc


Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know


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



OQL Query

2003-10-29 Thread Robert J Celestino
Hello All, 

I would like to tuse ODMG API, but I am not crazy about the pseudo sql style of the 
OQLQuery. I think that the persistence broker queries are much cleaner and more object 
oriented. 

Is it possible to create an OQLQuery or EnhancedOQLQuery using the Criteria class or 
something similar? 

For example instead of OQL style: 
EnhancedOQLQuery query1 = _omdg.newOQLQuery();
String q = "select p from " + Person.class.getName() + " where Id = " + 
queryId ;
query1.create( q ) ;

This PersistenceBroker style: 
Criteria crit = new Criteria() ; 
crit.addEqualTo( "Id",  id ) ; 
Query query2 = QueryFactory.newQuery( Person.class, crit ) ; 


Thanks!


Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know

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



Custom SequenceManager

2003-10-27 Thread Robert J Celestino
Hello, 

I am new to OJB and in the process of evaluating it for use on our project. So far I 
am very impressed and looking forward to using it in production. 

To that end, I have written my own sequence manager. It appears to work (records are 
created correctly with GUIDs correctly generated).

But the Guids that we generate have imbedded dashes and that seems to cause the 
queries a problem. A very simple example: 

String id = "7f653507-0a28-0c51-0153-e0c0206f7a20" ; 
oqlQuery = "select p from " + Person.class.getName() + " where Id = " + id  ;  
OQLQuery query = _omdg.newOQLQuery();
query.create( oqlQuery ) ; <-- throws exception here : 

org.odmg.QueryInvalidException: expecting '>', found '0'
at org.apache.ojb.odmg.oql.OQLQueryImpl.create(Unknown Source)
at org.apache.ojb.odmg.oql.OQLQueryImpl.create(Unknown Source)
.
.
.

Should I escape the string in some fashion? Escape the dashes? Does "-" signify 
something in particular? 

Any help greatly appreciated! 

Thanks,
Bob c

Bob Celestino
SAS Research and Development
919 - 531 - 9425
[EMAIL PROTECTED]

SAS - The Power to Know


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