Re: AW: AW: Two 1:N mappings to one table

2004-01-14 Thread Brian McCallister
Hmm, fun one. I suspect you may have run into the weird edge case.

I don't have an immediate answer on this -- need to play and dig.

Anyone else hit this before? Any chance you can create a unit test that 
demonstrates the behavior? If so send it to me and I'll check it in and 
dig in (or start prodding).

-Brian

On Jan 14, 2004, at 1:21 PM, Dirk Manske (Service Respond) wrote:

Hi Brian,

exactly. Due to copy & paste I assigned a wrong column to the attribute
activityId in class Person. But know I experience the problem, that 
each
created activity is stored twice (with different id's). I mean, I know 
why,
I add activity once to the 'person collection' and to the 'venture
collection' and do then pm.store(venture) and pm.store(person). I 
guess I
have to follow a different approach?! Say, store first venture, then
retrieve activity to store it with person? or how does it work?

thx,
Dirk
-Ursprüngliche Nachricht-
Von: Brian McCallister [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 14. Januar 2004 18:33
An: OJB Users List
Betreff: Re: AW: Two 1:N mappings to one table
It sounds like there is actually a problem in the mapping from class ->
table where the activityId is listed.
Any chance you could post the full mapping for these classes, along 
with the
database schema?

-Brian

On Jan 14, 2004, at 11:33 AM, Dirk Manske (Service Respond) wrote:

Hi,

yes, i am using pb.  Setting auto-retrieve="true" in the
collection-descriptor has not the desired effect, I still get the
following two strange error messages:
within browser it shows a null pointer execption for Venture when it
tried to retrieve all venture objects associated with activity and in
the tomcat console I get a SQL Exception for class PERSON, state that
activityId is not valid in the context where it is used (db2 database
error message).
When I set auto-retrieve="false" for PERSON in the
reference-descriptor of class ACTIVITY, the venture objects are
retrieved. no error message.
everything works fine, except - of course I have no person objects
then.
any idea?

Dirk



-Ursprüngliche Nachricht-
Von: Brian McCallister [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 14. Januar 2004 15:13
An: OJB Users List
Betreff: Re: Two 1:N mappings to one table
Mapping to 1:N's to the same table is fine, heack mapping 1:N's form
one class to itself multiple times works fine.
 From looking at your configs I will venture that you are using the PB
API and one of the collections isn't loading -- try setting
auto-retrieve on the collections, or (these are exclusive) try using
the ODMG API (which will retrieve them automagically)
-Brian

On Jan 13, 2004, at 7:58 PM, Dirk Manske wrote:

Hi,

how can I map two tables with each having a 1:N relation to the same
table?
I always get a null pointer exception for class Person.
I have three tables:

PERSON with a 1:N relation to ACTIVITY

and

VENTURE with a 1:N relation to ACTIVITY

Table PERSON and VENTURE both references activityId from table
ACTIVITY. In the repository-user.xml for each table which relates to
ACTIVITY the collection-descriptor is setup
for table VENTURE:


 
and for table PERSON:


 
for ACTIVITY, both tables are referenced:


class-ref="de.plato.Person"
refresh="true"
auto-retrieve="true">

and

 class-ref="de.plato.Venture"
refresh="true"
auto-retrieve="true">

Unfortunately, this does not work. What do I have to do?

thx,
Dirk
-
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]



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


RE: Ordered Collections, Lists, DList

2004-01-14 Thread Coup, Robert Muir
If anyone is interested, my current solution for one case is:
 1. add an Integer field listIndex to the item object
 2. make the item object PersistenceBrokerAware, and in the
beforeUpdate() method
// update the position of this entry in the list
if (this.parent != null) {
this.listIndex = new
Integer(this.parent.getItemList().indexOf(this));
} else {
this.listIndex = null;
}
 3. to the parent collection-descriptor decalaration, add 
 
Possible issues:
 1. If the order of items in a list is changed, then _all_ the item
objects must be updated so their indexes are stored.

As always, suggestions are welcome.

Thanks,

Rob :)


> -Original Message-
> From: Coup, Robert Muir [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, 14 January 2004 12:09 p.m.
> To: [EMAIL PROTECTED]
> Subject: Ordered Collections, Lists, DList
> 
> 
> Hi all,
> 
> What is the best way of storing an ordered list without using 
> Dlist which requires additional tables & SQL lookups? 
> 
> OrderBy works great if the positioning has some underlying 
> field (eg. Object id, name) but if the only thing specifying 
> the position is the list index then it doesn't work too well.
> 
> One option is to link a fake field-descriptor to the item's 
> position in a list and use orderby... Is this what other 
> people are doing?
> 
> Another is to create a new ManageableCollection that is 
> linked somehow to a database field which it stores indexes 
> in... but that breaks the idea that the mapping is in the repository.
> 
> Another is to do something like...
>   name="myList"
>element-class-ref="com.example.MyObject"
>collection-class="com.example.MyMagicList"
>index-field="listIndexField"
>/>
> Then store the index of each item in the list in the database 
> field specified by index-field. When you re-instantiate it is 
> effectively an orderBy. A ManageableList interface extending 
> ManageableCollection may be needed which knows about and uses 
> the index-field attribute... 
> And it probably needs to ignore/complain about additional 
> orderBy fields...
> 
> Is this a good idea? Something worth doing?
> Or am I missing the obvious?
> 
> Thanks again,
> Rob :)
> 
> -
> 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: Qualified Collection Relationships

2004-01-14 Thread Coup, Robert Muir
Hi,

One problem solved - one to go.

GO is a group. A group has a collection of members (which is a
superclass of group), and has a collection of all groups that contain
it, and has a reference to RO. 
 RO
   + GO
  + MO
 + MO
 + MO
  + MO
  + MO
   + GO

In retrieving the groups in RO, I need to get only those groups where
GO.groupsThatContainMe.size() == 0 Ie. Where there are no parent
groups for this one.

How can I specify this using a PB Query in my QueryCustomizer?

Thanks again for all your help,

Robert



> -Original Message-
> From: Jakob Braeuchi [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, 15 January 2004 7:27 a.m.
> To: OJB Users List
> Subject: Re: Qualified Collection Relationships
> 
> 
> hi robert,
> 
> you can solve this problem by using a QueryCustomizer to add 
> additional criteria 
> to the query generated by ojb.
> 
> hth
> jakob
> 
> Coup, Robert Muir wrote:
> 
> > Hi All,
> > 
> > What I have :
> > Root Object RO has:
> >  - a collection of CO objects specified using 
> 
> > 
> > Child Object CO has:
> >  - a collection of CO objects specified using 
> 
> >  - a reference to a parent CO (null if the object has no CO parent)
> >  - a reference to the RO
> > 
> > Example...
> > 
> > RO
> >   + CO
> >  + CO
> > + CO
> > + CO
> >  + CO
> >  + CO
> >   + CO
> >   + CO
> >   
> > However, when my collection of CO's for the RO is built by OJB on 
> > retrieval, it does something like:
> >SELECT * FROM co WHERE co.RO_reference = RO.id
> > This returns all the CO objects, but I only want the direct 
> children 
> > such as:
> >SELECT * FROM co WHERE (co.RO_reference = RO.id) AND 
> (co.CO_parent 
> > =
> > null)
> > 
> > Which I would ideally declare something like:
> > 
> >  > element-class-ref="CO"
> > auto-retrieve="true"
> > auto-update="false"
> > >
> > 
> >  
> > 
> > 
> > I searched the mail archives and came up with some posts 
> saying that 
> > qualified relationships were on the todo list in February 
> 2003... Has 
> > there been any progress since then?
> > 
> > Alternatively, how have other people solved this? Setting 
> > auto-retrieve to false and doing a getCollectionByCriteria() in the 
> > PersistenceBrokerAware afterLookup() method seems like a reasonable 
> > option, but means the business object layer starts to know a little 
> > bit much about the persistence mechanisms...
> > 
> > Thanks for your help,
> > 
> > Robert Coup :)
> > 
> > 
> > 
> -
> > 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: TimeStamp & Error Codes

2004-01-14 Thread Guillaume Nodet
Considering your mail, i'm not sure you have completely understood what OJB
is for.
What do you want to use it for ?

-Message d'origine-
De : Gopi Nandamuri [mailto:[EMAIL PROTECTED]
Envoye : mercredi 14 janvier 2004 16:34
A : OJB Users List
Objet : RE: TimeStamp & Error Codes


Hi All,

 Can anyone reply to my message? In question 1 I have wrongly
mentioned time in Nano seconds but I am looking up to microseconds.
Using JavaDate2SqlTimestampFieldConversion class I am able to convert
java.util.Date to TimeStamp, but in microseconds it is moving zeroes.

I am using IBMWebSphere as my application server and I am trying to use
p6spy. I have changed build.properties file to add usep6spy=true and
changed spy.properties file to accept DB2 Jdbc driver and the location
of log file.
But that seems to be not working. Can anyone point out where I am
missing?

Thanks & Regards,
Gopi.

-Original Message-
From: Gopi Nandamuri
Sent: 14 January 2004 10:48
To: [EMAIL PROTECTED]
Subject: TimeStamp & Error Codes

Hi,



1)  I am new to OJB and Testing OJB with various options to suit my
database. I have a TimeStamp field in my table and I would like to enter
the exact time (In Nano Seconds) when I call the Store method in broker.
In SQL we used to do like this insert into table values (TIMESTAMP,...).
Is there any equivalent of this in OJB? I am using
org.apache.ojb.broker.PersistenceBroker.  (I don't want to call
java.sql.TimeStamp constructor by passing the arguments to construct the
timestamp object)



2) In jdbc the return type of preparedStatement.executeUpdate() method
gives the no of rows updated or inserted. By checking the return type we
can say that the operation was successful or not. In OJB we have the
object and we will call store or delete methods. Is there a way to know
whether that operation was successful or not? If there is an error, is
it possible to find out the SQLErrorCode for that error like
SQLException.getErrorCode() ?



