RE: HSQL + Autoincrement + SequenceManagerNativeImpl Problems
On Thu, 13 May 2004, Fred McCann wrote: > I'm can't say for certain that I used the cvs version because I've been > mixxing and matching versions quite a bit today to get stuff working. I just > erased all of them and got the cvs binary again and it is outputting the > access='readonly' line. On the topic of the date <--> datetime conversion, I > believe that the error I was gettinq was related to that. I added Xdoclet > tags to the datetime field and that seems to be working now. Thanks for all > the help! No problem. I will add something about mapping java.util.Date to the doc. Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: HSQL + Autoincrement + SequenceManagerNativeImpl Problems
I'm can't say for certain that I used the cvs version because I've been mixxing and matching versions quite a bit today to get stuff working. I just erased all of them and got the cvs binary again and it is outputting the access='readonly' line. On the topic of the date <--> datetime conversion, I believe that the error I was gettinq was related to that. I added Xdoclet tags to the datetime field and that seems to be working now. Thanks for all the help! - Fred -Original Message- From: Thomas Dudziak [mailto:[EMAIL PROTECTED] Sent: Thursday, May 13, 2004 3:54 PM To: OJB Users List Subject: RE: HSQL + Autoincrement + SequenceManagerNativeImpl Problems On Thu, 13 May 2004, Fred McCann wrote: > OK I think I have something usefule to add. I throw in some debugging > statements to reflect what OJB was trying to insert and it was flaking out > on the Date object. Here's what the mapping is for the date field: > > name="birthdate" > column="birthdate" > jdbc-type="DATE" > > > > > > This is what an older version of the xdoclet plugin gave me: > > > name="birthdate" > column="birthdate" > jdbc-type="TIMESTAMP" > > conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimest > ampFieldConversion" > > > This change was on purpose. However if you try to insert a java.util.Date object, then you might have to use TIMESTAMP (I'm not sure but it might be jdbc driver dependent whether one can use java.util.Date) and the conversion (which you can both specify in the javadoc tags). BTW, if I run your code snippet through XDoclet, I get the access='readonly' line (I also added two unit tests for this). Are you sure you're using the newest XDoclet module (be aware that building OJB from source does NOT build the XDoclet module as it has different prerequisites and is rather difficult to build; the CVS version of OJB does include the newest binary build though). Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: HSQL + Autoincrement + SequenceManagerNativeImpl Problems
On Thu, 13 May 2004, Fred McCann wrote: > OK I think I have something usefule to add. I throw in some debugging > statements to reflect what OJB was trying to insert and it was flaking out > on the Date object. Here's what the mapping is for the date field: > > name="birthdate" > column="birthdate" > jdbc-type="DATE" > > > > > > This is what an older version of the xdoclet plugin gave me: > > > name="birthdate" > column="birthdate" > jdbc-type="TIMESTAMP" > > conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimest > ampFieldConversion" > > > This change was on purpose. However if you try to insert a java.util.Date object, then you might have to use TIMESTAMP (I'm not sure but it might be jdbc driver dependent whether one can use java.util.Date) and the conversion (which you can both specify in the javadoc tags). BTW, if I run your code snippet through XDoclet, I get the access='readonly' line (I also added two unit tests for this). Are you sure you're using the newest XDoclet module (be aware that building OJB from source does NOT build the XDoclet module as it has different prerequisites and is rather difficult to build; the CVS version of OJB does include the newest binary build though). Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: HSQL + Autoincrement + SequenceManagerNativeImpl Problems
OK I think I have something usefule to add. I throw in some debugging statements to reflect what OJB was trying to insert and it was flaking out on the Date object. Here's what the mapping is for the date field: This is what an older version of the xdoclet plugin gave me: The version with the conversion added seems to work! So maybe this is something with the Xdoclet module? - Fred - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: HSQL + Autoincrement + SequenceManagerNativeImpl Problems
I did try adding access=readonly an there's no change. -Original Message- From: Thomas Dudziak [mailto:[EMAIL PROTECTED] Sent: Thursday, May 13, 2004 3:04 PM To: OJB Users List Subject: RE: HSQL + Autoincrement + SequenceManagerNativeImpl Problems On Thu, 13 May 2004, Fred McCann wrote: > Additional info: I just built OJB from the CVS source and ran my build > again. This is what came up: I'll debug the module with your class to see where the problem lies. Could you add the access=readonly manually to see whether this actually solves your problem ? Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: HSQL + Autoincrement + SequenceManagerNativeImpl Problems
On Thu, 13 May 2004, Fred McCann wrote: > Additional info: I just built OJB from the CVS source and ran my build > again. This is what came up: I'll debug the module with your class to see where the problem lies. Could you add the access=readonly manually to see whether this actually solves your problem ? Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: HSQL + Autoincrement + SequenceManagerNativeImpl Problems
Additional info: I just built OJB from the CVS source and ran my build again. This is what came up: - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: HSQL + Autoincrement + SequenceManagerNativeImpl Problems
On Thu, 13 May 2004, Fred McCann wrote: > Here is the generated repository info: > > class="bean.Account" > table="account" > > > name="id" > column="account_id" > jdbc-type="INTEGER" > primarykey="true" > autoincrement="true" > > There is an access="readonly" missing here which perhaps leads to your error. Have you tried the latest XDoclet module from CVS (only the module, no need to update OJB to CVS) ? This is generated with the xdoclet module I got from CVS from around 11:30am est today. I switched to that because of the custom-query support. - Fred - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: HSQL + Autoincrement + SequenceManagerNativeImpl Problems
On Thu, 13 May 2004, Fred McCann wrote: > Here is the generated repository info: > > class="bean.Account" > table="account" > > > name="id" > column="account_id" > jdbc-type="INTEGER" > primarykey="true" > autoincrement="true" > > There is an access="readonly" missing here which perhaps leads to your error. Have you tried the latest XDoclet module from CVS (only the module, no need to update OJB to CVS) ? Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OTM transaction isolation
The OTM does use its own (as well as anything the database provides, if you want it to) transaction isolation system. The transaction semantics are the same, I believe, as for the ODMG. -Brian On May 13, 2004, at 11:30 AM, Maksimenko Alexander wrote: Hi ! I have to use hsqldb as my database. But it doesn't support transaction isolation So I want to use OTM as transaction management system. Does it use own transaction isolation mechanizm (not database specific)? -- Maksimenko Alexander Softwarium, www.softwarium.net - 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]
one last JOIN question
Can I join to something that is not the PK? TABLE SCHOOL int school_id PK int college_id TABLE PROFILE int profile_id PK int school_id FK to SCHOOL.school_id TABLE INFO int info_id PK int college_id FK to SCHOOL.college_id Can this be done? It doesn't seem like it. When I try either "super" or a reference-descriptor foreign-key it always points to the PK of the referred table. I find this weird since Torque doesn't work this way. When I setup the torque-schema.xml file you see something like this: What I like about that setup is that you can designate the local column and the foreign column. Not so with OJB. Am I just not seeing where it gets set? This would be huge if it worked. Oh, and all of the other JOIN questions that I had have been answered. The latest from CVS made the difference, thanks so much for the tips. Charlie - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: HSQL + Autoincrement + SequenceManagerNativeImpl Problems
Here is the generated repository info: And here's the DDL: CREATE TABLE ACCOUNT( ACCOUNT_ID INTEGER NOT NULL IDENTITY PRIMARY KEY, USERNAME VARCHAR(12) NOT NULL, PASSWORD VARCHAR(64) NOT NULL, FNAME VARCHAR(32) NOT NULL, LNAME VARCHAR(32) NOT NULL, EMAIL VARCHAR(64) NOT NULL, AGE INTEGER NOT NULL, GENDER INTEGER NOT NULL, BIRTHDATE DATE NOT NULL, ADDRESS1 VARCHAR(64) NOT NULL, ADDRESS2 VARCHAR(64), CITY VARCHAR(64) NOT NULL, STATE CHAR(2) NOT NULL, ZIP VARCHAR(10) NOT NULL, INTERESTS VARCHAR(256) ) Could you post the generated repository descriptor and database definition (torque schema or hibernate sql) ? BTW, there was a little issue with the autoincrement='database' setting that I fixed in CVS, which is not present in RC6. Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OJB Properties are changed
Hi Jack, Jack ValLance wrote: I have the following setting in my OJB.properties file: # OJB.properties -- configuration of the OJB runtime environment maxActive=300 maxIdle=-1 maxWait=2000 timeBetweenEvictionRunsMillis=-1 minEvictableIdleTimeMillis=100 whenExhaustedAction=2 When I run the application using Tomcat 4.1.27, I get the following Message: which changes the properties setting. [org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl] INFO: Create PersistenceBroker instance pool, pool configuration was {whenExhaustedAction=2, maxIdle=-1, maxActive=300, maxWait=2000, removeAbandoned=false, numTestsPerEvictionRun=10, testWhileIdle=false, minEvictableIdleTimeMillis=100, testOnReturn=false, logAbandoned=false, removeAbandonedTimeout=300, timeBetweenEvictionRunsMillis=-1, testOnBorrow=false} The settings for the PersistenceBroker pool seems ok to me. What is the problem here? Below you post the settings of the connection pool. The connection pool settings can be set within the 'jdbc-connection-descriptor' element using 'connection-pool' What are the problems here? Can you describe a little more? regards, Armin [org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] INFO: Create new connection pool:[EMAIL PROTECTED] jcd-alias=default default-connection=true dbms=Oracle jdbc-level=2.0 driver=oracle.jdbc.driver.OracleDriver protocol=jdbc sub-protocol=Oracle db-alias=thin:@mcpha4cds51.forscom.army.mil:1521:nc2d user=TSAMS_USER password=* eager-release=false ConnectionPoolDescriptor={whenExhaustedAction=0, maxIdle=-1, maxActive=21, maxWait=5000, removeAbandoned=false, numTestsPerEvictionRun=10, testWhileIdle=false, minEvictableIdleTimeMillis=60, testOnReturn=false, logAbandoned=false, removeAbandonedTimeout=300, timeBetweenEvictionRunsMillis=-1, testOnBorrow=true} batchMode=false useAutoCommit=AUTO_COMMIT_SET_TRUE_AND_TEMPORARY_FALSE ignoreAutoCommitExceptions=false [EMAIL PROTECTED] sequenceManagerClass=class org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl Properties={} - 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: HSQL + Autoincrement + SequenceManagerNativeImpl Problems
On Thu, 13 May 2004, Fred McCann wrote: > I'm new to OJB, but I have done several projects with Hibernate and EJB > Entity beans, so I'm not completely a newbie. I've switched from RC5 to RC6 > so I'm on the latest version (for purposes of using the latest XDoclet > features). Here's my problem. I'm trying to use HSQLDB's (1.7.1) identiy > fields to generate primary keys. Here's my setting for the sequence manager: Could you post the generated repository descriptor and database definition (torque schema or hibernate sql) ? BTW, there was a little issue with the autoincrement='database' setting that I fixed in CVS, which is not present in RC6. Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
HSQL + Autoincrement + SequenceManagerNativeImpl Problems
I'm new to OJB, but I have done several projects with Hibernate and EJB Entity beans, so I'm not completely a newbie. I've switched from RC5 to RC6 so I'm on the latest version (for purposes of using the latest XDoclet features). Here's my problem. I'm trying to use HSQLDB's (1.7.1) identiy fields to generate primary keys. Here's my setting for the sequence manager: = = And this is the basic class: = /** * Account class maps to accounts in the database * * @ojb.class table = "account" */ public class Account { /** * identifier * * @ojb.field * primarykey = "true" * column = "account_id" * autoincrement = "database" * access = "readonly" */ private int id; /** * username of this account * * @ojb.field * column = "username" * length = "12" */ private String username; /** * Password of this account * * @todo look into encypting this. MD5? * @ojb.field * column = "password" * length = "64" */ private String password; /** * First Name * * @ojb.field * column = "fname" * length = "32" */ private String firstName; /** * Last Name * * @ojb.field * column = "lname" * length = "32" */ private String lastName; /** * empty constructor */ public Account() { this.address2=null; this.roles=new java.util.ArrayList(); } ... } = And finally, here's the error I'm running into: = [junit] Running com.alloy.hipe.business.TestAccountLogic [junit] Tests run: 2, Failures: 0, Errors: 1, Time elapsed: 1.438 sec [junit] Testsuite: com.alloy.hipe.business.TestAccountLogic [junit] Tests run: 2, Failures: 0, Errors: 1, Time elapsed: 1.438 sec [junit] - Standard Output --- [junit] - Can't save Account: SQL failure while insert object data for class com.alloy.hipe.bean.Account, PK of the given object is [ id=-2], object was [EMAIL PROTECTED], exception message is [Wrong data type] [junit] - --- [junit] Testcase: testLogin took 1.328 sec [junit] Testcase: testAddAcount took 0.078 sec = I'm at a loss; the setup was working in R5 and now I'm back to square one. Any ideas? - Fred - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
OJB Properties are changed
I have the following setting in my OJB.properties file: # OJB.properties -- configuration of the OJB runtime environment maxActive=300 maxIdle=-1 maxWait=2000 timeBetweenEvictionRunsMillis=-1 minEvictableIdleTimeMillis=100 whenExhaustedAction=2 When I run the application using Tomcat 4.1.27, I get the following Message: which changes the properties setting. [org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl] INFO: Create PersistenceBroker instance pool, pool configuration was {whenExhaustedAction=2, maxIdle=-1, maxActive=300, maxWait=2000, removeAbandoned=false, numTestsPerEvictionRun=10, testWhileIdle=false, minEvictableIdleTimeMillis=100, testOnReturn=false, logAbandoned=false, removeAbandonedTimeout=300, timeBetweenEvictionRunsMillis=-1, testOnBorrow=false} [org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] INFO: Create new connection pool:[EMAIL PROTECTED] jcd-alias=default default-connection=true dbms=Oracle jdbc-level=2.0 driver=oracle.jdbc.driver.OracleDriver protocol=jdbc sub-protocol=Oracle db-alias=thin:@mcpha4cds51.forscom.army.mil:1521:nc2d user=TSAMS_USER password=* eager-release=false ConnectionPoolDescriptor={whenExhaustedAction=0, maxIdle=-1, maxActive=21, maxWait=5000, removeAbandoned=false, numTestsPerEvictionRun=10, testWhileIdle=false, minEvictableIdleTimeMillis=60, testOnReturn=false, logAbandoned=false, removeAbandonedTimeout=300, timeBetweenEvictionRunsMillis=-1, testOnBorrow=true} batchMode=false useAutoCommit=AUTO_COMMIT_SET_TRUE_AND_TEMPORARY_FALSE ignoreAutoCommitExceptions=false [EMAIL PROTECTED] sequenceManagerClass=class org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl Properties={} - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
OTM transaction isolation
Hi ! I have to use hsqldb as my database. But it doesn't support transaction isolation So I want to use OTM as transaction management system. Does it use own transaction isolation mechanizm (not database specific)? -- Maksimenko Alexander Softwarium, www.softwarium.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Bug in QueryReferenceBroker?
Thanks for the quick response! I thought I was going crazy when I saw that method and couldn't figure out why it was doing that. I assumed I was just missing something in the bigger picture. Glad we could find that before the next RC. -Andrew -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: Thursday, May 13, 2004 6:24 AM To: OJB Users List Subject: Re: Bug in QueryReferenceBroker? Hi Andrew, I checked in a fix (similar to your patch + minor modifications in method) and a new test in AnonymousFieldsTest. The test fails with NPE when using QueryReferenceBroker version 1.15 and pass with latest version. Hope this will solve your problem too. Thank you very much! regards, java-dumbhead Armin Armin Waibel wrote: > Hi Andrew, > > seems you patch will do the job. > I will check this ASAP. > Thanks! > > regards, > Armin > > Clute, Andrew wrote: > >> I created what I think is an appropriate patch -- it fixed my issue. >> Here it is. >> >> Index: QueryReferenceBroker.java >> === >> RCS file: >> /home/cvspublic/db-ojb/src/java/org/apache/ojb/broker/core/QueryRefer >> enc >> eBroker.java,v >> retrieving revision 1.15 >> diff -u -r1.15 QueryReferenceBroker.java >> --- QueryReferenceBroker.java6 May 2004 19:45:57 -1.15 >> +++ QueryReferenceBroker.java12 May 2004 21:47:44 - >> @@ -425,6 +425,7 @@ >> { >> return new Identity(referencedObject, pb); >> } >> +return null; >> } >> else >> { >> >> >> >> -Original Message- >> From: Clute, Andrew [mailto:[EMAIL PROTECTED] Sent: >> Wednesday, May 12, 2004 5:37 PM >> To: OJB Users List; OJB Developers List >> Subject: Bug in QueryReferenceBroker? >> >> I recently updated to HEAD and am finding a weird issue now. >> >> I have an object Session, that has a reference to an Object called >> Person. Now Person is a proxy object. I am using an Anonymous FK to >> reference Person from Session. >> >> When I try to restore Session when it has no Person hanging on it, it >> restores the Session object with a Person Proxy object hanging off of >> it (it shouldn't!), and the Proxy's PK being a collection of null. >> >> I think I might have narrowed down why it is happening: >> >> Method getReferencedObjectIdentity(), here is a code snipet: >> >> if (hasNullifiedFKValue) >> { >> if(isAnonymousKeyReference(cld, rds)) >>{ >> Object referencedObject = rds.getPersistentField().get(obj); >> if(referencedObject != null) >> { >> return new Identity(referencedObject, pb); >> } >> } >> else >> { >> return null; >> } >> } >> >> // ensure that top-level extents are used for Identities >> return new Identity(rds.getItemClass(), >> pb.getTopLevelClass(rds.getItemClass()), fkValues); >> >> In my case, I have a nullifiedFKValue, so it goes into the first If >> block, and then it sees that it is an AnonymousKeyReference, but then >> my referencesObject us null (like it should be). But instead of >> returning null, it jums out to the bottom where it returns a new >> Identity!! Why is it doing that? I can see where Armin has made some >> changes to handle better AnonymousFK's, is this a side-effect of that? >> >> -ANdrew >> >> >> - >> 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: null FK handling in QueryReferenceBroker is BROKEN?
Armin, Andrews thank you! :-) Andrew Shevel Armin Waibel wrote: Hi Andrew, this sounds similar to a problem posted by Andrew Clute http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgNo=12802 Seems this bug was "Andrew specific" ;-) Checked in a fix in CVS. Sorry for the hassle! regards Armin [EMAIL PROTECTED] wrote: Hi, all. We've discovered the following strange issue: if method QueryReferenceBroker.getReferencedObjectIdentity(obj, ObjectReferenceDescriptor, ClassDescriptor) is called with obj = null then non null Identity object is returned. In this Identity object array m_pkValues has 1 element with value null. Such Identity object drives crazy every other component. We can see funny debug messages in our logs: CORE3282: stdout: [org.apache.ojb.broker.core.PersistenceBrokerImpl] DEBUG: getObjectByIdentity ru.lma.seals.SealsManagementService.po.Seal{null} Of course this ends with throwing NullPointerException in our case somewhere in ConcreteEditiongContext. Armin, what do you think? Andrew Shevel - 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: null FK handling in QueryReferenceBroker is BROKEN?
Hi Andrew, this sounds similar to a problem posted by Andrew Clute http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgNo=12802 Seems this bug was "Andrew specific" ;-) Checked in a fix in CVS. Sorry for the hassle! regards Armin [EMAIL PROTECTED] wrote: Hi, all. We've discovered the following strange issue: if method QueryReferenceBroker.getReferencedObjectIdentity(obj, ObjectReferenceDescriptor, ClassDescriptor) is called with obj = null then non null Identity object is returned. In this Identity object array m_pkValues has 1 element with value null. Such Identity object drives crazy every other component. We can see funny debug messages in our logs: CORE3282: stdout: [org.apache.ojb.broker.core.PersistenceBrokerImpl] DEBUG: getObjectByIdentity ru.lma.seals.SealsManagementService.po.Seal{null} Of course this ends with throwing NullPointerException in our case somewhere in ConcreteEditiongContext. Armin, what do you think? Andrew Shevel - 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: Bug in QueryReferenceBroker?
Hi Andrew, I checked in a fix (similar to your patch + minor modifications in method) and a new test in AnonymousFieldsTest. The test fails with NPE when using QueryReferenceBroker version 1.15 and pass with latest version. Hope this will solve your problem too. Thank you very much! regards, java-dumbhead Armin Armin Waibel wrote: Hi Andrew, seems you patch will do the job. I will check this ASAP. Thanks! regards, Armin Clute, Andrew wrote: I created what I think is an appropriate patch -- it fixed my issue. Here it is. Index: QueryReferenceBroker.java === RCS file: /home/cvspublic/db-ojb/src/java/org/apache/ojb/broker/core/QueryReferenc eBroker.java,v retrieving revision 1.15 diff -u -r1.15 QueryReferenceBroker.java --- QueryReferenceBroker.java6 May 2004 19:45:57 -1.15 +++ QueryReferenceBroker.java12 May 2004 21:47:44 - @@ -425,6 +425,7 @@ { return new Identity(referencedObject, pb); } +return null; } else { -Original Message- From: Clute, Andrew [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 12, 2004 5:37 PM To: OJB Users List; OJB Developers List Subject: Bug in QueryReferenceBroker? I recently updated to HEAD and am finding a weird issue now. I have an object Session, that has a reference to an Object called Person. Now Person is a proxy object. I am using an Anonymous FK to reference Person from Session. When I try to restore Session when it has no Person hanging on it, it restores the Session object with a Person Proxy object hanging off of it (it shouldn't!), and the Proxy's PK being a collection of null. I think I might have narrowed down why it is happening: Method getReferencedObjectIdentity(), here is a code snipet: if (hasNullifiedFKValue) { if(isAnonymousKeyReference(cld, rds)) { Object referencedObject = rds.getPersistentField().get(obj); if(referencedObject != null) { return new Identity(referencedObject, pb); } } else { return null; } } // ensure that top-level extents are used for Identities return new Identity(rds.getItemClass(), pb.getTopLevelClass(rds.getItemClass()), fkValues); In my case, I have a nullifiedFKValue, so it goes into the first If block, and then it sees that it is an AnonymousKeyReference, but then my referencesObject us null (like it should be). But instead of returning null, it jums out to the bottom where it returns a new Identity!! Why is it doing that? I can see where Armin has made some changes to handle better AnonymousFK's, is this a side-effect of that? -ANdrew - 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]
null FK handling in QueryReferenceBroker is BROKEN?
Hi, all. We've discovered the following strange issue: if method QueryReferenceBroker.getReferencedObjectIdentity(obj, ObjectReferenceDescriptor, ClassDescriptor) is called with obj = null then non null Identity object is returned. In this Identity object array m_pkValues has 1 element with value null. Such Identity object drives crazy every other component. We can see funny debug messages in our logs: CORE3282: stdout: [org.apache.ojb.broker.core.PersistenceBrokerImpl] DEBUG: getObjectByIdentity ru.lma.seals.SealsManagementService.po.Seal{null} Of course this ends with throwing NullPointerException in our case somewhere in ConcreteEditiongContext. Armin, what do you think? Andrew Shevel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Inconsistence in Persistence Broker
Hi Bill, now it's a bit clearer, but not enough ;-) Could you post the mapping in repository file for Employee, Department and Role? Did you set a sequence manager or do you use the default one? > table.Where should i set auto-update parameter,and what should i set it > as 'true' or 'object'. You don't need to change this, I only want to know if you change these settings. > file.I have been using "Default" Persistence Broker.Should i create one > of my own. You don't need to change this, I only want to know if you change these settings. How do you build the objects before calling public void insert(EmployeeVO employeevo,DepartVO departvo,RoleVO rolevo) method - Do you set the FK by hand ...? Can you post this code too? regards, Armin balaji sampath wrote: Hello, Thanks Armin for analysing my problem.There are association between these tables.employee id in department and role refers the employee table.Where should i set auto-update parameter,and what should i set it as 'true' or 'object'.I have not changed the settings of OJB.properties file.I have been using "Default" Persistence Broker.Should i create one of my own. Expecting for a solution from you all. Thanking You, bill From: Armin Waibel <[EMAIL PROTECTED]> Reply-To: "OJB Users List" <[EMAIL PROTECTED]> To: OJB Users List <[EMAIL PROTECTED]> Subject: Re: Inconsistence in Persistence Broker Date: Tue, 11 May 2004 00:15:37 +0200 Hi, difficult to analyse what's going wrong. Are there associations between Employee, Department and Role? If yes, do you set auto-update 'true' or 'object'? Do you change any settings in OJB.properties file? Do you use one PB instance per thread (PB instances are not threadsafe)? regards, Armin balaji sampath wrote: Hello, I have been using OJB with jakarta struts and having MYSQL 4 has database. When I create an object for Persistance Broker and try to insert values into three of my tables. Here is my insert method of my DAO object public void insert(EmployeeVO employeevo,DepartVO departvo,RoleVO rolevo) throws DataAccessException { log.info("inside EmployeeDAO.insert"); PersistenceBroker broker = null; try { broker = ServiceLocator.getInstance().findBroker(); broker.beginTransaction(); broker.store(employeevo); broker.store(departvo); broker.store(rolevo); broker.commitTransaction(); } ... The insertion of rows into the three tables was not a consistent one.It correctly inserts the rows into three tables in few cases or gives an exception PersistenceBrokerException: Message From server "Duplicate Entry 1-2345 for key 1" When i looked into the employee table the row was properly inserted and the rows are not inserted into the rest of the two tables.I felt that the error was due to the persistance broker trying to insert the row in the employee table which was the first table for the second time after it has been inserted into the first time itself.That is the persistence broker is getting restarted.The execution of the code is inconsistent. Could anyone in this group help to solve this problem.Expecting for a solution from you all. Thanking You, bill. _ Best of Indian handicrafts. http://www.fabmall.com/affiliatehtml/redir/nl8.asp At MSN Shopping. - 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] _ Earn without investing. http://go.msnserver.com/IN/48713.asp Sell anything on www.baazee.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]