Inheritance problem(migrate from 1.0.3 to 1.0.4)

2006-10-15 Thread Ohara Su

Hi

I read http://db.apache.org/ojb/docu/guides/advanced-technique.html
and I use Mapping Inheritance Hierarchies/Table Per Subclass via Foreign
Key.
My java class are list below.
When I call PB API to store DriverDownloadLog, I got errors in ojb 1.0.4

[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] ERROR:
* SQLException during execution of sql-statement:
* sql statement was 'INSERT INTO DriverDownloadLog
(id,fileTile,fileName,fileSize,driverID,UserActionLogID) VALUES
(?,?,?,?,?,?) '
* Exception message is [ORA-02291: integrity constraint (
SVTS.DRIVERDOWNLOADLOG_FK_1) violated - parent key not found
]
* Vendor error code [2291]
* SQL state code [23000=INTEGRITY CONSTRAINT VIOLATION]
* Target class is 'com.via.sv.domain.DriverDownloadLog'
* PK of the target object is [id=520]
* Source object: [EMAIL PROTECTED]
* The root stack trace is -->
* java.sql.SQLException: ORA-02291: integrity constraint (
SVTS.DRIVERDOWNLOADLOG_FK_1) violated - parent key not found

and p6spy shows
UPDATE OJB_HL_SEQ SET MAX_KEY='520',GRAB_SIZE='1',VERSION='520' WHERE
TABLENAME = 'SEQ_UserActionLog'  AND VERSION = '519'
UPDATE OJB_HL_SEQ SET MAX_KEY='519',GRAB_SIZE='1',VERSION='519' WHERE
TABLENAME = 'SEQ_UserActionLog'  AND VERSION = '518'
INSERT INTO UserActionLog
(id,machineIP,actionName,actionDate,actionDescription,userAccount) VALUES
('519','127.0.0.1','Download Driver','2006-10-12 17:16:06.875','Download
Driver','creator')
INSERT INTO DriverDownloadLog
(id,fileTile,fileName,fileSize,driverID,UserActionLogID) VALUES ('520','Bug
Report','borg.jpg','258041','80','0')


It seems that child class can not get the parent's key.
but it works fine in ojb 1.0.3
I don't know why there are errors in 1.0.4
Is it a bug for 1.0.4 ?
Or I made something wrong ?



===
/**
* @ojb.class
*   table = "UserActionLog"
*   include-inherited  = "false"
*   determine-extents = "false"
* @ojb.field
*   name = "userAccount"
*   length = "254"
*   jdbc-type = "VARCHAR"
*/
public class UserActionLog implements Serializable {

   /**
* @ojb.field
*  id="1"
*  autoincrement="ojb"
*  jdbc-type="INTEGER"
*   primarykey="true"
*/
   private int id;

   /**
* @ojb.field
*   id = "2"
*   length = "254"
*   jdbc-type = "VARCHAR"
*/
   private String machineIP;

   /**
* @ojb.field
*   id = "3"
*   length = "254"
*   jdbc-type = "VARCHAR"
*/
   private String actionName;

   /**
* @ojb.field
*   id = "4"
*   conversion = "
org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampFieldConversion"

*   jdbc-type = "TIMESTAMP"
*   nullable = "true"
*/
   private Date actionDate;

   /**
* @ojb.field
*   id = "5"
*   length = "254"
*   jdbc-type = "VARCHAR"
*/
   private String actionDescription;

   /**
* @ojb.reference
*   auto-retrieve = "true"
*   foreignkey = "userAccount"
*   auto-update = "link"
*   auto-delete = "none"
*   class-ref = "VIAUser"
*   proxy = "false"
*/
   private VIAUser actor;



/**
* @ojb.class
*   table = "DriverDownloadLog"
*   include-inherited  = "false"
* @ojb.field
*   name = "UserActionLogID"
*   jdbc-type = "INTEGER"
* @ojb.reference class-ref="UserActionLog"
*  auto-retrieve="true"
*   auto-update="object"
*   auto-delete="object"
*   foreignkey="UserActionLogID"
*/
public class DriverDownloadLog extends UserActionLog {

   /**
* @ojb.field
*  id="1"
*  autoincrement="ojb"
*  jdbc-type="INTEGER"
*   primarykey="true"
*/
   private int id;

   /**
* @ojb.field
*   id = "2"
*   length = "254"
*   jdbc-type = "VARCHAR"
*/
   private String fileTile;

   /**
* @ojb.field
*   id = "3"
*   length = "254"
*   jdbc-type = "VARCHAR"
*/
   private String fileName;

   /**
* @ojb.field
*  id="4"
*  jdbc-type="BIGINT"
*/
   private long fileSize;

   /**
* @ojb.field
*  id="5"
*  jdbc-type="INTEGER"
*  nullable = "false"
*/
   private int driverID;

   DriverDownloadLog downloadLog = new DriverDownloadLog();
   downloadLog.setActor(viaUser);
   downloadLog.setMachineIP(ip);
   downloadLog.setActionDate(new java.util.Date());
   downloadLog.setActionDescription("Download Driver");
   downloadLog.setActionName("Download Driver");
   downloadLog.setFileTile(fileTitle);
   downloadLog.setFileName(fileName);
   downloadLog.setFileSize(fileSize);
   downloadLog.setDriverID(driverID);
   try {
   getPersistenceBrokerTemplate().store(downloadLog);
   } catch (DataAccessException e) {
   logger.error(e);
   throw new DriverManagerException(e);
   }


[Fwd: Inheritance problem(migrate from 1.0.3 to 1.0.4)]

2006-10-12 Thread Armin Waibel



 Original Message 
Subject:Inheritance problem(migrate from 1.0.3 to 1.0.4)
Date:   Thu, 12 Oct 2006 17:47:31 +0800
From:   Ohara Su <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]



Hi

I can not find the way to join mail list.
Please forward it to the mail list.


I read http://db.apache.org/ojb/docu/guides/advanced-technique.html
<http://db.apache.org/ojb/docu/guides/advanced-technique.html>
and I use Mapping Inheritance Hierarchies/Table Per Subclass via Foreign
Key.
My java class are list below.
When I call PB API to store DriverDownloadLog, I got errors in ojb 1.0.4

[org.apache.ojb.broker.accesslayer.JdbcAccessImpl ] ERROR:
* SQLException during execution of sql-statement:
* sql statement was 'INSERT INTO DriverDownloadLog
(id,fileTile,fileName,fileSize,driverID,UserActionLogID) VALUES
(?,?,?,?,?,?) '
* Exception message is [ORA-02291: integrity constraint (
SVTS.DRIVERDOWNLOADLOG_FK_1) violated - parent key not found
]
* Vendor error code [2291]
* SQL state code [23000=INTEGRITY CONSTRAINT VIOLATION]
* Target class is 'com.via.sv.domain.DriverDownloadLog'
* PK of the target object is [id=520]
* Source object: [EMAIL PROTECTED]
* The root stack trace is -->
* java.sql.SQLException: ORA-02291: integrity constraint
(SVTS.DRIVERDOWNLOADLOG_FK_1) violated - parent key not found

and p6spy shows
UPDATE OJB_HL_SEQ SET MAX_KEY='520',GRAB_SIZE='1',VERSION='520' WHERE
TABLENAME = 'SEQ_UserActionLog'  AND VERSION = '519'
UPDATE OJB_HL_SEQ SET MAX_KEY='519',GRAB_SIZE='1',VERSION='519' WHERE
TABLENAME = 'SEQ_UserActionLog'  AND VERSION = '518'
INSERT INTO UserActionLog
(id,machineIP,actionName,actionDate,actionDescription,userAccount)
VALUES ('519','127.0.0.1 <http://127.0.0.1>','Download
Driver','2006-10-12 17:16:06.875','Download Driver','creator')
INSERT INTO DriverDownloadLog
(id,fileTile,fileName,fileSize,driverID,UserActionLogID) VALUES
('520','Bug Report','borg.jpg','258041','80','0')


It seems that child class can not get the parent's key.
but it works fine in ojb 1.0.3
I don't know why there are errors in 1.0.4
Is it a bug for 1.0.4 ?
Or I made something wrong ?



===
/**
 * @ojb.class
 *   table = "UserActionLog"
 *   include-inherited  = "false"
 *   determine-extents = "false"
 * @ojb.field
 *   name = "userAccount"
 *   length = "254"
 *   jdbc-type = "VARCHAR"
 */
public class UserActionLog implements Serializable {

/**
 * @ojb.field
 *  id="1"
 *  autoincrement="ojb"
 *  jdbc-type="INTEGER"
 *   primarykey="true"
 */
private int id;

/**
 * @ojb.field
 *   id = "2"
 *   length = "254"
 *   jdbc-type = "VARCHAR"
 */
private String machineIP;

/**
 * @ojb.field
 *   id = "3"
 *   length = "254"
 *   jdbc-type = "VARCHAR"
 */
private String actionName;

/**
 * @ojb.field
 *   id = "4"
 *   conversion =
"org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampFieldConversion 



"
 *   jdbc-type = "TIMESTAMP"
 *   nullable = "true"
 */
private Date actionDate;

/**
 * @ojb.field
 *   id = "5"
 *   length = "254"
 *   jdbc-type = "VARCHAR"
 */
private String actionDescription;

/**
 * @ojb.reference
 *   auto-retrieve = "true"
 *   foreignkey = "userAccount"
 *   auto-update = "link"
 *   auto-delete = "none"
 *   class-ref = "VIAUser"
 *   proxy = "false"
 */
private VIAUser actor;

 





/**
 * @ojb.class
 *   table = "DriverDownloadLog"
 *   include-inherited  = "false"
 * @ojb.field
 *   name = "UserActionLogID"
 *   jdbc-type = "INTEGER"
 * @ojb.reference class-ref="UserActionLog"
 *  auto-retrieve="true"
 *   auto-update="object"
 *   auto-delete="object"
 *   foreignkey="UserActionLogID"
 */
public class DriverDownloadLog extends UserActionLog {

/**
 * @ojb.field
 *  id="1"
 *  autoincrement="ojb"
 *  jdbc-type="INTEGER"
 *   primarykey="true"
 */
private int id;

/**
 * @ojb.field
 *   id = "2"
 *   length = "254"
 *   jdbc-type = &qu

Re: urgent 3 level Inheritance problem

2005-03-22 Thread Armin Waibel
Armin Waibel wrote:
Hi Ziv,
it's a known issue that odmg-api does not support "mapping classes on 
multiple joined tables" (see release notes).
I will add some improvements to odmg-api today (hope so ;-)) which seems 
to solve the problems with inheritance (expect the one that is known in 
PB-api).

checked in the changes in OJB_1_0_RELEASE branch. Inheritance based on 
"mapping classes on multiple joined tables" is now working with the 
odmg-api (expect the known issue in PB-api - see release-notes).

Armin

regards,
Armin
Ziv Yankowitz wrote:
Thanks for the response,
I tried to implement the hashCode and equals and it still doesn't 
work, somehow the beforeImage and the currentImage are working with 
the same instance of the AnonymousPersistentFieldForInheritance object 
in map.

Thanks Ziv
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 22, 2005 2:39 PM
To: OJB Users List
Subject: Re: urgent 3 level Inheritance problem
Ziv Yankowitz wrote:
is it possible to configure OJB not to store the references in a Map.

Without going into your detailed question; I think you should be able 
to work around any problems by implementing equals and hashCode in 
your beans such that .equals() or 
.eqauls() etc never returns true.

Regards,
  Martin
-
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: urgent 3 level Inheritance problem

2005-03-22 Thread Armin Waibel

Ziv Yankowitz wrote:
one last question then,
if in AnonymousPersistentField i comment the putToFieldCache every thing seems 
to be working well, would you recommend I do it.
If all your tests pass ... try it. But I recommend to write tests to 
verify your improvement (as starting point you can use the test in the 
OJB test-suite ...odmg.InheritanceMultipleTableTest). Your changes will 
cause problems when you serialize the object, in this I assume case all 
anonymous field info is lost.

Armin
since we have also stress our application and it seems that the RefernceMap is 
not cleared leading to OutOfMemory in the end.
Thanks A Lot Ziv.

-Original Message-
From: Armin Waibel [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 22, 2005 3:32 PM
To: OJB Users List
Subject: Re: urgent 3 level Inheritance problem
Ziv Yankowitz wrote:
Hi Armin,
so is there a way to avoid the caching of references even in the cost of 
performance?

think this is not possible, because the caching of the references is the 
character of the anonymous fields.

Armin

Thanks Ziv.
-Original Message-
From: Armin Waibel [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 22, 2005 3:19 PM
To: OJB Users List
Subject: Re: urgent 3 level Inheritance problem
Hi Ziv,
it's a known issue that odmg-api does not support "mapping classes on 
multiple joined tables" (see release notes).
I will add some improvements to odmg-api today (hope so ;-)) which seems 
to solve the problems with inheritance (expect the one that is known in 
PB-api).

regards,
Armin
Ziv Yankowitz wrote:

Thanks for the response,
I tried to implement the hashCode and equals and it still doesn't work, somehow 
the beforeImage and the currentImage are working with the same instance of the 
AnonymousPersistentFieldForInheritance object in map.
Thanks Ziv
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 22, 2005 2:39 PM
To: OJB Users List
Subject: Re: urgent 3 level Inheritance problem
Ziv Yankowitz wrote:

is it possible to configure OJB not to store the references in a Map.

Without going into your detailed question; I think you should be able to 
work around any problems by implementing equals and hashCode in your 
beans such that .equals() or .eqauls() etc never returns true.

Regards,
Martin
-
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]

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


RE: urgent 3 level Inheritance problem

2005-03-22 Thread Ziv Yankowitz
one last question then,

if in AnonymousPersistentField i comment the putToFieldCache every thing seems 
to be working well, would you recommend I do it.

since we have also stress our application and it seems that the RefernceMap is 
not cleared leading to OutOfMemory in the end.

Thanks A Lot Ziv.



-Original Message-
From: Armin Waibel [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 22, 2005 3:32 PM
To: OJB Users List
Subject: Re: urgent 3 level Inheritance problem


Ziv Yankowitz wrote:
> Hi Armin,
> 
> so is there a way to avoid the caching of references even in the cost of 
> performance?
>

think this is not possible, because the caching of the references is the 
character of the anonymous fields.

Armin


> Thanks Ziv.
> 
> -Original Message-
> From: Armin Waibel [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 22, 2005 3:19 PM
> To: OJB Users List
> Subject: Re: urgent 3 level Inheritance problem
> 
> 
> Hi Ziv,
> 
> it's a known issue that odmg-api does not support "mapping classes on 
> multiple joined tables" (see release notes).
> I will add some improvements to odmg-api today (hope so ;-)) which seems 
> to solve the problems with inheritance (expect the one that is known in 
> PB-api).
> 
> regards,
> Armin
> 
> 
> Ziv Yankowitz wrote:
> 
>>Thanks for the response,
>>
>>I tried to implement the hashCode and equals and it still doesn't work, 
>>somehow the beforeImage and the currentImage are working with the same 
>>instance of the AnonymousPersistentFieldForInheritance object in map.
>>
>>Thanks Ziv
>>
>>-Original Message-----
>>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>>Sent: Tuesday, March 22, 2005 2:39 PM
>>To: OJB Users List
>>Subject: Re: urgent 3 level Inheritance problem
>>
>>
>>Ziv Yankowitz wrote:
>>
>>
>>>is it possible to configure OJB not to store the references in a Map.
>>
>>
>>Without going into your detailed question; I think you should be able to 
>>work around any problems by implementing equals and hashCode in your 
>>beans such that .equals() or >A>.eqauls() etc never returns true.
>>
>>Regards,
>>  Martin
>>
>>-
>>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: urgent 3 level Inheritance problem

2005-03-22 Thread Armin Waibel
Ziv Yankowitz wrote:
Hi Armin,
so is there a way to avoid the caching of references even in the cost of 
performance?
think this is not possible, because the caching of the references is the 
character of the anonymous fields.

Armin

Thanks Ziv.
-Original Message-
From: Armin Waibel [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 22, 2005 3:19 PM
To: OJB Users List
Subject: Re: urgent 3 level Inheritance problem
Hi Ziv,
it's a known issue that odmg-api does not support "mapping classes on 
multiple joined tables" (see release notes).
I will add some improvements to odmg-api today (hope so ;-)) which seems 
to solve the problems with inheritance (expect the one that is known in 
PB-api).

regards,
Armin
Ziv Yankowitz wrote:
Thanks for the response,
I tried to implement the hashCode and equals and it still doesn't work, somehow 
the beforeImage and the currentImage are working with the same instance of the 
AnonymousPersistentFieldForInheritance object in map.
Thanks Ziv
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 22, 2005 2:39 PM
To: OJB Users List
Subject: Re: urgent 3 level Inheritance problem
Ziv Yankowitz wrote:

is it possible to configure OJB not to store the references in a Map.

Without going into your detailed question; I think you should be able to 
work around any problems by implementing equals and hashCode in your 
beans such that .equals() or .eqauls() etc never returns true.

Regards,
 Martin
-
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: urgent 3 level Inheritance problem

2005-03-22 Thread Ziv Yankowitz
Hi Armin,

so is there a way to avoid the caching of references even in the cost of 
performance?

Thanks Ziv.

-Original Message-
From: Armin Waibel [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 22, 2005 3:19 PM
To: OJB Users List
Subject: Re: urgent 3 level Inheritance problem


Hi Ziv,

it's a known issue that odmg-api does not support "mapping classes on 
multiple joined tables" (see release notes).
I will add some improvements to odmg-api today (hope so ;-)) which seems 
to solve the problems with inheritance (expect the one that is known in 
PB-api).

regards,
Armin


Ziv Yankowitz wrote:
> Thanks for the response,
> 
> I tried to implement the hashCode and equals and it still doesn't work, 
> somehow the beforeImage and the currentImage are working with the same 
> instance of the AnonymousPersistentFieldForInheritance object in map.
> 
> Thanks Ziv
> 
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 22, 2005 2:39 PM
> To: OJB Users List
> Subject: Re: urgent 3 level Inheritance problem
> 
> 
> Ziv Yankowitz wrote:
> 
>>is it possible to configure OJB not to store the references in a Map.
> 
> 
> Without going into your detailed question; I think you should be able to 
> work around any problems by implementing equals and hashCode in your 
> beans such that .equals() or  A>.eqauls() etc never returns true.
> 
> Regards,
>   Martin
> 
> -
> 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: urgent 3 level Inheritance problem

2005-03-22 Thread Armin Waibel
Hi Ziv,
it's a known issue that odmg-api does not support "mapping classes on 
multiple joined tables" (see release notes).
I will add some improvements to odmg-api today (hope so ;-)) which seems 
to solve the problems with inheritance (expect the one that is known in 
PB-api).

regards,
Armin
Ziv Yankowitz wrote:
Thanks for the response,
I tried to implement the hashCode and equals and it still doesn't work, somehow 
the beforeImage and the currentImage are working with the same instance of the 
AnonymousPersistentFieldForInheritance object in map.
Thanks Ziv
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 22, 2005 2:39 PM
To: OJB Users List
Subject: Re: urgent 3 level Inheritance problem
Ziv Yankowitz wrote:
is it possible to configure OJB not to store the references in a Map.

Without going into your detailed question; I think you should be able to 
work around any problems by implementing equals and hashCode in your 
beans such that .equals() or .eqauls() etc never returns true.

Regards,
  Martin
-
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: urgent 3 level Inheritance problem

2005-03-22 Thread Martin Kalén
Ziv Yankowitz wrote:
I tried to implement the hashCode and equals and it still doesn't work, somehow the beforeImage and the currentImage are working with the same instance of the AnonymousPersistentFieldForInheritance object in map.
Silly me. Since your beans are not the objects stored in the Map, your 
definition of equals() does not matter. Sorry to give you false hope. ;)

I hope that Jakob or others can help you with some details re the OJB 
implementation in that area.

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


RE: urgent 3 level Inheritance problem

2005-03-22 Thread Ziv Yankowitz
Thanks for the response,

I tried to implement the hashCode and equals and it still doesn't work, somehow 
the beforeImage and the currentImage are working with the same instance of the 
AnonymousPersistentFieldForInheritance object in map.

Thanks Ziv

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 22, 2005 2:39 PM
To: OJB Users List
Subject: Re: urgent 3 level Inheritance problem


Ziv Yankowitz wrote:
> is it possible to configure OJB not to store the references in a Map.

Without going into your detailed question; I think you should be able to 
work around any problems by implementing equals and hashCode in your 
beans such that .equals() or .eqauls() etc never returns true.

Regards,
  Martin

-
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: urgent 3 level Inheritance problem

2005-03-22 Thread Martin Kalén
Ziv Yankowitz wrote:
is it possible to configure OJB not to store the references in a Map.
Without going into your detailed question; I think you should be able to 
work around any problems by implementing equals and hashCode in your 
beans such that .equals() or .eqauls() etc never returns true.

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


urgent 3 level Inheritance problem

2005-03-22 Thread Ziv Yankowitz
Hi All,

we have class A, Class B extends A and has a "super" reference-descriptor to A, 
Class C extends B and has a "super" reference-descriptor to B
when we retrieve an instance of C and update a field which is part of A class 
it doesn't work.

I debugged OJB source and found out this happens because the 
AnonymousPersistentFieldForInheritance stores the references objects (like B 
and A) in a Map leading that The currentImage and the beforeImage in 
ObjectEnvlope are the same.

is it possible to configure OJB not to store the references in a Map.

Thanks Ziv.




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



Re: Inheritance problem with association...

2005-02-02 Thread Thomas Dudziak
I think that when you map inheritance to multiple tables, and use a
native (database) sequence manager for generating the ids, you have to
make sure yourself that the entries in the different tables get the
same primarykey. If you use a app-space sequence manager (nextval for
example), then OJB should do this for you.
I'm sorry that I can't help you more, but my experience with mapping
using super-references is limited, and in an EJB environment even
more. You could search the user mailing list archives for application
server and sequence manager or mapping to multiple tables.

Tom

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



Re: Inheritance problem with association...

2005-02-02 Thread Wesley Lemke
I have dug into the OJB code a little bit.  I'm looking in this method
of org.apache.ojb.broker.Identity:

private void init(Object objectToIdentify, PersistenceBroker
targetBroker, ClassDescriptor cld)

It looks like the child class (ClientPayrollDeductionPlan) is getting
an id (lets say id=1), and then the parent class
(PayrollDeductionClass) is getting the next id (id=2).  The associated
classes (PayPlanAssociation) are using the first id (id=1) for their
foreign key.  However when the parent class gets stored in the
database, both it and the child have the second id (id=2), but all of
the associated classes have the foreign key equal to the first one
(1).

I hope that made sense.

Shouldn't the Parent class, and the child class both have the same id?
 (They do when they get inserted, but not when the associated class is
getting it's foreign keys assigned).

Am I looking in the right area?  Is there anything else I should be looking at?

On Tue, 1 Feb 2005 09:59:17 -0600, Wesley Lemke <[EMAIL PROTECTED]> wrote:
> We have a a problem with OJB assigning incorrect id's.  This is the situation:
> 
> public class PayrollDeductionPlan {
> Long id;
> String genericInfo = "Generic";
> // List of PayPlanAssociations
> List assocs = new ArrayList();
> }
> 
> public class ClientPayrollDeductionPlan extends PayrollDeductionPlan {
> Long id;
> String clientInfo = "Client";
> }
> 
> public class PayPlanAssociation {
> Long id;
> // Reference to PayRollDeductionPlan
> PayrollDeductionPlan plan;
> }
> 
> Here is the repository.xml file:
> 
>class="model.PayrollDeductionPlan"
>   table="dexa810t"
>>
> name="id"
>  column="a_id"
>  jdbc-type="BIGINT"
>  primarykey="true"
>  autoincrement="true"
>   />
>name="genericInfo"
> column="generic_info"
> jdbc-type="VARCHAR"
>   />
>   name="assocs"
> element-class-ref="model.PayPlanAssociation"
> auto-delete="true"
> auto-update="true"
>   >
> 
>   
> 
> 
>  class="model.ClientPayrollDeductionPlan"
> table="dexa820t"
> >
>  name="id"
> column="b_id"
> jdbc-type="BIGINT"
> primarykey="true"
> autoincrement="true"
> />
>  name="clientInfo"
> column="client_info"
> jdbc-type="VARCHAR"
> />
>  class-ref="model.PayrollDeductionPlan"
> auto-retrieve="true"
> auto-update="true"
> auto-delete="true"
> >
> 
> 
> 
> 
>  class="model.PayPlanAssociation"
> table="dexa830t"
> >
>  name="id"
> column="d_id"
> jdbc-type="BIGINT"
> primarykey="true"
> autoincrement="true"
> />
> name="plan"
>  column="a_id"
>  jdbc-type="BIGINT"
>  access="anonymous"
>   />
>class-ref="model.PayrollDeductionPlan">
> 
>   
> 
> 
> When I do something like this:
> 
> PersistenceBroker broker =
> PersistenceBrokerFactory.createPersistenceBroker("default", user,
> password);
> 
> broker.beginTransaction();
> // Create new ClientPayrollDeductionPlan
> ClientPayrollDeductionPlan plan = new ClientPayrollDeductionPlan();
> // Add 5 PayPlanAssociations to this PayrollDeductionPlan
> for(int i = 0; i < 5; i++){
> // Create new PayPlanAssociation
> PayPlanAssociation ppa = new PayPlanAssociation();
> // Create link between PayPlanAssociation and PayrollDeductionPlan
> plan.getAssocs().add(ppa);
> ppa.setPlan(plan);
> }
> broker.store(plan);
> broker.commitTransaction();
> broker.close();
> 
> This is what I get in the tables:
> 
> mysql> select * from dexa810t;  (PayrollDeductionPlan)
> +--+--+
> | a_id | generic_info |
> +--+--+
> |   -3 | Generic  |
> +--+--+
> 1 row in set (0.05 sec)
> 
> mysql> select * from dexa820t;  (ClientPayrollDeductionPlan);
> +--+-+
> | b_id | client_info |
> +--+-+
> |   -3 | Client  |
> +--+-+
> 1 row in set (0.00 sec)
> 
> mysql> select * from dexa830t;   (PayPlanAssociation)
> +--+--+
> | d_id | a_id |
> +--+--+
> |   -4 |   -2 |
> |   -5 |   -2 |
> |   -6 |   -2 |
> |   -7 |   -2 |
> |   -8 |   -2 |
> +--+--+
> 5 rows in set (0.03 sec)
> 
> The foreign key in the PayPlanAssociation table is always one off from
> what it should be... (-2 instead of -3).  This problem happens in both
> MySQL and DB2.
> 
> Am I doing something wrong?
>

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

Re: Inheritance problem with association...

2005-02-02 Thread Wesley Lemke
I set access="readonly" for all of the primary keys.  When I do this
(or when I try the NextVal generatory) I get the following error:

[2/2/05 8:33:01:029 CST] 41d6e20b SystemOut O
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:INSERT INTO dexa810t (generic_info) VALUES (?)
[2/2/05 8:33:01:179 CST] 41d6e20b SystemOut O
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:INSERT INTO dexa830t (a_id) VALUES (?)
[2/2/05 8:33:02:981 CST] 41d6e20b LocalTransact E WLTC0033E: Resource
jdbc/AffinityDS rolled back in cleanup of unresolved
LocalTransactionContainment.
[2/2/05 8:33:03:021 CST] 41d6e20b LocalTransact E WLTC0032E: One or
more resources rolled back. An unresolved LocalTransactionContainment
had an unresolved action of rollback.
[2/2/05 8:33:03:031 CST] 41d6e20b WebAppTransac E SRVE0183E:
LocalTransaction rolled-back due to setRollbackOnly
[2/2/05 8:33:03:662 CST] 41d6e20b WebGroup  E SRVE0026E: [Servlet
Error]-[LocalTransaction rolled-back due to setRollbackOnly]:
com.ibm.ws.LocalTransaction.RolledbackException
at 
com.ibm.ws.LocalTransaction.LocalTranCoordImpl.cleanup(LocalTranCoordImpl.java:967)
at 
com.ibm.ws.webcontainer.webapp.WebAppTransactionCollaborator.postInvoke(WebAppTransactionCollaborator.java:208)
at 
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:673)
at 
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:176)
at 
com.ibm.ws.webcontainer.servlet.InvokerServlet.service(InvokerServlet.java:255)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at 
com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at 
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at 
com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at 
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at 
com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at 
com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at 
com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at 
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:948)
at 
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:530)
at 
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:176)
at 
com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
at 
com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:201)
at 
com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at 
com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at 
com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at 
com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at 
com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:610)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:431)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)

[2/2/05 8:33:03:833 CST] 41d6e20b OSEListenerDi E PLGN0021E: Servlet
Request Processor Exception: Virtual Host/WebGroup Not Found : The web
group /favicon.ico has not been defined



On Wed, 2 Feb 2005 14:07:52 +0100, Thomas Dudziak <[EMAIL PROTECTED]> wrote:
> If you're using a native, i.e. database key generator, then you should
> set the access attribute of the primarykey field descriptor to
> readonly so that OJB does not try to change the value there.
> Have you tried one of OJB's key generator, e.g. NextVal ?
> 
> Tom
>

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



Re: Inheritance problem with association...

2005-02-02 Thread Thomas Dudziak
If you're using a native, i.e. database key generator, then you should
set the access attribute of the primarykey field descriptor to
readonly so that OJB does not try to change the value there.
Have you tried one of OJB's key generator, e.g. NextVal ?

Tom

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



Re: Inheritance problem with association...

2005-02-02 Thread Thomas Dudziak
What sequence manager do you use, i.e. who is creating the primary keys ?

Tom

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



Inheritance problem with association...

2005-02-01 Thread Wesley Lemke
We have a a problem with OJB assigning incorrect id's.  This is the situation:

public class PayrollDeductionPlan {
Long id;
String genericInfo = "Generic";
// List of PayPlanAssociations
List assocs = new ArrayList();
}

public class ClientPayrollDeductionPlan extends PayrollDeductionPlan {
Long id;
String clientInfo = "Client";
}

public class PayPlanAssociation {
Long id;
// Reference to PayRollDeductionPlan
PayrollDeductionPlan plan;
}

Here is the repository.xml file:


  
  
 

  












  
  

  
 


When I do something like this:  

PersistenceBroker broker =
PersistenceBrokerFactory.createPersistenceBroker("default", user,
password);


broker.beginTransaction();  
// Create new ClientPayrollDeductionPlan
ClientPayrollDeductionPlan plan = new ClientPayrollDeductionPlan();
// Add 5 PayPlanAssociations to this PayrollDeductionPlan
for(int i = 0; i < 5; i++){
// Create new PayPlanAssociation
PayPlanAssociation ppa = new PayPlanAssociation();
// Create link between PayPlanAssociation and PayrollDeductionPlan
plan.getAssocs().add(ppa);
ppa.setPlan(plan);
}
broker.store(plan);
broker.commitTransaction();
broker.close();



This is what I get in the tables:  

mysql> select * from dexa810t;  (PayrollDeductionPlan)
+--+--+
| a_id | generic_info |
+--+--+
|   -3 | Generic  |
+--+--+
1 row in set (0.05 sec)

mysql> select * from dexa820t;  (ClientPayrollDeductionPlan);
+--+-+
| b_id | client_info |
+--+-+
|   -3 | Client  |
+--+-+
1 row in set (0.00 sec)

mysql> select * from dexa830t;   (PayPlanAssociation)
+--+--+
| d_id | a_id |
+--+--+
|   -4 |   -2 |
|   -5 |   -2 |
|   -6 |   -2 |
|   -7 |   -2 |
|   -8 |   -2 |
+--+--+
5 rows in set (0.03 sec)


The foreign key in the PayPlanAssociation table is always one off from
what it should be... (-2 instead of -3).  This problem happens in both
MySQL and DB2.

Am I doing something wrong?

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



Re: Re: Simple Inheritance problem with multiple class to one table mapping

2004-11-14 Thread Sylvain Juge
Hi,

Thank for your help, but I think I solved my problem.
I don't know what I was doing wrong, but simply by rewriting by hand the 
Apartment Class, I solved the problem.
Now I works really great, despite sometimes Eclipse seems to go a little crazy, 
so I think I also need to update it (ver 3.0.1).

Thx,
Sylvain.




Sylvain Juge wrote:

>  the XDoclet output is the following
>  In fact now it doesn't process the Apartement.java file, and I don't know 
> why because It used to process the file before. However, even if the file was 
> processed by xdoclet, there was no result in the repository file, like now 
> when it's not processed, that's why I found it weird.
>  [ojbdoclet] Type kdms.core.Room
>  [ojbdoclet] Type kdms.core.NetworkAddress
>  [ojbdoclet] Type kdms.core.AbstractRoom
>  [ojbdoclet] Processed 3 types
>  [ojbdoclet] Processed 3 types
>  Sylvain.

I tried your classes and they worked without problems with a normal OJB 
1.0.1 (I replaced the NetworkAddressVector with a List because I don't 
know about this class, and I added a dummy NetworkAddress as you didn't 
post it):

---

package kdms.core;

import java.util.List;

/**
  * @ojb.class generate-table-info="false"
  * @ojb.field name="abstractroom_id"
  *primarykey="true"
  *autoincrement="database"
  *jdbc-type="INTEGER"
  */
public class AbstractRoom {
 /** @ojb.field   length="50" */
 protected String ojbConcreteClass;
 /** @ojb.field name="number" */
 protected int number;
 /** @ojb.field name="size" */
 protected float size;
 /**
  * @ojb.collection  name="nAddresses"
  *  element-class-ref="kdms.core.NetworkAddress"
  *  foreignkey="abstractroom_id"
  *  auto-update="true"
  *  auto-retrieve="true"
  *  auto-delete="false"
  */
 protected List nAddresses;
}


package kdms.core;

/**
  * @ojb.class table="abstract_rooms"
  * @ojb.field name="apartment_id"
  *jdbc-type="INTEGER"
  * @ojb.index name="room_unique"
  *unique="true"
  *fields="number,apartment_id"
  */
public class Room extends AbstractRoom {
 /** @ojb.field name="capacity" */
 private int capacity;
}


package kdms.core;

/**
  * @ojb.class table="abstract_rooms"
  * @ojb.field name="testField"
  *jdbc-type="INTEGER"
  */
public class Apartment extends AbstractRoom {}


package kdms.core;

/**
  * @ojb.class table="network_address"
  * @ojb.field name="abstractroom_id"
  *primarykey="true"
  *autoincrement="database"
  *jdbc-type="INTEGER"
  */
public class NetworkAddress {}

---

[ojbdoclet] (XDocletMain.start   47  ) Running 
< ojbrepository/> 
[ojbdoclet] Generating ojb repository descriptor 
(build/resources//repository_user.xml)
[ojbdoclet] Type kdms.core.Room
[ojbdoclet] Type kdms.core.NetworkAddress
[ojbdoclet] Type kdms.core.AbstractRoom
[ojbdoclet] Type kdms.core.Apartment
[ojbdoclet] Processed 4 types
[ojbdoclet] Processed 4 types
[ojbdoclet] (XDocletMain.start   47  ) Running 
< torqueschema/> 
[ojbdoclet] Generating torque schema (build/resources//project-schema.xml)
[ojbdoclet] Processed 4 types

---

< !-- file containing the repository descriptions for user-defined types --> 
< !-- Generated by the xdoclet-ojb module --> 

< class-descriptor
 class="kdms.core.AbstractRoom"
 > 
 < extent-class class-ref="kdms.core.Apartment"/> 
 < extent-class class-ref="kdms.core.Room"/> 
< /class-descriptor> 
< class-descriptor
 class="kdms.core.Apartment"
 table="abstract_rooms"
 > 
 < field-descriptor
 name="abstractroom_id"
 column="abstractroom_id"
 jdbc-type="INTEGER"
 primarykey="true"
 autoincrement="true"
 access="anonymous"
 > 
 < /field-descriptor> 
 < field-descriptor
 name="ojbConcreteClass"
 column="ojbConcreteClass"
 jdbc-type="VARCHAR"
 length="50"
 > 
 < /field-descriptor> 
 < field-descriptor
 name="number"
 column="number"
 jdbc-type="INTEGER"
 > 
 < /field-descriptor> 
 < field-descriptor
 name="size"
 column="size"
 jdbc-type="REAL"
 > 
 < /field-descriptor> 
 < field-descriptor
 name="testField"
 column="testField"
 jdbc-type="INTEGER"
 access="anonymous"
 > 
 < /field-descriptor> 
 < collection-descriptor
 name="nAddresses"
 element-class-ref="kdms.core.NetworkAddress"
 auto-retrieve="true"
 auto-update="true"
 auto-delete="false"
 > 
 < inverse-foreignkey field

Re: Simple Inheritance problem with multiple class to one table mapping

2004-11-14 Thread Thomas Dudziak
Sylvain Juge wrote:
the XDoclet output is the following
In fact now it doesn't process the Apartement.java file, and I don't know why 
because It used to process the file before. However, even if the file was 
processed by xdoclet, there was no result in the repository file, like now when 
it's not processed, that's why I found it weird.
[ojbdoclet] Type kdms.core.Room
[ojbdoclet] Type kdms.core.NetworkAddress
[ojbdoclet] Type kdms.core.AbstractRoom
[ojbdoclet] Processed 3 types
[ojbdoclet] Processed 3 types
Sylvain.
I tried your classes and they worked without problems with a normal OJB 
1.0.1 (I replaced the NetworkAddressVector with a List because I don't 
know about this class, and I added a dummy NetworkAddress as you didn't 
post it):

---
package kdms.core;
import java.util.List;
/**
 * @ojb.class generate-table-info="false"
 * @ojb.field name="abstractroom_id"
 *primarykey="true"
 *autoincrement="database"
 *jdbc-type="INTEGER"
 */
public class AbstractRoom {
/** @ojb.field   length="50" */
protected String ojbConcreteClass;
/** @ojb.field name="number" */
protected int number;
/** @ojb.field name="size" */
protected float size;
/**
 * @ojb.collection  name="nAddresses"
 *  element-class-ref="kdms.core.NetworkAddress"
 *  foreignkey="abstractroom_id"
 *  auto-update="true"
 *  auto-retrieve="true"
 *  auto-delete="false"
 */
protected List nAddresses;
}
package kdms.core;
/**
 * @ojb.class table="abstract_rooms"
 * @ojb.field name="apartment_id"
 *jdbc-type="INTEGER"
 * @ojb.index name="room_unique"
 *unique="true"
 *fields="number,apartment_id"
 */
public class Room extends AbstractRoom {
/** @ojb.field name="capacity" */
private int capacity;
}
package kdms.core;
/**
 * @ojb.class table="abstract_rooms"
 * @ojb.field name="testField"
 *jdbc-type="INTEGER"
 */
public class Apartment extends AbstractRoom {}
package kdms.core;
/**
 * @ojb.class table="network_address"
 * @ojb.field name="abstractroom_id"
 *primarykey="true"
 *autoincrement="database"
 *jdbc-type="INTEGER"
 */
public class NetworkAddress {}
---
[ojbdoclet] (XDocletMain.start   47  ) Running 

[ojbdoclet] Generating ojb repository descriptor 
(build/resources//repository_user.xml)
[ojbdoclet] Type kdms.core.Room
[ojbdoclet] Type kdms.core.NetworkAddress
[ojbdoclet] Type kdms.core.AbstractRoom
[ojbdoclet] Type kdms.core.Apartment
[ojbdoclet] Processed 4 types
[ojbdoclet] Processed 4 types
[ojbdoclet] (XDocletMain.start   47  ) Running 

[ojbdoclet] Generating torque schema (build/resources//project-schema.xml)
[ojbdoclet] Processed 4 types

---














































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


Re: Re: Simple Inheritance problem with multiple class to one table mapping

2004-11-11 Thread Sylvain Juge
the XDoclet output is the following
In fact now it doesn't process the Apartement.java file, and I don't know why 
because It used to process the file before. However, even if the file was 
processed by xdoclet, there was no result in the repository file, like now when 
it's not processed, that's why I found it weird.
[ojbdoclet] Type kdms.core.Room
[ojbdoclet] Type kdms.core.NetworkAddress
[ojbdoclet] Type kdms.core.AbstractRoom
[ojbdoclet] Processed 3 types
[ojbdoclet] Processed 3 types
Sylvain.




Sylvain Juge wrote:

> Here is the XDoclet schema output (repository_user.xml)
> I removed all irrelevant data to keep it clear.
>   
> 
Ahem, I meant the console output when running Ant. The XDoclet module 
should write out all classes that it processes.

Tom


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


.


Re: Simple Inheritance problem with multiple class to one table mapping

2004-11-11 Thread Thomas Dudziak
Sylvain Juge wrote:
Here is the XDoclet schema output (repository_user.xml)
I removed all irrelevant data to keep it clear.
 

Ahem, I meant the console output when running Ant. The XDoclet module 
should write out all classes that it processes.

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


Re: Re: Simple Inheritance problem with multiple class to one table mapping

2004-11-11 Thread Sylvain Juge
Here is the XDoclet schema output (repository_user.xml)
I removed all irrelevant data to keep it clear.






























Sylvain Juge wrote:

>  Hi, I'm quite newbie to OJB, and I really need help.
> 
> I've got one base class "AbstractRoom" and two derived classes "Room"
> and "Apartement", and I need to store them in one table named
> "abstract_rooms".
> 
> The problem is that when I generate repository schema for the
> database, it's like if the Apartement class is dropped (even if
> Xdoclet process the source file), because it is not present in the
> resulting repository file, thus absent of AbstractRoom extends.
> Despite abstract_rooms table contains all columns from Rooms class,
> there is no one from Apartement.
> It seems that my class "Apartement" is not seen by XDoclet as a
> persitence capable class, or simply "forget" my class and I wonder
> what Am I doing wrong.
>   
> 
Could you post the output of the XDoclet module ? Do you get any 
error/warning messages ?
You can also try running Ant with the -v commandline option to get some 
more output.

Tom


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


.


Re: Simple Inheritance problem with multiple class to one table mapping

2004-11-11 Thread Thomas Dudziak
Sylvain Juge wrote:
Hi, I'm quite newbie to OJB, and I really need help.
I've got one base class "AbstractRoom" and two derived classes "Room"
and "Apartement", and I need to store them in one table named
"abstract_rooms".
The problem is that when I generate repository schema for the
database, it's like if the Apartement class is dropped (even if
Xdoclet process the source file), because it is not present in the
resulting repository file, thus absent of AbstractRoom extends.
Despite abstract_rooms table contains all columns from Rooms class,
there is no one from Apartement.
It seems that my class "Apartement" is not seen by XDoclet as a
persitence capable class, or simply "forget" my class and I wonder
what Am I doing wrong.
 

Could you post the output of the XDoclet module ? Do you get any 
error/warning messages ?
You can also try running Ant with the -v commandline option to get some 
more output.

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


Simple Inheritance problem with multiple class to one table mapping

2004-11-11 Thread Sylvain Juge
 Hi, I'm quite newbie to OJB, and I really need help.

I've got one base class "AbstractRoom" and two derived classes "Room"
and "Apartement", and I need to store them in one table named
"abstract_rooms".

The problem is that when I generate repository schema for the
database, it's like if the Apartement class is dropped (even if
Xdoclet process the source file), because it is not present in the
resulting repository file, thus absent of AbstractRoom extends.
Despite abstract_rooms table contains all columns from Rooms class,
there is no one from Apartement.
It seems that my class "Apartement" is not seen by XDoclet as a
persitence capable class, or simply "forget" my class and I wonder
what Am I doing wrong.

Any help would be appreciated.
Sylvain.

Relevant extract of Source files :

--- Apartement.java ---

/**
* @ojb.class   table="abstract_rooms"
*
* @ojb.field   name="testField"
*  jdbc-type="INTEGER"
*/
public class Apartment extends AbstractRoom {

   public Apartment(){
   super();
   ojbConcreteClass = Apartment.class.getName();
   }

   public Apartment(Apartment apart){
   super(apart);
   ojbConcreteClass = Apartment.class.getName();
   }

   public Apartment(int number, float size){
   super(number,size);
   ojbConcreteClass = Apartment.class.getName();
   }

--- AbstractRoom.java ---

/**
* @author Sylvain
* 16:06:12
* @ojb.class   generate-table-info="false"
*
*  -- doesn't seems to be taken in account event if I use 
determine-extends="false"
* @ojb.extent-class class-ref="kdms.core.Room"
* @ojb.extent-class class-ref="kdms.core.Apartement"
*
* --- Primary Key ---
* @ojb.field   name="abstractroom_id"
*  primarykey="true"
*  autoincrement="database"
*  jdbc-type="INTEGER"
**/

public class AbstractRoom implements StorableObject{

   /** the special attribute telling OJB the object's concrete type.
*  NOTE: this attribute MUST be called ojbConcreteClass
* @ojb.field   length="50"
*/
   protected String ojbConcreteClass;

   /** Room/Apt n°
* @ojb.field name="number"
*/
   protected int number;

   /** Room/Apt size
* @ojb.field name="size"
*/
   protected float size;

   /**
* Network Addresses Collection
* @ojb.collection  name="nAddresses"
*  
element-class-ref="kdms.core.NetworkAddress"
*  foreignkey="abstractroom_id"
*  auto-update="true"
*  auto-retrieve="true"
*  auto-delete="false"
   */
   protected NetworkAddressVector nAddresses;
}

--- Room.java ---

/**
* @author Sylvain
* 13:46:01
*
* --- Class Storage Properties ---
*
* @ojb.class   table="abstract_rooms"
*
*
* --- Foreign Keys ---
*
* @ojb.field   name="apartment_id"
*  jdbc-type="INTEGER"
*
* --- Index ---
*
* @ojb.index name="room_unique"
*unique="true"
*fields="number,apartment_id"
*/

public class Room extends AbstractRoom{

   /** Student Capacity
* @ojb.field name="capacity"
*/
   private int capacity;

   public Room(){
   super();
   ojbConcreteClass = Room.class.getName();
   }

   public Room(int number, int capacity, float size){
   super(number,size);
   ojbConcreteClass = Room.class.getName();
   this.capacity = capacity;
   }

   public Room(Room r){
   super(r);
   ojbConcreteClass = Room.class.getName();
   this.capacity = r.capacity;
   }

(...)
} 





Sylvain Juge
[EMAIL PROTECTED]


inheritance problem for update and find

2004-09-10 Thread Rajadurai K
hi,
  i have two classes A and B
  B extends A
 i have seperate table .
 if i create B its createing A also.
 similarly i want to update
but if i update B its inserting one record into A ant not updaing B

for find if i try to find B it has to find A also its not finding

what may be the problem

my repository xml is having reference descriptor in B which will refer Class
A
ant auto-update ,auto-delete are set to object. auto-retrieve is set to
true.

can anybody help me

thanks in Advance

with Regards,
Rajadurai


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



Re: Three level inheritance problem - Null data from the mostly nested table

2004-06-16 Thread Mariusz Wojcik
Thanks Armin, now everything is ok. You saved my life :
Dnia Tue, 15 Jun 2004 18:14:51 +0200, Armin Waibel <[EMAIL PROTECTED]> 
napisał:

Hi Mariusz,
did you try latest release (rc7)? Jakob fix a problem with inheritance 
between rc6 and rc7.

regards,
Armin
Mariusz Wójcik wrote:
Hi
I try to realize three level of inheritance in OJB. My Class C extends 
Class B extends Class A each data are stored
in separate tables (Table A, Table B, Table C) . I've implemented it.
Inserts work fine. Inheritance is OK, all data are stored in tables.All 
references are OK.

I have problems with quering objects.
I try to get all C Class object. In each object I can't get access to 
data which are stored in A Table (they are null).
But when I try to list A Class Objects, their data are complete.

I noticed very strange thing.
When I try to list object in this order, both methods works fine 
(Collection returned by method getCClassObject is OK, all object,s data 
are complete):
...

Collection AClassObjects=getAClassObjects(); //getting A Class objects
Collection CClassObjects=getCClassObjects(); //getting C Class objects
...
But my problems start when I try to invoke only one method:
..
Collection CClassObjects=getCClassObjects(); //getting C Class object
..
Object of CClassObjects collection haven't data stored in A table (the 
mostly nested)...

I have to use the other solution... but it doesn't work Please help 
me ...

Best regards
mario
-
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]

--
Używam M2 - innowacyjnego klienta poczty wbudowanego w Operę: 
http://www.opera.com/

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


Re: Three level inheritance problem - Null data from the mostly nested table

2004-06-15 Thread Armin Waibel
Hi Mariusz,
did you try latest release (rc7)? Jakob fix a problem with inheritance 
between rc6 and rc7.

regards,
Armin
Mariusz Wójcik wrote:
Hi
I try to realize three level of inheritance in OJB. My Class C extends 
Class B extends Class A each data are stored
in separate tables (Table A, Table B, Table C) . I've implemented it.
Inserts work fine. Inheritance is OK, all data are stored in tables.All 
references are OK.

I have problems with quering objects.
I try to get all C Class object. In each object I can't get access to 
data which are stored in A Table (they are null).
But when I try to list A Class Objects, their data are complete.

I noticed very strange thing.
When I try to list object in this order, both methods works fine 
(Collection returned by method getCClassObject is OK, all object,s data 
are complete):
...

Collection AClassObjects=getAClassObjects(); //getting A Class objects
Collection CClassObjects=getCClassObjects(); //getting C Class objects
...
But my problems start when I try to invoke only one method:
..
Collection CClassObjects=getCClassObjects(); //getting C Class object
..
Object of CClassObjects collection haven't data stored in A table (the 
mostly nested)...

I have to use the other solution... but it doesn't work Please help 
me ...

Best regards
mario
-
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]


Three level inheritance problem - Null data from the mostly nested table

2004-06-15 Thread Mariusz Wójcik
Hi
I try to realize three level of inheritance in OJB. My Class C extends 
Class B extends Class A each data are stored
in separate tables (Table A, Table B, Table C) . I've implemented it.
Inserts work fine. Inheritance is OK, all data are stored in tables.All 
references are OK.

I have problems with quering objects.
I try to get all C Class object. In each object I can't get access to data 
which are stored in A Table (they are null).
But when I try to list A Class Objects, their data are complete.

I noticed very strange thing.
When I try to list object in this order, both methods works fine 
(Collection returned by method getCClassObject is OK, all object,s data 
are complete):
...

Collection AClassObjects=getAClassObjects(); //getting A Class objects
Collection CClassObjects=getCClassObjects(); //getting C Class objects
...
But my problems start when I try to invoke only one method:
..
Collection CClassObjects=getCClassObjects(); //getting C Class object
..
Object of CClassObjects collection haven't data stored in A table (the 
mostly nested)...

I have to use the other solution... but it doesn't work Please help me 
...

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


Update Inheritance Problem.

2004-02-26 Thread Ziv Yankowitz
Folks,

once more inheritance issue:

we have a problem where updates on super class only, are not persist to the Database.

assuming we have the following classes:

class a{
id PK;
name;
}

class b extends a{

id2 PK;
name2;
}

and we have a super reference descriptor from class a to b as follows :






when updating the name in class a the record in the Table doesn't change 

please HELP what could be the reason ? 



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



RE: Inheritance Problem.

2004-02-25 Thread Thomas Dudziak
On Thu, 26 Feb 2004, Ziv Yankowitz wrote:

> Thanks for the response.
> 
> If I understand correctly there is no way we can map the abstract class to it's own 
> table.

You might want to try the factory-class and factory-method attributes of
the class descriptor. If you use them, OJB will not require a constructor
in the class, and also the class is not required to be instantiable (this
even works with interfaces). In the factory-method you simply return an
instance of a concrete subclass (which shouldn't have its own mapping,
though, otherwise you'll run into problems).
 
Tom


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



RE: Inheritance Problem.

2004-02-25 Thread Ziv Yankowitz
Thanks for the response.

If I understand correctly there is no way we can map the abstract class to it's own 
table.

Thanks again for the response.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 26, 2004 8:52 AM
To: OJB Users List
Subject: Re: Inheritance Problem.






Hello Ziv,

In persisting the parent class OJB has to instantiate it (using log4j you
see the exact position if you set the logging to "DEBUG" in
theOJB.properties). Since this can't be done with an abstract class, the
described error occurs.
Working around the same error we decided to make the abstract class
concrete and have a log entry in the constructor, so we can check it`s
instantiations.
Another way would be to map each implementation to a different table, thus
treating the abstact class like an interface.

Perhaps there should be a warning in tutorial 3 ("Advanced O/R") about this
restriction.

Regards,
Birgitta


Ziv Yankowitz wrote:

Folks,

we need to map an abstract class and it's implementation to two different
tables we tried the following :

> abstract class A {
>
> private id
> private valueA
> protected ojbConcreteClass
> }
>
> class B extends A{
>
> private id2
> private valueB
> }
>
> the repository file:
>
>  class="A"
> table="A_TABLE">
>
>
>  name="id"
> column="ID"
> jdbc-type="INTEGER"
> primarykey="true"
> autoincrement="true"
> />
>  name="valueA"
> column="VALUE"
> jdbc-type="INTEGER"
> />
>
> 
>
>  class="B"
> table="B_TABLE"
> >
>
>  name="id2"
> column="ID"
> jdbc-type="INTEGER"
> primarykey="true"
> autoincrement="true"
> />
>
>
>  name="valueB"
> column="VALUE"
> jdbc-type="INTEGER"
> />
>
> 
>  name="ojbConcreteClass">
>  column="CLASS_NAME">
>  jdbc-type="VARCHAR">
> />
>
>  class-ref="A" auto-update="true">
> 
> 
>
> 
>
we encounter in the following error:
org.apache.ojb.broker.PersistenceBrokerException:
org.apache.ojb.broker.metadata.MetadataException: java.lang.Instantiat
ionException

what are we doing wrong ?


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



Re: Inheritance Problem.

2004-02-25 Thread BIRGITTA . MOEHRING




Hello Ziv,

In persisting the parent class OJB has to instantiate it (using log4j you
see the exact position if you set the logging to "DEBUG" in
theOJB.properties). Since this can't be done with an abstract class, the
described error occurs.
Working around the same error we decided to make the abstract class
concrete and have a log entry in the constructor, so we can check it`s
instantiations.
Another way would be to map each implementation to a different table, thus
treating the abstact class like an interface.

Perhaps there should be a warning in tutorial 3 ("Advanced O/R") about this
restriction.

Regards,
Birgitta


Ziv Yankowitz wrote:

Folks,

we need to map an abstract class and it's implementation to two different
tables we tried the following :

> abstract class A {
>
> private id
> private valueA
> protected ojbConcreteClass
> }
>
> class B extends A{
>
> private id2
> private valueB
> }
>
> the repository file:
>
>  class="A"
> table="A_TABLE">
>
>
>  name="id"
> column="ID"
> jdbc-type="INTEGER"
> primarykey="true"
> autoincrement="true"
> />
>  name="valueA"
> column="VALUE"
> jdbc-type="INTEGER"
> />
>
> 
>
>  class="B"
> table="B_TABLE"
> >
>
>  name="id2"
> column="ID"
> jdbc-type="INTEGER"
> primarykey="true"
> autoincrement="true"
> />
>
>
>  name="valueB"
> column="VALUE"
> jdbc-type="INTEGER"
> />
>
> 
>  name="ojbConcreteClass">
>  column="CLASS_NAME">
>  jdbc-type="VARCHAR">
> />
>
>  class-ref="A" auto-update="true">
> 
> 
>
> 
>
we encounter in the following error:
org.apache.ojb.broker.PersistenceBrokerException:
org.apache.ojb.broker.metadata.MetadataException: java.lang.Instantiat
ionException

what are we doing wrong ?



Inheritance Problem.

2004-02-25 Thread Ziv Yankowitz
Folks, 

we need to map an abstract class and it's implementation to two different tables we 
tried the following :

> abstract class A {
> 
> private id
> private valueA
> protected ojbConcreteClass
> }
> 
> class B extends A{
> 
> private id2
> private valueB
> }
> 
> the repository file:
> 
>  class="A"
> table="A_TABLE">
> 
> 
>  name="id"
> column="ID"
> jdbc-type="INTEGER"
> primarykey="true"
> autoincrement="true"
> />
>  name="valueA"
> column="VALUE"
> jdbc-type="INTEGER"
> />
> 
> 
> 
>  class="B"
> table="B_TABLE"
> >
> 
>  name="id2"
> column="ID"
> jdbc-type="INTEGER"
> primarykey="true"
> autoincrement="true"
> />
> 
> 
>  name="valueB"
> column="VALUE"
> jdbc-type="INTEGER"
> />
> 
>   
>  name="ojbConcreteClass">
>  column="CLASS_NAME">
>  jdbc-type="VARCHAR">
>   />
> 
>  class-ref="A" auto-update="true">
> 
> 
> 
> 
> 
we encounter in the following error:
org.apache.ojb.broker.PersistenceBrokerException: 
org.apache.ojb.broker.metadata.MetadataException: java.lang.Instantiat
ionException

what are we doing wrong ?






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



Re: inheritance problem

2003-12-16 Thread balza
Hello,
I've more ore less the same problem.
The solution should be something like:















or I need "super" reference?

Thanks

> Hi,
>
> I had a similar problem. You may want to have a look at the "Problem mapping
> inheritance hierarchy using joined tables for subclasses" thread on this
> list (last post 2003-12-05) or at the "Extents and the various inheritance
> hierarchy mappings" thread at the dev-list. I do not think, this is fixed in
> rc5. If you want to materialize the sub-class, it needs to be declared as
> extent of the superclass. Yet, it is not possible to use extent defintions
> for joined subclasses if primary keys serve as foreign key in the subclass.
> It may work if you have an additional foreign-key column in your subclass
> (making the primary keys unique).
>
> Peter
>
> > Hi,
> > I'm trying to map inheritance to multiple joined tables, but something is
> > going wrong.
> > It inserts ok, but when loading, it materializes the superclass, instead
> > of subclass.
> > Important:
> > 1) I am NOT using extents;
> > 2) I am not declaring attributes (_id, in this case, which is is primary
> > key and serves also as foreign key) in the subclass in the object model.
> > 3) I have tried the anonymous field approach, but it materializes the
> > superclass too.
>
> > I believe I am facing a configuration mistake, so these are the
> > class-descriptors:
>
> > 
> > 
>
> >   >  primarykey="true" autoincrement="true"/>
> >  
>
> > 
>
> > 
> >  > table="student">
> >   >  primarykey="true" autoincrement="true"/>
>
> >   >  auto-delete="true" name="super"
> >  class-ref="com.jma.interescola.core.User">
> >   
> >  
> > 
>
> > Please, any help or suggestion would be great.
> > If this is a bug, anyone knows if the release rc5 fixed it?
> > Thank you.
>
> 
> -
> 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: inheritance problem

2003-12-16 Thread Peter Wieland
Hi,

I had a similar problem. You may want to have a look at the "Problem mapping
inheritance hierarchy using joined tables for subclasses" thread on this
list (last post 2003-12-05) or at the "Extents and the various inheritance
hierarchy mappings" thread at the dev-list. I do not think, this is fixed in
rc5. If you want to materialize the sub-class, it needs to be declared as
extent of the superclass. Yet, it is not possible to use extent defintions
for joined subclasses if primary keys serve as foreign key in the subclass.
It may work if you have an additional foreign-key column in your subclass
(making the primary keys unique).

Peter

> Hi,
> I'm trying to map inheritance to multiple joined tables, but something is
> going wrong.
> It inserts ok, but when loading, it materializes the superclass, instead
> of subclass.
> Important:
> 1) I am NOT using extents;
> 2) I am not declaring attributes (_id, in this case, which is is primary
> key and serves also as foreign key) in the subclass in the object model.
> 3) I have tried the anonymous field approach, but it materializes the
> superclass too.