Thanks & Regards,

Gopi.






-
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: Qualified Collection Relationships

2004-01-14 Thread Coup, Robert Muir
Hi Jakob,

> you can solve this problem by using a QueryCustomizer to add 
> additional criteria 
> to the query generated by ojb.

I found it! It's only mentioned in the O/R mapping tutorial but not is
missing completely from the repository documentation, so I had missed
it.

I think it would be handy to add a reference from the repository docs to
the o/r mapping stuff. (probably from the dtd too since there is no
documentation there either). Just so the repository stays as the
definitive reference on the available options.

Thanks for your help,

Rob :)


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



Re: Safe to mix ODMG and PB?

2004-01-14 Thread Armin Waibel
Hi Sean,

recommended to use the second alternative.
We introduced a TransactionExt interface in rc5, this encapsulates the 
proprietary extensions of odmg.Transaction. Thus you can cast tx to 
TransactionExt too.

> Transaction tx = odmg.newTransaction();
> tx.begin();
> PersistenceBroker broker = ((TransactionExt) tx).getBroker();
see
http://db.apache.org/ojb/api/org/apache/ojb/odmg/TransactionExt.html
regards,
Armin
Sean Dockery wrote:
If my application is using the ODMG personality of OJB a la...

Implementation odmg = OBJ.getInstance();
...
Is it safe for other parts of my code to use a PersistenceBroker like
this...
PersistenceBroker broker =
PersistenceBrokerFactory.defaultPersistenceBroker();
try {
// ...
}
finally {
broker.close();
}
...or should I always (on pain of death) get a PersistenceBroker like
this...
Implementation odmg = OJB.getInstance();
Transaction tx = odmg.newTransaction();
tx.begin();
PersistenceBroker broker = ((HasBroker) tx).getBroker();
//...
tx.commit();




-
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: Proxy prefetching limit in Collection and Reference descriptors.

2004-01-14 Thread Jakob Braeuchi
hi tadeus,

this limit is defined in ojb.properties. the parameter is called SqlInLimit.

hth
jakob
Tadeus Garsva wrote:

Hi,

I don't find any reference to method setProxyPrefetchungLimit in 
ObjectReferenceDescriptor class. Does it mean that 
proxy-prefetching-attribute in reference and collection descriptor can 
be changed only by calling this method and not by attribute in 
repository.xml?

Thanks in advance for answer.
Best regards
Tadeus Garsva


-
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: Qualified Collection Relationships

2004-01-14 Thread Jakob Braeuchi
hi robert,

you can solve this problem by using a QueryCustomizer to add additional criteria 
to the query generated by ojb.

