Inheritance problem(migrate from 1.0.3 to 1.0.4)
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)]
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 = 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
urgent 3 level Inheritance problem
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: 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 instance of A.equals(instance of B) or instance of A.eqauls(instance of C) etc never returns true. Regards, Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: urgent 3 level Inheritance problem
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 instance of A.equals(instance of B) or instance of A.eqauls(instance of C) 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
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
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 instance of A.equals(instance of B) or instance of A.eqauls(instance of C) 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
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 instance of A.equals(instance of B) or instance of A.eqauls(instance of C) 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
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 instance of A.equals(instance of B) or instance of A.eqauls(instance of C) 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
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 instance of A.equals(instance of B) or instance of A.eqauls(instance of C) 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
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 instance of A.equals(instance of B) or instance of A.eqauls(instance of C) 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
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 instance of A.equals(instance of B) or instance of A.eqauls(instance of C) 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: Inheritance problem with association...
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]
Re: Inheritance problem with association...
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-descriptor class=model.PayrollDeductionPlan table=dexa810t field-descriptor name=id column=a_id jdbc-type=BIGINT primarykey=true autoincrement=true / field-descriptor name=genericInfo column=generic_info jdbc-type=VARCHAR / collection-descriptor name=assocs element-class-ref=model.PayPlanAssociation auto-delete=true auto-update=true inverse-foreignkey field-ref=plan / /collection-descriptor /class-descriptor class-descriptor class=model.ClientPayrollDeductionPlan table=dexa820t field-descriptor name=id column=b_id jdbc-type=BIGINT primarykey=true autoincrement=true / field-descriptor name=clientInfo column=client_info jdbc-type=VARCHAR / reference-descriptor name=super class-ref=model.PayrollDeductionPlan auto-retrieve=true auto-update=true auto-delete=true foreignkey field-ref=id/ /reference-descriptor /class-descriptor class-descriptor class=model.PayPlanAssociation table=dexa830t field-descriptor name=id column=d_id jdbc-type=BIGINT primarykey=true autoincrement=true / field-descriptor name=plan column=a_id jdbc-type=BIGINT access=anonymous / reference-descriptor name=plan class-ref=model.PayrollDeductionPlan foreignkey field-ref=plan/ /reference-descriptor /class-descriptor 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
Re: Inheritance problem with association...
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]
Inheritance problem with association...
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-descriptor class=model.PayrollDeductionPlan table=dexa810t field-descriptor name=id column=a_id jdbc-type=BIGINT primarykey=true autoincrement=true / field-descriptor name=genericInfo column=generic_info jdbc-type=VARCHAR / collection-descriptor name=assocs element-class-ref=model.PayPlanAssociation auto-delete=true auto-update=true inverse-foreignkey field-ref=plan / /collection-descriptor /class-descriptor class-descriptor class=model.ClientPayrollDeductionPlan table=dexa820t field-descriptor name=id column=b_id jdbc-type=BIGINT primarykey=true autoincrement=true / field-descriptor name=clientInfo column=client_info jdbc-type=VARCHAR / reference-descriptor name=super class-ref=model.PayrollDeductionPlan auto-retrieve=true auto-update=true auto-delete=true foreignkey field-ref=id/ /reference-descriptor /class-descriptor class-descriptor class=model.PayPlanAssociation table=dexa830t field-descriptor name=id column=d_id jdbc-type=BIGINT primarykey=true autoincrement=true / field-descriptor name=plan column=a_id jdbc-type=BIGINT access=anonymous / reference-descriptor name=plan class-ref=model.PayrollDeductionPlan foreignkey field-ref=plan/ /reference-descriptor /class-descriptor 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: Simple Inheritance problem with multiple class to one table mapping
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-ref=abstractroom_id/ /collection-descriptor /class-descriptor class-descriptor class=kdms.core.NetworkAddress table=network_address field-descriptor name=abstractroom_id column=abstractroom_id jdbc-type=INTEGER primarykey=true autoincrement=true access=anonymous /field-descriptor /class-descriptor class-descriptor class=kdms.core.Room table=abstract_rooms field-descriptor name=abstractroom_id column=abstractroom_id jdbc-type=INTEGER primarykey=true autoincrement=true access=anonymous /field-descriptor
Re: Re: Simple Inheritance problem with multiple class to one table mapping
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-ref=abstractroom_id/ /collection-descriptor /class-descriptor class-descriptor class=kdms.core.NetworkAddress table=network_address
Simple Inheritance problem with multiple class to one table mapping
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]
Re: Simple Inheritance problem with multiple class to one table mapping
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: Re: Simple Inheritance problem with multiple class to one table mapping
Here is the XDoclet schema output (repository_user.xml) I removed all irrelevant data to keep it clear. !-- 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.Room/ /class-descriptor class-descriptor class=kdms.core.Room 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=apartment_id column=apartment_id jdbc-type=INTEGER access=anonymous /field-descriptor field-descriptor name=capacity column=capacity jdbc-type=INTEGER /field-descriptor index-descriptor name=room_unique unique=true index-column name=number/ index-column name=apartment_id/ /index-descriptor /class-descriptor 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
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
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] .
inheritance problem for update and find
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]
Three level inheritance problem - Null data from the mostly nested table
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]
Re: Three level inheritance problem - Null data from the mostly nested table
Hi Mariusz, did you try latest release (rc7)? Jakob fix a problem with inheritance between rc6 and rc7. regards, Armin Mariusz Wjcik 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]
Update Inheritance Problem.
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 : reference-descriptor name=super class-ref=a auto-retrieve=true auto-update=true foreignkey field-ref=id2/ /reference-descriptor 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]
Inheritance Problem.
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-descriptor class=A table=A_TABLE field-descriptor name=id column=ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor name=valueA column=VALUE jdbc-type=INTEGER / /class-descriptor class-descriptor class=B table=B_TABLE field-descriptor name=id2 column=ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor name=valueB column=VALUE jdbc-type=INTEGER / field-descriptor name=ojbConcreteClass column=CLASS_NAME jdbc-type=VARCHAR / reference-descriptor name=super class-ref=A auto-update=true foreignkey field-ref=id2/ /reference-descriptor /class-descriptor 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.
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-descriptor class=A table=A_TABLE field-descriptor name=id column=ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor name=valueA column=VALUE jdbc-type=INTEGER / /class-descriptor class-descriptor class=B table=B_TABLE field-descriptor name=id2 column=ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor name=valueB column=VALUE jdbc-type=INTEGER / field-descriptor name=ojbConcreteClass column=CLASS_NAME jdbc-type=VARCHAR / reference-descriptor name=super class-ref=A auto-update=true foreignkey field-ref=id2/ /reference-descriptor /class-descriptor 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 ?
RE: Inheritance Problem.
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-descriptor class=A table=A_TABLE field-descriptor name=id column=ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor name=valueA column=VALUE jdbc-type=INTEGER / /class-descriptor class-descriptor class=B table=B_TABLE field-descriptor name=id2 column=ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor name=valueB column=VALUE jdbc-type=INTEGER / field-descriptor name=ojbConcreteClass column=CLASS_NAME jdbc-type=VARCHAR / reference-descriptor name=super class-ref=A auto-update=true foreignkey field-ref=id2/ /reference-descriptor /class-descriptor 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
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: !--SUPERCLASS -- class-descriptor class=com.jma.interescola.core.User table=user_1 field-descriptor id=1 name=_id column=id jdbc-type=INTEGER primarykey=true autoincrement=true/ field-descriptor id=2 name=_name column=name jdbc-type=VARCHAR/ /class-descriptor !--SUBLASS -- class-descriptor class=com.jma.interescola.core.Student table=student field-descriptor id=1 name=_id column=id jdbc-type=INTEGER primarykey=true autoincrement=true/ reference-descriptor auto-retrieve=true auto-update=true auto-delete=true name=super class-ref=com.jma.interescola.core.User foreignkey field-ref=_id/ /reference-descriptor /class-descriptor 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]
Re: Inheritance problem
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: class-descriptor class=allibo.core.Account table=c_account field-descriptor name=account_id column=account_id jdbc-type=INTEGER primarykey=true autoincrement=true/ field-descriptor name=login column=login jdbc-type=VARCHAR/ field-descriptor name=password column=password jdbc-type=VARCHAR/ field-descriptor name=first_name column=first_name jdbc-type=VARCHAR/ field-descriptor name=last_name column=last_name jdbc-type=VARCHAR/ field-descriptor name=gender column=gender jdbc-type=VARCHAR/ field-descriptor name=remark column=remark jdbc-type=VARCHAR/ field-descriptor name=email column=email jdbc-type=VARCHAR/ field-descriptor name=registration_date column=registration_date jdbc-type=DATE/ field-descriptor name=last_activity_date column=last_activity_date jdbc-type=DATE/ field-descriptor name=date_of_birth column=date_of_birth jdbc-type=DATE/ /class-descriptor class-descriptor class=allibo.commerce.Employee table=fem_employee field-descriptor name=account_id column=account_id jdbc-type=INTEGER primarykey=true autoincrement=true/ reference-descriptor name=super class-ref=allibo.core.Account auto-retrieve=true auto-update=true auto-delete=true foreignkey field-ref=account_id/ /reference-descriptor /class-descriptor 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.init(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
Re: Inheritance problem
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]
Re: Inheritance problem
Hello, * the class-descriptors: class-descriptor class=allibo.core.Account table=c_account field-descriptor name=account_id column=account_id jdbc-type=INTEGER primarykey=true autoincrement=true/ field-descriptor name=login column=login jdbc-type=VARCHAR/ field-descriptor name=password column=password jdbc-type=VARCHAR/ field-descriptor name=first_name column=first_name jdbc-type=VARCHAR/ field-descriptor name=last_name column=last_name jdbc-type=VARCHAR/ field-descriptor name=gender column=gender jdbc-type=VARCHAR/ field-descriptor name=remark column=remark jdbc-type=VARCHAR/ field-descriptor name=email column=email jdbc-type=VARCHAR/ field-descriptor name=registration_date column=registration_date jdbc-type=DATE/ field-descriptor name=last_activity_date column=last_activity_date jdbc-type=DATE/ field-descriptor name=date_of_birth column=date_of_birth jdbc-type=DATE/ /class-descriptor class-descriptor class=allibo.commerce.Employee table=fem_employee field-descriptor name=account_id column=account_id jdbc-type=INTEGER primarykey=true autoincrement=true/ reference-descriptor name=super class-ref=allibo.core.Account auto-retrieve=true auto-update=true auto-delete=true foreignkey field-ref=account_id/ /reference-descriptor /class-descriptor 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.init(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
Inheritance problem
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]
JDO inheritance problem
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 : class-descriptor class=entities.Statute table=STATUTE extent-class class-ref=entities.Statute2 / field-descriptor name=id column=ID jdbc-type=INTEGER primarykey=true autoincrement=true/ field-descriptor name=name column=NAME jdbc-type=VARCHAR/ /class-descriptor class-descriptor class=entities.Statute2 table=STATUTE2 field-descriptor name=id column=ID jdbc-type=INTEGER primarykey=true autoincrement=true/ field-descriptor name=name column=NAME jdbc-type=VARCHAR/ field-descriptor name=name2 column=NAME2 jdbc-type=VARCHAR/ /class-descriptor entities.jdo (partial) : ... class name=Statute extension vendor-name=ojb key=table value=Statute/ field name=id extension vendor-name=ojb key=column value=id/ /field field name=name extension vendor-name=ojb key=column value=name/ /field /class class name=Statute2 extension vendor-name=ojb key=table value=Statute2/ field name=name2 extension vendor-name=ojb key=column value=name2/ /field /class ... 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, Cdric -- 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
Cdric, 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: class name=B persistence-capable-superclass=A 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 class 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 class section for B. Like so: class name=A field name=z field name=y /class class name=B persistence-capable-superclass=A field name=x /class Cdric 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 : class-descriptor class=entities.Statute table=STATUTE extent-class class-ref=entities.Statute2 / field-descriptor name=id column=ID jdbc-type=INTEGER primarykey=true autoincrement=true/ field-descriptor name=name column=NAME jdbc-type=VARCHAR/ /class-descriptor class-descriptor class=entities.Statute2 table=STATUTE2 field-descriptor name=id column=ID jdbc-type=INTEGER primarykey=true autoincrement=true/ field-descriptor name=name column=NAME jdbc-type=VARCHAR/ field-descriptor name=name2 column=NAME2 jdbc-type=VARCHAR/ /class-descriptor entities.jdo (partial) : ... class name=Statute extension vendor-name=ojb key=table value=Statute/ field name=id extension vendor-name=ojb key=column value=id/ /field field name=name extension vendor-name=ojb key=column value=name/ /field /class class name=Statute2 extension vendor-name=ojb key=table value=Statute2/ field name=name2 extension vendor-name=ojb key=column value=name2/ /field /class ... 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, Cdric - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,
Re: JDO inheritance problem
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.init(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 ? Cdric -- 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]