> I believe I am facing a configuration mistake, so these are the
> class-descriptors:

> 
> 

>primarykey="true" autoincrement="true"/>
>  

> 

> 
>  table="student">
>primarykey="true" autoincrement="true"/>

>auto-delete="true" name="super"
>  class-ref="com.jma.interescola.core.User">
>   
>  
> 

> Please, any help or suggestion would be great.
> If this is a bug, anyone knows if the release rc5 fixed it?
> Thank you.


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



inheritance problem

2003-12-15 Thread Jair da Silva Ferreira Júnior
Hi,
I'm trying to map inheritance to multiple joined tables, but something is going wrong.
It inserts ok, but when loading, it materializes the superclass, instead of subclass. 
Important:
1) I am NOT using extents; 
2) I am not declaring attributes (_id, in this case, which is is primary key and 
serves also as foreign key) in the subclass in the object model.
3) I have tried the anonymous field approach, but it materializes the superclass too.

I believe I am facing a configuration mistake, so these are the class-descriptors:



 
 
 
 




 
 
  
  
 


Please, any help or suggestion would be great.
If this is a bug, anyone knows if the release rc5 fixed it?
Thank you.

Re: Inheritance problem

2003-10-09 Thread b
Ok, thank you.
When is scheduled the release for OJB RC5?
> hi balza? ,
>
> ojb is not able to find the fields defined in the superclass. this
> problem was fixed some time ago. there are also testcases in
> AnonymousFieldTest that successfully query fields in superclass.
> please get the latest from repository.
>
> hth
> jakob
>
>
> balza wrote:
>
> > Hello,
> > * the class-descriptors:
> > 
> > > jdbc-type="INTEGER" primarykey="true" autoincrement="true"/>
> >
> > > jdbc-type="VARCHAR"/>
> > > jdbc-type="VARCHAR"/>
> > > jdbc-type="VARCHAR"/>
> >
> >
> >
> > > jdbc-type="DATE"/>
> > > column="last_activity_date" jdbc-type="DATE"/>
> > > jdbc-type="DATE"/>
> > 
> >
> > 
> > > jdbc-type="INTEGER" primarykey="true" autoincrement="true"/>
> > > auto-retrieve="true" auto-update="true" auto-delete="true">
> >
> >   
> >
> > public class Account  { public Organization organization;
> >public AccountAddress accountAddress;
> >private int account_id;
> >private String login;
> >private String password;
> >private String first_name;
> >private String last_name;
> >private String gender;
> >private String remark;
> >private String email;
> >private Date registration_date;
> >private Date last_activity_date;
> >private Date date_of_birth;
> >+ setter & getter methods
> >
> > public class Employee extends Account  {
> >private int account_id;  private Account account;
> >+ setter & getter methods
> >
> > * The code:
> > public void apply() {
> >//Query OJB  Criteria crit = new Criteria();
> >logger.debug("login :" + login);
> >logger.debug("password :" + password);
> >crit.addEqualTo("login", login);
> >crit.addEqualTo("password", password);   Query q
> > = QueryFactory.newQuery(Employee.class, crit);   try {
> >Collection results = broker.getCollectionByQuery(q);
> >Iterator it = results.iterator();
> >if (it.hasNext()) {
> >employee = (Employee) it.next();
> >logger.debug("First name " + employee.getFirst_name());
> >}
> >} catch (Throwable t) {
> >t.printStackTrace();
> >}
> >}
> > 
> > * The log
> > 2063 [main] DEBUG allibo.commerce.UCFindEmployeeTest  - employee :1082
> > 2073 [main] INFO  allibo.commerce.UCFindEmployeeTest  - testApply
> > 2073 [main] DEBUG allibo.commerce.UCFindEmployee  - login :employee
> > 2073 [main] DEBUG allibo.commerce.UCFindEmployee  - password :employee
> > [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
> > SQL:SELECT A0.account_id FROM fem_employee A0 WHERE (login =  ? ) AND
> > password =  ?
> > java.sql.SQLException: Column not found,  message from server: "Unknown
> > column 'login' in 'where clause'"
> > [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] ERROR: SQLException
> > during the execution of the query (for a allibo.commerce.Employee):
> > Column not found,  message from server: "Unknown column 'login' in
> > 'where clause'"
> > Column not found,  message from server: "Unknown column 'login' in
> > 'where clause'"
> >at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1626)
> >at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:886)
> >at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:945)
> >at com.mysql.jdbc.Connection.execSQL(Connection.java:1844)
> >at
> > com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1458)
> >at 
> > org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown
> > Source)
> >at org.apache.ojb.broker.accesslayer.RsIterator.(Unknown Source)
> >at
> > org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(Unknown
> > Source)
> >at
> > org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(Unknown
> > Source)
> >at
> > org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Unknown
> > Source)
> >at
> > org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
> > Source)
> >at
> > org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
> > Source)
> >at
> > org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
> > Source)
> >at
> > org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
> > Source)
> >at
> >
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown
> > Source)
> >at
> >
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown
> > Source)
> >at allibo.commerce.UCFindEmployee.apply(UCFindEmployee.java:58)
> >at
> > allibo.commerce.UCFindEmployeeTest.testApply(UCFindEmployeeTest.java:67)
> >at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >at
> > sun.reflect.NativeMethodAccessorImpl.invoke