hth
jakob
Coup, Robert Muir wrote:

Hi All,

What I have :
Root Object RO has:
 - a collection of CO objects specified using 
Child Object CO has:
 - a collection of CO objects specified using 
 - a reference to a parent CO (null if the object has no CO parent)
 - a reference to the RO
Example...

RO
  + CO
 + CO
+ CO
+ CO
 + CO
 + CO
  + CO
  + CO
  
However, when my collection of CO's for the RO is built by OJB on
retrieval, it does something like:
   SELECT * FROM co WHERE co.RO_reference = RO.id
This returns all the CO objects, but I only want the direct children
such as:
   SELECT * FROM co WHERE (co.RO_reference = RO.id) AND (co.CO_parent =
null)

Which I would ideally declare something like:





I searched the mail archives and came up with some posts saying that
qualified relationships were on the todo list in February 2003... Has
there been any progress since then? 

Alternatively, how have other people solved this? Setting auto-retrieve
to false and doing a getCollectionByCriteria() in the
PersistenceBrokerAware afterLookup() method seems like a reasonable
option, but means the business object layer starts to know a little bit
much about the persistence mechanisms...
Thanks for your help,

Robert Coup :)

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


AW: AW: Two 1:N mappings to one table

2004-01-14 Thread Dirk Manske (Service Respond)
Hi Brian,