Re: Inheritance problem

2003-10-09 Thread Jakob Braeuchi
hi balza? ,

ojb is not able to find the fields defined in the superclass. this 
problem was fixed some time ago. there are also testcases in 
AnonymousFieldTest that successfully query fields in superclass.
please get the latest from repository.

hth
jakob
balza wrote:

Hello,
* the class-descriptors:

   
   
   
   
   
   
   
   
   
   
   



   
   
   
  

public class Account  { public Organization organization;
   public AccountAddress accountAddress;
   private int account_id;
   private String login;
   private String password;
   private String first_name;
   private String last_name;
   private String gender;
   private String remark;
   private String email;
   private Date registration_date;
   private Date last_activity_date;
   private Date date_of_birth;
   + setter & getter methods
public class Employee extends Account  {
   private int account_id;  private Account account;
   + setter & getter methods
* The code:
public void apply() {
   //Query OJB  Criteria crit = new Criteria();
   logger.debug("login :" + login);
   logger.debug("password :" + password);
   crit.addEqualTo("login", login);
   crit.addEqualTo("password", password);   Query q 
= QueryFactory.newQuery(Employee.class, crit);   try {
   Collection results = broker.getCollectionByQuery(q);
   Iterator it = results.iterator();
   if (it.hasNext()) {
   employee = (Employee) it.next();
   logger.debug("First name " + employee.getFirst_name());
   }
   } catch (Throwable t) {
   t.printStackTrace();
   }
   }

* The log
2063 [main] DEBUG allibo.commerce.UCFindEmployeeTest  - employee :1082
2073 [main] INFO  allibo.commerce.UCFindEmployeeTest  - testApply
2073 [main] DEBUG allibo.commerce.UCFindEmployee  - login :employee
2073 [main] DEBUG allibo.commerce.UCFindEmployee  - password :employee
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: 
SQL:SELECT A0.account_id FROM fem_employee A0 WHERE (login =  ? ) AND 
password =  ?
java.sql.SQLException: Column not found,  message from server: "Unknown 
column 'login' in 'where clause'"
[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] ERROR: SQLException 
during the execution of the query (for a allibo.commerce.Employee): 
Column not found,  message from server: "Unknown column 'login' in 
'where clause'"
Column not found,  message from server: "Unknown column 'login' in 
'where clause'"
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1626)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:886)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:945)
   at com.mysql.jdbc.Connection.execSQL(Connection.java:1844)
   at 