exactly. Due to copy & paste I assigned a wrong column to the attribute
activityId in class Person. But know I experience the problem, that each
created activity is stored twice (with different id's). I mean, I know why,
I add activity once to the 'person collection' and to the 'venture
collection' and do then pm.store(venture) and pm.store(person). I guess I
have to follow a different approach?! Say, store first venture, then
retrieve activity to store it with person? or how does it work?

thx,
Dirk

-Ursprüngliche Nachricht-
Von: Brian McCallister [mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 14. Januar 2004 18:33
An: OJB Users List
Betreff: Re: AW: Two 1:N mappings to one table

It sounds like there is actually a problem in the mapping from class ->
table where the activityId is listed.

Any chance you could post the full mapping for these classes, along with the
database schema?

-Brian

On Jan 14, 2004, at 11:33 AM, Dirk Manske (Service Respond) wrote:

> Hi,
>
> yes, i am using pb.  Setting auto-retrieve="true" in the 
> collection-descriptor has not the desired effect, I still get the 
> following two strange error messages:
>
> within browser it shows a null pointer execption for Venture when it 
> tried to retrieve all venture objects associated with activity and in 
> the tomcat console I get a SQL Exception for class PERSON, state that 
> activityId is not valid in the context where it is used (db2 database 
> error message).
>
> When I set auto-retrieve="false" for PERSON in the 
> reference-descriptor of class ACTIVITY, the venture objects are 
> retrieved. no error message.
> everything works fine, except - of course I have no person objects 
> then.
>
> any idea?
>
> Dirk
>
>
>
>
> -Ursprüngliche Nachricht-
> Von: Brian McCallister [mailto:[EMAIL PROTECTED]
> Gesendet: Mittwoch, 14. Januar 2004 15:13
> An: OJB Users List
> Betreff: Re: Two 1:N mappings to one table
>
> Mapping to 1:N's to the same table is fine, heack mapping 1:N's form 
> one class to itself multiple times works fine.
>
>  From looking at your configs I will venture that you are using the PB 
> API and one of the collections isn't loading -- try setting 
> auto-retrieve on the collections, or (these are exclusive) try using 
> the ODMG API (which will retrieve them automagically)
>
> -Brian
>
> On Jan 13, 2004, at 7:58 PM, Dirk Manske wrote:
>
>> Hi,
>>
>> how can I map two tables with each having a 1:N relation to the same 
>> table?
>> I always get a null pointer exception for class Person.
>>
>> I have three tables:
>>
>> PERSON with a 1:N relation to ACTIVITY
>>
>> and
>>
>> VENTURE with a 1:N relation to ACTIVITY
>>
>> Table PERSON and VENTURE both references activityId from table 
>> ACTIVITY. In the repository-user.xml for each table which relates to 
>> ACTIVITY the collection-descriptor is setup
>>
>> for table VENTURE:
>>
>> > name="allAssignedActivities"
>> element-class-ref="de.plato.Activity"
>> orderBy="activityId"
>> sort="DESC"
>> auto-update="true" >
>>  
>>
>> and for table PERSON:
>>
>> > name="allAssignedActivities"
>> element-class-ref="de.plato.Activity"
>> orderBy="activityId"
>> sort="DESC"
>> auto-update="true" >
>>  
>>
>> for ACTIVITY, both tables are referenced:
>>
>> 
>> class-ref="de.plato.Person"
>> refresh="true"
>> auto-retrieve="true">
>> 
>>
>> and
>>
>>  class-ref="de.plato.Venture"
>> refresh="true"
>> auto-retrieve="true">
>> 
>>
>> Unfortunately, this does not work. What do I have to do?
>>
>> thx,
>> Dirk
>>
>>
>> -
>> 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]



Safe to mix ODMG and PB?

2004-01-14 Thread Sean Dockery
If my application is using the ODMG personality of OJB a la...

Implementation odmg = OBJ.getInstance();
...

Is it safe for other parts of my code to use a PersistenceBroker like
this...

PersistenceBroker broker =
PersistenceBrokerFactory.defaultPersistenceBroker();
try {
// ...
}
finally {
broker.close();
}

...or should I always (on pain of death) get a PersistenceBroker like
this...

Implementation odmg = OJB.getInstance();
Transaction tx = odmg.newTransaction();
tx.begin();
PersistenceBroker broker = ((HasBroker) tx).getBroker();
//...
tx.commit();





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



Re: AW: Two 1:N mappings to one table

2004-01-14 Thread Brian McCallister
It sounds like there is actually a problem in the mapping from class -> 
table where the activityId is listed.

Any chance you could post the full mapping for these classes, along 
with the database schema?

-Brian

On Jan 14, 2004, at 11:33 AM, Dirk Manske (Service Respond) wrote:

Hi,

yes, i am using pb.  Setting auto-retrieve="true" in the
collection-descriptor has not the desired effect, I still get the 
following
two strange error messages:

within browser it shows a null pointer execption for Venture when it 
tried
to retrieve all venture objects associated with activity and in the 
tomcat
console I get a
SQL Exception for class PERSON, state that activityId is not valid in 
the
context where it is used (db2 database error message).

When I set auto-retrieve="false" for PERSON in the 
reference-descriptor of
class ACTIVITY, the venture objects are retrieved. no error message.
everything works fine, except - of course I have no person objects 
then.

any idea?

Dirk



-Ursprüngliche Nachricht-
Von: Brian McCallister [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 14. Januar 2004 15:13
An: OJB Users List
Betreff: Re: Two 1:N mappings to one table
Mapping to 1:N's to the same table is fine, heack mapping 1:N's form 
one
class to itself multiple times works fine.

 From looking at your configs I will venture that you are using the PB 
API
and one of the collections isn't loading -- try setting auto-retrieve 
on the
collections, or (these are exclusive) try using the ODMG API (which 
will
retrieve them automagically)

-Brian

On Jan 13, 2004, at 7:58 PM, Dirk Manske wrote:

Hi,

how can I map two tables with each having a 1:N relation to the same
table?
I always get a null pointer exception for class Person.
I have three tables:

PERSON with a 1:N relation to ACTIVITY

and

VENTURE with a 1:N relation to ACTIVITY

Table PERSON and VENTURE both references activityId from table
ACTIVITY. In the repository-user.xml for each table which relates to
ACTIVITY the collection-descriptor is setup
for table VENTURE:


 
and for table PERSON:


 
for ACTIVITY, both tables are referenced:


class-ref="de.plato.Person"
refresh="true"
auto-retrieve="true">

and


class-ref="de.plato.Venture"
refresh="true"
auto-retrieve="true">

Unfortunately, this does not work. What do I have to do?

thx,
Dirk
-
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]


Date problem ?

2004-01-14 Thread eric barbe
Hi everybody,

I'm working under Oracle 8i.

In my repository_user.xml, i have amongst other things this class descriptor


   
   
   


where the Calendate2DateFieldConversion looks like following :

/*
 * Created on 19 nov. 2003
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package MyPackage;

import java.sql.Date;
import java.util.Calendar;
import java.util.GregorianCalendar;

import org.apache.ojb.broker.accesslayer.conversions.FieldConversion;

/**
 * @author ghd
 *
 * To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
public class Calendar2DateFieldConversion implements FieldConversion {
/**
 * @see FieldConversion#javaToSql(Object)
 */
public Object javaToSql(Object source)
{
if (source instanceof Calendar)
{
return new Date(((Calendar) source).getTimeInMillis());
}
else
{
return source;
}
}

/**
 * @see FieldConversion#sqlToJava(Object)
 */
public Object sqlToJava(Object source)
{
if (source instanceof Date)
{
GregorianCalendar cal = new GregorianCalendar();
cal.setTimeInMillis(((Date)source).getTime());
return cal;
}
else
{
return source;
}
}
}

my problemn is that the date are stored without the hour informations under
Oracle. It works fine with SQL Server. :-(

Does somebody knows about this problem ?

Regards.

Éric


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



AW: Two 1:N mappings to one table

2004-01-14 Thread Dirk Manske (Service Respond)
Hi,

yes, i am using pb.  Setting auto-retrieve="true" in the
collection-descriptor has not the desired effect, I still get the following
two strange error messages:

within browser it shows a null pointer execption for Venture when it tried
to retrieve all venture objects associated with activity and in the tomcat
console I get a
SQL Exception for class PERSON, state that activityId is not valid in the
context where it is used (db2 database error message).

When I set auto-retrieve="false" for PERSON in the reference-descriptor of
class ACTIVITY, the venture objects are retrieved. no error message.
everything works fine, except - of course I have no person objects then.

any idea?

Dirk 




-Ursprüngliche Nachricht-
Von: Brian McCallister [mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 14. Januar 2004 15:13
An: OJB Users List
Betreff: Re: Two 1:N mappings to one table

Mapping to 1:N's to the same table is fine, heack mapping 1:N's form one
class to itself multiple times works fine.

 From looking at your configs I will venture that you are using the PB API
and one of the collections isn't loading -- try setting auto-retrieve on the
collections, or (these are exclusive) try using the ODMG API (which will
retrieve them automagically)

-Brian

On Jan 13, 2004, at 7:58 PM, Dirk Manske wrote:

> Hi,
>
> how can I map two tables with each having a 1:N relation to the same 
> table?
> I always get a null pointer exception for class Person.
>
> I have three tables:
>
> PERSON with a 1:N relation to ACTIVITY
>
> and
>
> VENTURE with a 1:N relation to ACTIVITY
>
> Table PERSON and VENTURE both references activityId from table 
> ACTIVITY. In the repository-user.xml for each table which relates to 
> ACTIVITY the collection-descriptor is setup
>
> for table VENTURE:
>
>  name="allAssignedActivities"
> element-class-ref="de.plato.Activity"
> orderBy="activityId"
> sort="DESC"
> auto-update="true" >
>  
>
> and for table PERSON:
>
>  name="allAssignedActivities"
> element-class-ref="de.plato.Activity"
> orderBy="activityId"
> sort="DESC"
> auto-update="true" >
>  
>
> for ACTIVITY, both tables are referenced:
>
> 
> class-ref="de.plato.Person"
> refresh="true"
> auto-retrieve="true">
> 
>
> and
>
> 
> class-ref="de.plato.Venture"
> refresh="true"
> auto-retrieve="true">
> 
>
> Unfortunately, this does not work. What do I have to do?
>
> thx,
> Dirk
>
>
> -
> 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: TimeStamp & Error Codes

2004-01-14 Thread Gopi Nandamuri
Hi All,

 Can anyone reply to my message? In question 1 I have wrongly
mentioned time in Nano seconds but I am looking up to microseconds.
Using JavaDate2SqlTimestampFieldConversion class I am able to convert
java.util.Date to TimeStamp, but in microseconds it is moving zeroes.

I am using IBMWebSphere as my application server and I am trying to use
p6spy. I have changed build.properties file to add usep6spy=true and
changed spy.properties file to accept DB2 Jdbc driver and the location
of log file.
But that seems to be not working. Can anyone point out where I am
missing?

Thanks & Regards,
Gopi.

-Original Message-
From: Gopi Nandamuri 
Sent: 14 January 2004 10:48
To: [EMAIL PROTECTED]
Subject: TimeStamp & Error Codes

Hi,

 

1)  I am new to OJB and Testing OJB with various options to suit my
database. I have a TimeStamp field in my table and I would like to enter
the exact time (In Nano Seconds) when I call the Store method in broker.
In SQL we used to do like this insert into table values (TIMESTAMP,...).
Is there any equivalent of this in OJB? I am using
org.apache.ojb.broker.PersistenceBroker.  (I don't want to call
java.sql.TimeStamp constructor by passing the arguments to construct the
timestamp object)

 

2) In jdbc the return type of preparedStatement.executeUpdate() method
gives the no of rows updated or inserted. By checking the return type we
can say that the operation was successful or not. In OJB we have the
object and we will call store or delete methods. Is there a way to know
whether that operation was successful or not? If there is an error, is
it possible to find out the SQLErrorCode for that error like
SQLException.getErrorCode() ?

 

Thanks & Regards,

Gopi.

 

 


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



Re: Two 1:N mappings to one table

2004-01-14 Thread Brian McCallister
Mapping to 1:N's to the same table is fine, heack mapping 1:N's form 
one class to itself multiple times works fine.

From looking at your configs I will venture that you are using the PB 
API and one of the collections isn't loading -- try setting 
auto-retrieve on the collections, or (these are exclusive) try using 
the ODMG API (which will retrieve them automagically)

-Brian

On Jan 13, 2004, at 7:58 PM, Dirk Manske wrote:

Hi,

how can I map two tables with each having a 1:N relation to the same 
table?
I always get a null pointer exception for class Person.

I have three tables:

PERSON with a 1:N relation to ACTIVITY

and

VENTURE with a 1:N relation to ACTIVITY

Table PERSON and VENTURE both references activityId from table 
ACTIVITY. In
the repository-user.xml for each table which relates to ACTIVITY the
collection-descriptor is setup

for table VENTURE:




and for table PERSON:




for ACTIVITY, both tables are referenced:


class-ref="de.plato.Person"
refresh="true"
auto-retrieve="true">

and


class-ref="de.plato.Venture"
refresh="true"
auto-retrieve="true">

Unfortunately, this does not work. What do I have to do?

thx,
Dirk
-
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: Batch mode and foreign keys

2004-01-14 Thread Guillaume Nodet
Thanks a lot !
It works perfectly now.

Guillaume

-Message d'origine-
De : Oleg Nitz [mailto:[EMAIL PROTECTED]
Envoyé : mercredi 14 janvier 2004 01:29
À : OJB Users List
Objet : Re: Batch mode and foreign keys


Guillaume, can you try now, with CVS version?

Thanks,
 Oleg

On Tuesday 13 January 2004 12:53, Guillaume Nodet wrote:
> The Oracle error is:
>   ORA-02291 integrity constraint (%s.%s) violated - parent key not found
>
> The constraint referenced in my case is an optional foreign key
> 'FOREIGN KEY (ACTDATA) REFERENCES ACTIVITIES (ID)' on table PROPERTIES.
>
> The ddl is following (i ommited all fields that i think are not relevant
> here)
>
>
> CREATE TABLE RESOURCES
> (
>   ID INTEGER,
>   ...
>   PRIMARY KEY (ID)
> );
> CREATE TABLE ACTIVITIES
> (
>   ID INTEGER,
>   ...
>   PRIMARY KEY (ID)
> );
> CREATE TABLE CARDS
> (
>   ID INTEGER,
>   ...
>   PRIMARY KEY (ID)
> );
> CREATE TABLE PROPERTIES
> (
>   IDA INTEGER,
>   ...
>   RESDATA INTEGER,
>   ACTDATA INTEGER,
>   CARDPROPERTIES  INTEGER,
>   PRIMARY KEY (IDA),
>   FOREIGN KEY (RESDATA)
> REFERENCES RESOURCES (ID),
>   FOREIGN KEY (ACTDATA)
> REFERENCES ACTIVITIES (ID),
>   FOREIGN KEY (CARDPROPERTIES)
> REFERENCES CARDS (ID),
> );
>
>
> and the repository.xml extract for the preceding tables is:
>
>  table="resources">
>primarykey="true"/>
>   ...
>element-class-ref="com.optitime.api.datamodel.entity.Property"
> auto-update="true" auto-retrieve="true" auto-delete="false">
>   
>   
> 
>  table="activities">
>primarykey="true"/>
>   ...
>element-class-ref="com.optitime.api.datamodel.entity.Property"
> auto-update="true" auto-retrieve="true" auto-delete="false">
>   
>   
> 
>  table="cards">
>primarykey="true"/>
>   ...
>element-class-ref="com.optitime.api.datamodel.entity.Property"
> auto-update="true" auto-retrieve="true" auto-delete="false">
>   
>   
> 
>
>
> The DDL is generated and contains only primary keys and foreign keys,
> so all constraints should be known by OJB.
>
>
> -Message d'origine-
> De : Oleg Nitz [mailto:[EMAIL PROTECTED]
> Envoyé : mardi 13 janvier 2004 12:26
> À : OJB Users List
> Objet : Re: Batch mode and foreign keys
>
>
> Hi Guillaume,
>
> Please translate the text of the exception into English and give more
> details
> about this case. Is GNT the name of the table? What are related objects
for
> GNT involved into this thansaction?
> And the most important question is:
> Do all database constraints correspond to some relations described in
> repository.xml?
> If there is some database constraint that OJB is not aware of, it might be
> violated with the batch mode, because OJB changes the order of statements
> to group them into batches, but in such way that doesn't violate *known*
> constraints.
>
> Regards,
>  Oleg
>
> On Tuesday 13 January 2004 08:07, Guillaume Nodet wrote:
> > Hi !
> >
> > I've got a problem with RC5.
> > I use the broker api to store several objets with collections and nested
> > objets.
> > Under certain circumstances (Oracle, batch mode), i've got the following
> > exception thrown:
> >
> > java.sql.SQLException: ORA-02291: violation de contrainte
> > (GNT.SYS_C00194175) d'integrite - touche parent introuvable
> >
> > at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java)
> > at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java)
> > at oracle.jdbc.ttc7.Oall7.receive(Oall7.java)
> > at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java)
> > at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java)
> > at
> > oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java)
>
> at
>
> > oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java)
> > at
>
>
oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedState
>
> >m ent.java)
> > at
> > org.apache.ojb.broker.platforms.PlatformDefaultImpl.executeBatch(Unknown
> > Source)
> > at
>
>
org.apache.ojb.broker.util.batch.PreparedStatementInvocationHandler.doExecu
>
> >t e(Unknown Source)
> > at
>
>
org.apache.ojb.broker.util.batch.PreparedStatementInvocationHandler.invoke(
>
> >U nknown Source)
> > at $Proxy0.doExecute(Unknown Source)
> > at
org.apache.ojb.broker.util.batch.BatchConnection.executeBatch(Unknown
> > Source)
> > at org.apache.ojb.broker.util.batch.BatchConnection.commit(Unknown
>
> Source)
>
> > at
>
>
org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.localCommit(Unknown
>
> > Source)
> > at
> >
org.apache.ojb.broker.core.PersistenceBrokerImpl.commitTransaction(Unknow
> >n Source)
> > at
>
>
org.apache.ojb.broker.core.DelegatingPersistenceBroker.commitTransaction(Un
>
> >k nown Source)
> > at
>
>
org.apache.ojb.broker.core.DelegatingPersistenceBroker.commitTransaction(Un
>
> >k nown Source)
> > at
> >
com.optitime.synchronizer6.Synch