com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1458)
   at 
org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown 
Source)
   at org.apache.ojb.broker.accesslayer.RsIterator.(Unknown Source)
   at 
org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(Unknown 
Source)
   at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(Unknown 
Source)
   at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Unknown 
Source)
   at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown 
Source)
   at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown 
Source)
   at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown 
Source)
   at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown 
Source)
   at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown 
Source)
   at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown 
Source)
   at allibo.commerce.UCFindEmployee.apply(UCFindEmployee.java:58)
   at 
allibo.commerce.UCFindEmployeeTest.testApply(UCFindEmployeeTest.java:67)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 

   at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 

   at java.lang.reflect.Method.invoke(Method.java:324)
   at junit.framework.TestCase.runTest(TestCase.java:154)
   at junit.framework.TestCase.runBare(TestCase.java:127)
   at junit.framework.TestResult$1.protect(TestResult.java:106)
   at junit.framework.TestResult.runProtected(TestResult.java:124)
   at junit.framework.TestResult.run(TestResult.java:109)
   at junit.framework.TestCase.run(TestCase.java:118)
   at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:392) 

   at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:276) 

   at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:167) 

java.sql.SQLException: Column not fou

Re: Inheritance problem

2003-10-08 Thread balza
Hello,
* the class-descriptors:

   
   
   
   
   
   
   
   
   
   
   



   
   
   
  


public class Account  {  
   public Organization organization;
   public AccountAddress accountAddress;
   private int account_id;
   private String login;
   private String password;
   private String first_name;
   private String last_name;
   private String gender;
   private String remark;
   private String email;
   private Date registration_date;
   private Date last_activity_date;
   private Date date_of_birth;
   + setter & getter methods

public class Employee extends Account  {
   private int account_id;   
   private Account account;
   + setter & getter methods

* The code:
public void apply() {
   //Query OJB   
   Criteria crit = new Criteria();
   logger.debug("login :" + login);
   logger.debug("password :" + password);
   crit.addEqualTo("login", login);
   crit.addEqualTo("password", password);
   Query q = QueryFactory.newQuery(Employee.class, crit);
   try {
   Collection results = broker.getCollectionByQuery(q);
   Iterator it = results.iterator();
   if (it.hasNext()) {
   employee = (Employee) it.next();
   logger.debug("First name " + employee.getFirst_name());
   }
   } catch (Throwable t) {
   t.printStackTrace();
   }
   }

* The log
2063 [main] DEBUG allibo.commerce.UCFindEmployeeTest  - employee :1082
2073 [main] INFO  allibo.commerce.UCFindEmployeeTest  - testApply
2073 [main] DEBUG allibo.commerce.UCFindEmployee  - login :employee
2073 [main] DEBUG allibo.commerce.UCFindEmployee  - password :employee
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: 
SQL:SELECT A0.account_id FROM fem_employee A0 WHERE (login =  ? ) AND 
password =  ?
java.sql.SQLException: Column not found,  message from server: "Unknown 
column 'login' in 'where clause'"
[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] ERROR: SQLException 
during the execution of the query (for a allibo.commerce.Employee): 
Column not found,  message from server: "Unknown column 'login' in 
'where clause'"
Column not found,  message from server: "Unknown column 'login' in 
'where clause'"
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1626)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:886)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:945)
   at com.mysql.jdbc.Connection.execSQL(Connection.java:1844)
   at 