RE: CVS access

2004-01-14 Thread "Göschl,Siegfried"
Hi Guillaume,

are you behind a firewall?!

Siegfried Goeschl

-Original Message-
From: Guillaume Nodet [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 14, 2004 11:48 AM
To: OJB Users List
Subject: CVS access


I'm trying to access the cvs server, but i can not figure how to login in.
I tried the following using 'anoncvs' as password:

$ cvs login
Logging in to :pserver:[EMAIL PROTECTED]:2401/home/cvspublic
CVS password:
cvs [login aborted]: connect to cvs.apache.org(209.237.227.194):2401 failed:
Connection refused

Guillaume



-
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: Could not borrow connection from pool

2004-01-14 Thread Pedro Salgado

  I think I have found the problem... I was creating multiple new
PersistenceBroker instances. Eventually this makes it run out of
connections. Now I share the same PB instance for severall classes.

  sorry,

Pedro Salgado

On 14/01/2004 10:34, "Pedro Salgado" <[EMAIL PROTECTED]> wrote:

> 
> Can anyone describe me what is happening? The connection pool is out of
> connections?
> 
> 
> javax.servlet.ServletException: Could not borrow connection from pool -
> org.apache.ojb.broker.metadata.JdbcConnectionDescriptor:
> [EMAIL PROTECTED]
> jcd-alias=default
> default-connection=true
> dbms=MySQL
> jdbc-level=2.0
> driver=org.gjt.mm.mysql.Driver
> protocol=jdbc
> sub-protocol=mysql
> db-alias=//127.0.0.1:3306/portonline
> user=root
> password=*
> eager-release=false
> ConnectionPoolDescriptor={whenExhaustedAction=0, maxIdle=-1, maxActive=5,
> maxWait=5000, removeAbandoned=false, numTestsPerEvictionRun=10,
> testWhileIdle=false, minEvictableIdleTimeMillis=60, testOnReturn=false,
> logAbandoned=false, removeAbandonedTimeout=300,
> timeBetweenEvictionRunsMillis=-1, testOnBorrow=true}
> batchMode=false
> useAutoCommit=AUTO_COMMIT_SET_TRUE_AND_TEMPORARY_FALSE
> ignoreAutoCommitExceptions=false
> 
> [EMAIL PROTECTED]
>sequenceManagerClass=class
> org.apache.ojb.broker.util.sequence.SequenceManagerInMemoryImpl
>Properties={autoNaming=true}
> ]
> ] 
> 
> Pedro Salgado
> 
> 
> -
> 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[2]: Batch mode and foreign keys