com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1458)
   at 
org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown 
Source)
   at org.apache.ojb.broker.accesslayer.RsIterator.(Unknown Source)
   at 
org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(Unknown 
Source)
   at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(Unknown 
Source)
   at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Unknown 
Source)
   at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown 
Source)
   at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown 
Source)
   at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown 
Source)
   at 
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown 
Source)
   at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown 
Source)
   at 
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown 
Source)
   at allibo.commerce.UCFindEmployee.apply(UCFindEmployee.java:58)
   at 
allibo.commerce.UCFindEmployeeTest.testApply(UCFindEmployeeTest.java:67)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:324)
   at junit.framework.TestCase.runTest(TestCase.java:154)
   at junit.framework.TestCase.runBare(TestCase.java:127)
   at junit.framework.TestResult$1.protect(TestResult.java:106)
   at junit.framework.TestResult.runProtected(TestResult.java:124)
   at junit.framework.TestResult.run(TestResult.java:109)
   at junit.framework.TestCase.run(TestCase.java:118)
   at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:392)
   at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:276)
   at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:167)
java.sql.SQLException: Column not found,  message from server: "Unknown 
column 'login' in 'where clause'"
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1626)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:886)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:945)
   at com.mysql.jdb

Re: Inheritance problem

2003-10-08 Thread Jakob Braeuchi
hi,