2004-01-14 Thread Oleg Nitz
Hi Guillaume, 

You may download the source distro from http://db.apache.org/builds/ojb/1.0.rc5/
and get the BatchConnection.java file via web CVS
http://cvs.apache.org/viewcvs.cgi/db-ojb/src/java/org/apache/ojb/broker/util/batch/BatchConnection.java
(click 'download' by right mouse button and choose "Save Target As")
and then rebuild OJB.

-Original Message-
From: "Guillaume Nodet" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Date: Wed, 14 Jan 2004 09:51:33 +0100
Subject: RE: Batch mode and foreign keys

> I can not log on the cvs server.
> What are the right things to do that ?


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



Proxy prefetching limit in Collection and Reference descriptors.

2004-01-14 Thread Tadeus Garsva
Hi,

I don't find any reference to method setProxyPrefetchungLimit in 
ObjectReferenceDescriptor class. Does it mean that 
proxy-prefetching-attribute in reference and collection descriptor can 
be changed only by calling this method and not by attribute in 
repository.xml?

Thanks in advance for answer.
Best regards
Tadeus Garsva


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


RE : Could not borrow connection from pool

2004-01-14 Thread Emmanuel DUPONT
You open transaction without close. You reach the maxBroker number indicated
in the Ojb.properties


-Message d'origine-
De : Pedro Salgado [mailto:[EMAIL PROTECTED] 
Envoyé : mercredi 14 janvier 2004 11:34
À : OJB Users List
Objet : Could not borrow connection from pool


  Can anyone describe me what is happening? The connection pool is out of
connections?


javax.servlet.ServletException: Could not borrow connection from pool -
org.apache.ojb.broker.metadata.JdbcConnectionDescriptor:
[EMAIL PROTECTED]
  jcd-alias=default
  default-connection=true
  dbms=MySQL
  jdbc-level=2.0
  driver=org.gjt.mm.mysql.Driver
  protocol=jdbc
  sub-protocol=mysql
  db-alias=//127.0.0.1:3306/portonline
  user=root
  password=*
  eager-release=false
  ConnectionPoolDescriptor={whenExhaustedAction=0, maxIdle=-1, maxActive=5,
maxWait=5000, removeAbandoned=false, numTestsPerEvictionRun=10,
testWhileIdle=false, minEvictableIdleTimeMillis=60, testOnReturn=false,
logAbandoned=false, removeAbandonedTimeout=300,
timeBetweenEvictionRunsMillis=-1, testOnBorrow=true}
  batchMode=false
  useAutoCommit=AUTO_COMMIT_SET_TRUE_AND_TEMPORARY_FALSE
  ignoreAutoCommitExceptions=false
  
[EMAIL PROTECTED]
 sequenceManagerClass=class
org.apache.ojb.broker.util.sequence.SequenceManagerInMemoryImpl
 Properties={autoNaming=true}
]
] 

Pedro Salgado


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



Could not borrow connection from pool

2004-01-14 Thread Pedro Salgado

  Can anyone describe me what is happening? The connection pool is out of
connections?


javax.servlet.ServletException: Could not borrow connection from pool -
org.apache.ojb.broker.metadata.JdbcConnectionDescriptor:
[EMAIL PROTECTED]
  jcd-alias=default
  default-connection=true
  dbms=MySQL
  jdbc-level=2.0
  driver=org.gjt.mm.mysql.Driver
  protocol=jdbc
  sub-protocol=mysql
  db-alias=//127.0.0.1:3306/portonline
  user=root
  password=*
  eager-release=false
  ConnectionPoolDescriptor={whenExhaustedAction=0, maxIdle=-1, maxActive=5,
maxWait=5000, removeAbandoned=false, numTestsPerEvictionRun=10,
testWhileIdle=false, minEvictableIdleTimeMillis=60, testOnReturn=false,
logAbandoned=false, removeAbandonedTimeout=300,
timeBetweenEvictionRunsMillis=-1, testOnBorrow=true}
  batchMode=false
  useAutoCommit=AUTO_COMMIT_SET_TRUE_AND_TEMPORARY_FALSE
  ignoreAutoCommitExceptions=false
  
[EMAIL PROTECTED]
 sequenceManagerClass=class
org.apache.ojb.broker.util.sequence.SequenceManagerInMemoryImpl
 Properties={autoNaming=true}
]
] 

Pedro Salgado


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



TimeStamp & Error Codes

2004-01-14 Thread Gopi Nandamuri
Hi,

 

1)  I am new to OJB and Testing OJB with various options to suit my
database. I have a TimeStamp field in my table and I would like to enter
the exact time (In Nano Seconds) when I call the Store method in broker.
In SQL we used to do like this insert into table values (TIMESTAMP,...).
Is there any equivalent of this in OJB? I am using
org.apache.ojb.broker.PersistenceBroker.  (I don't want to call
java.sql.TimeStamp constructor by passing the arguments to construct the
timestamp object)

 

2) In jdbc the return type of preparedStatement.executeUpdate() method
gives the no of rows updated or inserted. By checking the return type we
can say that the operation was successful or not. In OJB we have the
object and we will call store or delete methods. Is there a way to know
whether that operation was successful or not? If there is an error, is
it possible to find out the SQLErrorCode for that error like
SQLException.getErrorCode() ?

 

Thanks & Regards,

Gopi.

 

 



CVS access

2004-01-14 Thread Guillaume Nodet
I'm trying to access the cvs server, but i can not figure how to login in.
I tried the following using 'anoncvs' as password:

$ cvs login
Logging in to :pserver:[EMAIL PROTECTED]:2401/home/cvspublic
CVS password:
cvs [login aborted]: connect to cvs.apache.org(209.237.227.194):2401 failed:
Connection refused

Guillaume



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



Re: AXgen and OJB and DDL

2004-01-14 Thread Peter Wieland
> 
> 
> 
> 

> Can you explain why they are there?  Is there any part of OJB that would
> make use of them?  I can see that (if there was an option in AXgen for
> it) the lockTimestamp field could be used for optimistic locking, but
> the other fields appear to be specific to some other use expected by
> AXgen.

You're right, these fields are not required or used directly by OJB. The
lock timestamp and lock user fields were in fact meant to enable optimistic
locking. The last modified and last modifier fields are used quite similar
by the developers to track data modification (via an OJB interceptor). In
fact the templates included in OJB are meant to be examples and it is quite
easy to adopt them to any projects personal needs. So once again, the fields
you describe are not required by OJB. You may either use it at your will,
ignore it or change the templates in which case you would probably need to
provide your own super-interface (replacing
de.armax.base.datasource.AXentity in AXentity.jar).

Regards,
Peter

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



Problem in PBCollectionProxyListener during CollectionProxy prefetching

2004-01-14 Thread Tadeus Garsva
Hi,

I have a Class A with 1:n relation to Class B. Collection descriptor is 
with proxy=true.
Collection of class A have more objects than prefetching limit. During 
prefetching of class B I got ClassCastException in 
PBCollectionProxyListener  in method :

protected void addThisListenerTo(Object listenedObject)
   {
   _listenedCollection = (CollectionProxy) listenedObject;
   _listenedCollection.addListener(this);
   }
It is normal, because listenedObject is one obejct of owners (see 
reference to this method:
   addThisListenerTo(owners.get(0));.
)

Could you help me. Maybe there is other reason, maybe I am somewhere wrong.

Thanks in advance

Tadeus Garsva



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


RE: Batch mode and foreign keys

2004-01-14 Thread Guillaume Nodet
I can not log on the cvs server.
What are the right things to do that ?

Guillaume