could you please post the sql used to search and the class-descriptors ?

jakob

balza wrote:

Hello,
I've
- table tA and tB with an inheritance relationship
- class B extending A
- class A reflect tA
- class B reflect tB
insert in class B generate an entry in table tA and in table tB
delete or search on table tB generate a "java.sql.SQLException: Column 
not found,  message from server: "Unknown column 'xxx' in 'where clause'""

What's wrong?

Thank you





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


Inheritance problem

2003-10-07 Thread balza
Hello,
I've
- table tA and tB with an inheritance relationship
- class B extending A
- class A reflect tA
- class B reflect tB
insert in class B generate an entry in table tA and in table tB
delete or search on table tB generate a "java.sql.SQLException: Column 
not found,  message from server: "Unknown column 'xxx' in 'where clause'""

What's wrong?

Thank you





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


Re: JDO inheritance problem

2003-08-21 Thread Cédric Pineau
On Thu, 21 Aug 2003 08:54:07 -0500
Ketan Gangatirkar <[EMAIL PROTECTED]> wrote:

> persistence-capable-superclass="A"


 That's what I was missing !
 Thank you !


 I went a little further and ...  got another (smaller, I think) problem
:

java.lang.ClassCastException
at org.apache.ojb.jdori.sql.OjbExtent.(Unknown Source)
at org.apache.ojb.jdori.sql.OjbStoreManager.getExtent(Unknown
Source)
at com.sun.jdori.common.PersistenceManagerImpl.getExtent(Unknown
Source)
at com.sun.jdori.common.query.QueryImpl.checkCandidates(Unknown
Source)
at com.sun.jdori.common.query.QueryImpl.execute(Unknown Source)
at UCListAllStatutes.apply(UCListAllStatutes.java:38)
...

 Statue2 get recorded in its own table correctly.
 Statute also

 But I can't list Statute the way I used to :

  manager.currentTransaction().begin();
  Query query = manager.newQuery(Statute.class);
  Collection allStatutes = (Collection)query.execute();

 The last line give me the exception.

 Any idea about that ? 

 Cédric