-Message d'origine-
De : Oleg Nitz [mailto:[EMAIL PROTECTED]
Envoyé : mercredi 14 janvier 2004 01:29
À : OJB Users List
Objet : Re: Batch mode and foreign keys


Guillaume, can you try now, with CVS version?

Thanks,
 Oleg

On Tuesday 13 January 2004 12:53, Guillaume Nodet wrote:
> The Oracle error is:
>   ORA-02291 integrity constraint (%s.%s) violated - parent key not found
>
> The constraint referenced in my case is an optional foreign key
> 'FOREIGN KEY (ACTDATA) REFERENCES ACTIVITIES (ID)' on table PROPERTIES.
>
> The ddl is following (i ommited all fields that i think are not relevant
> here)
>
>
> CREATE TABLE RESOURCES
> (
>   ID INTEGER,
>   ...
>   PRIMARY KEY (ID)
> );
> CREATE TABLE ACTIVITIES
> (
>   ID INTEGER,
>   ...
>   PRIMARY KEY (ID)
> );
> CREATE TABLE CARDS
> (
>   ID INTEGER,
>   ...
>   PRIMARY KEY (ID)
> );
> CREATE TABLE PROPERTIES
> (
>   IDA INTEGER,
>   ...
>   RESDATA INTEGER,
>   ACTDATA INTEGER,
>   CARDPROPERTIES  INTEGER,
>   PRIMARY KEY (IDA),
>   FOREIGN KEY (RESDATA)
> REFERENCES RESOURCES (ID),
>   FOREIGN KEY (ACTDATA)
> REFERENCES ACTIVITIES (ID),
>   FOREIGN KEY (CARDPROPERTIES)
> REFERENCES CARDS (ID),
> );
>
>
> and the repository.xml extract for the preceding tables is:
>
>  table="resources">
>primarykey="true"/>
>   ...
>element-class-ref="com.optitime.api.datamodel.entity.Property"
> auto-update="true" auto-retrieve="true" auto-delete="false">
>   
>   
> 
>  table="activities">
>primarykey="true"/>
>   ...
>element-class-ref="com.optitime.api.datamodel.entity.Property"
> auto-update="true" auto-retrieve="true" auto-delete="false">
>   
>   
> 
>  table="cards">
>primarykey="true"/>
>   ...
>element-class-ref="com.optitime.api.datamodel.entity.Property"
> auto-update="true" auto-retrieve="true" auto-delete="false">
>   
>   
> 
>
>
> The DDL is generated and contains only primary keys and foreign keys,
> so all constraints should be known by OJB.
>
>
> -Message d'origine-
> De : Oleg Nitz [mailto:[EMAIL PROTECTED]
> Envoyé : mardi 13 janvier 2004 12:26
> À : OJB Users List
> Objet : Re: Batch mode and foreign keys
>
>
> Hi Guillaume,
>
> Please translate the text of the exception into English and give more
> details
> about this case. Is GNT the name of the table? What are related objects
for
> GNT involved into this thansaction?
> And the most important question is:
> Do all database constraints correspond to some relations described in
> repository.xml?
> If there is some database constraint that OJB is not aware of, it might be
> violated with the batch mode, because OJB changes the order of statements
> to group them into batches, but in such way that doesn't violate *known*
> constraints.
>
> Regards,
>  Oleg
>
> On Tuesday 13 January 2004 08:07, Guillaume Nodet wrote:
> > Hi !
> >
> > I've got a problem with RC5.
> > I use the broker api to store several objets with collections and nested
> > objets.
> > Under certain circumstances (Oracle, batch mode), i've got the following
> > exception thrown:
> >
> > java.sql.SQLException: ORA-02291: violation de contrainte
> > (GNT.SYS_C00194175) d'integrite - touche parent introuvable
> >
> > at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java)
> > at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java)
> > at oracle.jdbc.ttc7.Oall7.receive(Oall7.java)
> > at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java)
> > at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java)
> > at
> > oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java)
>
> at
>
> > oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java)
> > at
>
>
oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedState
>
> >m ent.java)
> > at
> > org.apache.ojb.broker.platforms.PlatformDefaultImpl.executeBatch(Unknown
> > Source)
> > at
>
>
org.apache.ojb.broker.util.batch.PreparedStatementInvocationHandler.doExecu
>
> >t e(Unknown Source)
> > at
>
>
org.apache.ojb.broker.util.batch.PreparedStatementInvocationHandler.invoke(
>
> >U nknown Source)
> > at $Proxy0.doExecute(Unknown Source)
> > at
org.apache.ojb.broker.util.batch.BatchConnection.executeBatch(Unknown
> > Source)
> > at org.apache.ojb.broker.util.batch.BatchConnection.commit(Unknown
>
> Source)
>
> > at
>
>
org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.localCommit(Unknown
>
> > Source)
> > at
> >
org.apache.ojb.broker.core.PersistenceBrokerImpl.commitTransaction(Unknow
> >n Source)
> > at
>
>
org.apache.ojb.broker.core.DelegatingPersistenceBroker.commitTransaction(Un
>
> >k nown Source)
> > at
>
>
org.apache.ojb.broker.core.DelegatingPersistenceBroker.commitTransaction(Un
>
> >k nown Source)
> > at
> >

RE: Cache Mechanism

2004-01-14 Thread Coup, Robert Muir
As I understand it OQL queries always hit the database but the objects
can be resolved from the cache though. If you use the PB API for
accessing objects (you can do this from ODMG) then the cache is accessed
much more.

Good Luck,

Rob :)

-Original Message-
From: Ronen Yaari [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, 14 January 2004 8:27 p.m.
To: OJB Users List
Subject: RE: Cache Mechanism



My problem is that when working with the ODMG API with cache definition
I spoted that when making the same call twice it in both cases goes to
the database in order to fetch the data.

To ensure it: before making the second call I deleted the relveant row
from the database and it did not succed to do it afterward altough it
should have been in the cache.

The same scenario worked smoothly with the Broker API.

Am I doing something wrong ?

Ronen.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 13, 2004 9:50 PM
To: OJB Users List
Subject: Re: Cache Mechanism


Hi Ronen,

Ronen Yaari wrote:
> All,
> 
> I noticed that the Cache Mechanism works only with the Broker API, Is 
> it true ?

No.

> I want to use the ODMG API, is it possiblesomehow to use the Cache
Mechanism with this API ?

yes!


What exactly is your problem?
Thomas

> Thanxs,
> 
> Ronen Yaari
> Traiana Technologies
> 
> 
> 
> -
> 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: Cache Mechanism

2004-01-14 Thread Ronen Yaari

My problem is that when working with the ODMG API with cache definition I spoted that 
when making the same call twice it in both cases goes to the database in order to 
fetch the data.

To ensure it: before making the second call I deleted the relveant row from the 
database and it did not succed to do it afterward altough it should have been in the 
cache.

The same scenario worked smoothly with the Broker API.

Am I doing something wrong ?

Ronen.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 13, 2004 9:50 PM
To: OJB Users List
Subject: Re: Cache Mechanism


Hi Ronen,

Ronen Yaari wrote:
> All,
> 
> I noticed that the Cache Mechanism works only with the Broker API, Is it true ?

No.

> I want to use the ODMG API, is it possiblesomehow to use the Cache Mechanism 
> with this API ?

yes!


What exactly is your problem?
Thomas

> Thanxs,
> 
> Ronen Yaari
> Traiana Technologies
> 
> 
> 
> -
> 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]