-- 
Societe Code Lutin
2, rue Robert le Ricolais
BP 20446 44304 NANTES CEDEX 3
Tel 02.40.50.29.28, Fax 02.40.93.99.21
http://www.codelutin.com


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



Re: JDO inheritance problem

2003-08-21 Thread Ketan Gangatirkar
Cédric,

You need to define the attribute persistent-capable-superclass in your 
.jdo file for the sub-class.  So if you have class A extends class B, 
your .jdo file would have:



The JDORI enhancer creates final methods to access the persistent 
attributes of the object.  If it does not know that B is a subclass of 
A, it will define them for both B and A, which will result in the error 
you see.  If A has an attribute z, then you should list it only in the 
 section of A.  Since B is a subclass of A, it will inherit the 
getter/setters that JDORI creates for z.  Only define B's unique 
attributes in the  section for B.  Like so:










Cédric Pineau wrote:

 	Hello,

   I'm trying to use OJB through JDO and have a problem with basic
inheritance between two persitent class :
 I get "
 class entities.Statute2 overrides final method .
 java.lang.VerifyError: class entities.Statute2 overrides final
method .
at java.lang.ClassLoader.defineClass0(Native Method)
... "
 at runtime when the classloader loads the Statute2 class.
 Statute2 inherits from Statute (this actually a test drive :-) Here is
my code :

Statute :
package entities;
public class Statute {
  protected int id;
  public int getId() {
return this.id;
  }
  public void setId(int id) {
this.id = id;
  }

 
  /** default constructor */
  public Statute() {}
  /** full constructor */
  public Statute(java.lang.String name) {
this.name = name;
  }

 
  protected java.lang.String name;
  public java.lang.String getName() {
return this.name;
  }
  public void setName(java.lang.String name) {
this.name = name;
  }

 
  public String toString() {
return "Statute "+this.name+" (id = "+this.id+")";
  }
}


Statute 2 :
package entities;
public class Statute2 extends Statute {
  /** default constructor */
  public Statute2() {}
  /** full constructor */
  public Statute2(java.lang.String name, String name2) {
this.name = name;
this.name2 = name2;
  }

 
  protected java.lang.String name2;
  public java.lang.String getName2() {
return this.name2;
  }
  public void setName2(java.lang.String name2) {
this.name2 = name2;
  }
 
  public String toString() {
return "Statute "+this.name+" "+this.name2+" (id = "+this.id+")";
  }
}

repository_user.xml :

  
  
primarykey="true" autoincrement="true"/>
  


 

  
primarykey="true" autoincrement="true"/>
  
  


entities.jdo (partial) :
...

  
  

  
  

  


  
  

  

...
sql for table creation (postgresql) :
CREATE TABLE STATUTE (
  ID INT PRIMARY KEY,
  NAME TEXT
);

 
CREATE TABLE STATUTE2 (
  ID INT PRIMARY KEY,
  NAME TEXT,
  NAME2 TEXT
);

 I suppose I did something wrong but can't figure what. 
 I already tried to enhance only one of the two, to remove id and name
from Statute2 class-desciptor entry but...

 Can someone light my way to the wonderful world of JDO ?
 Thanks,
 Cédric





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


JDO inheritance problem

2003-08-21 Thread Cédric Pineau


Hello,


   I'm trying to use OJB through JDO and have a problem with basic
inheritance between two persitent class :
 I get "
 class entities.Statute2 overrides final method .
 java.lang.VerifyError: class entities.Statute2 overrides final
method .
at java.lang.ClassLoader.defineClass0(Native Method)
... "
 at runtime when the classloader loads the Statute2 class.

 Statute2 inherits from Statute (this actually a test drive :-) Here is
my code :

>> Statute :
package entities;
public class Statute {
  protected int id;
  public int getId() {
return this.id;
  }
  public void setId(int id) {
this.id = id;
  }

 
  /** default constructor */
  public Statute() {}
  /** full constructor */
  public Statute(java.lang.String name) {
this.name = name;
  }

 
  protected java.lang.String name;
  public java.lang.String getName() {
return this.name;
  }
  public void setName(java.lang.String name) {
this.name = name;
  }

 
  public String toString() {
return "Statute "+this.name+" (id = "+this.id+")";
  }
}

>> Statute 2 :
package entities;
public class Statute2 extends Statute {
  /** default constructor */
  public Statute2() {}
  /** full constructor */
  public Statute2(java.lang.String name, String name2) {
this.name = name;
this.name2 = name2;
  }

 
  protected java.lang.String name2;
  public java.lang.String getName2() {
return this.name2;
  }
  public void setName2(java.lang.String name2) {
this.name2 = name2;
  }
 
  public String toString() {
return "Statute "+this.name+" "+this.name2+" (id = "+this.id+")";
  }
}

repository_user.xml :

  
  
  


 

  
  
  


entities.jdo (partial) :
...

  
  

  
  

  


  
  

  

...

sql for table creation (postgresql) :
CREATE TABLE STATUTE (
  ID INT PRIMARY KEY,
  NAME TEXT
);

 
CREATE TABLE STATUTE2 (
  ID INT PRIMARY KEY,
  NAME TEXT,
  NAME2 TEXT
);


 I suppose I did something wrong but can't figure what. 
 I already tried to enhance only one of the two, to remove id and name
from Statute2 class-desciptor entry but...

 Can someone light my way to the wonderful world of JDO ?
 Thanks,

 Cédric



-- 
Societe Code Lutin
2, rue Robert le Ricolais
BP 20446 44304 NANTES CEDEX 3
Tel 02.40.50.29.28, Fax 02.40.93.99.21
http://www.codelutin.com


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