RE: Proxy collection and cyclic references
Hi Armin, I set up all the code to send you only to discover that it worked in those tests. Even though removing the parent reference solved the problem, it turns out it is not an OJB problem. The problem might be a JAXB one, as making the collection in question Transient and leaving the parent reference (when reading out of OJB) alone, also "solves" the problem. So I'll have to look into this. But basically it doesn't seem to be OJB that is at fault. Sorry. Rob -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: 15 November 2007 03:00 To: OJB Users List Subject: Re: Proxy collection and cyclic references Hi Robert, Robert Giddings wrote: > Hi Armin, > > Actually it doesn't seem to have anything to do with Proxies as setting > proxy to false while leaving auto-retrieve to true creates the same > problem. > > As for code enhancements, there are none. > > All my code is doing is reading out an object from the database which > has encrypted fields. I then run the decrypt method of that object to > produce a decrypted version. > The collections aren't decrypted, but rather assigned to the new object, > allowing for proxy collections. > When their access method is called their member objects are decrypted. > Each collection member object has a parent reference to the owner object > of the collection and the decrypt method is run on this object when the > collection member object is decrypted. > However instead of stopping in the loop because eventually the loop gets > to a null as is the case with all the other collections one of the > collections keeps on looping until a StackTraceOverflow. For me it's difficult to figure this out without reading your sources. In OJB the class responsible to materialize query/collection objects is ...accesslayer.RsIterator.java. RsIterator use class MaterializationCache to avoid endless loops on cyclic object graph materialization. Maybe this can help you to solve the problem. > I have looked at my code, but it is identical to the code for the > decrypting of the other collections, leading me to believe that this is > an error with OJB in regard to cyclic references. > It seems we reached an impasse ;-) If OJB cause your problem it's mandatory for me to reproduce your problem - only this way I can fix it. So please could you send me an test to reproduce the problem (keep the test as simple as possible, remove all unneeded fields, classes... If OJB cause the problem you should be able to write an test without using your en/decrypt methods, only 'normal' objects with cyclic references). regards, Armin > Rob > > -Original Message- > From: Armin Waibel [mailto:[EMAIL PROTECTED] > Sent: 13 November 2007 11:28 > To: OJB Users List > Subject: Re: Proxy collection and cyclic references > > Hi Robert, > > Robert Giddings wrote: >> Hi Guys, >> >> Has anyone had any trouble with a proxy collection and cyclic > references >> before? >> >> I keep getting StackTraceOverflow errors because of an infinite loop >> where a collection of objects of one type has a reference to the >> collection owner object. >> >> However I can't see this as being a problem with my code, because I > have >> looked all over the place for an error, but my code in the decrypt >> method of the objects class is identical to other classes, and they >> don't have any problem. > > Could you reproduce this error if you remove your enhancements (if > exist)? > If yes, please open an issue > https://issues.apache.org/jira/browse/OJB > and describe detailed (e.g. with pseudo code) how to reproduce your > problem. > > If possible please run your test against the latest version from SVN > (OJB_1_0_RELEASE branch) - it's stable and will be the 1.0.5rc1. The OJB > > test-suite run several tests with cyclic references and they all pass, > so I would expect that this error (if it's one) already fixed in SVN. > > regards, > Armin > >> Thanks, >> >> Rob >> >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.503 / Virus Database: 269.15.32/1131 - Release Date: 14/11/2007 16:54 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Proxy collection and cyclic references
Hi Armin, Actually it doesn't seem to have anything to do with Proxies as setting proxy to false while leaving auto-retrieve to true creates the same problem. As for code enhancements, there are none. All my code is doing is reading out an object from the database which has encrypted fields. I then run the decrypt method of that object to produce a decrypted version. The collections aren't decrypted, but rather assigned to the new object, allowing for proxy collections. When their access method is called their member objects are decrypted. Each collection member object has a parent reference to the owner object of the collection and the decrypt method is run on this object when the collection member object is decrypted. However instead of stopping in the loop because eventually the loop gets to a null as is the case with all the other collections one of the collections keeps on looping until a StackTraceOverflow. I have looked at my code, but it is identical to the code for the decrypting of the other collections, leading me to believe that this is an error with OJB in regard to cyclic references. Rob -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: 13 November 2007 11:28 To: OJB Users List Subject: Re: Proxy collection and cyclic references Hi Robert, Robert Giddings wrote: > Hi Guys, > > Has anyone had any trouble with a proxy collection and cyclic references > before? > > I keep getting StackTraceOverflow errors because of an infinite loop > where a collection of objects of one type has a reference to the > collection owner object. > > However I can't see this as being a problem with my code, because I have > looked all over the place for an error, but my code in the decrypt > method of the objects class is identical to other classes, and they > don't have any problem. Could you reproduce this error if you remove your enhancements (if exist)? If yes, please open an issue https://issues.apache.org/jira/browse/OJB and describe detailed (e.g. with pseudo code) how to reproduce your problem. If possible please run your test against the latest version from SVN (OJB_1_0_RELEASE branch) - it's stable and will be the 1.0.5rc1. The OJB test-suite run several tests with cyclic references and they all pass, so I would expect that this error (if it's one) already fixed in SVN. regards, Armin > > Thanks, > > Rob > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.503 / Virus Database: 269.15.30/1127 - Release Date: 12/11/2007 21:19 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Proxy collection and cyclic references
Hi Guys, Has anyone had any trouble with a proxy collection and cyclic references before? I keep getting StackTraceOverflow errors because of an infinite loop where a collection of objects of one type has a reference to the collection owner object. However I can't see this as being a problem with my code, because I have looked all over the place for an error, but my code in the decrypt method of the objects class is identical to other classes, and they don't have any problem. Thanks, Rob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: deprecated LockManagerClass
Hi Armin, > did you uncomment the LockMapClass entry too? According to the instructions in the properties file: yep! > The locking stuff moved from the odmg-package to the OJB core to allow > future API's (e.g. JPA or enhanced PB-api) use of the core locking-api. > Additionally initial support for commons-transaction locking api and > code review, bug fixes. Clear. I noticed some side effects (exceptions regarding ambiguous column names when using addSql on a Criteria object for like conditions instead of using addLike method, exception regarding trying to insert duplicate entry), I already assumed this has to do with resolved bugs. Thanx, Robert -- View this message in context: http://www.nabble.com/deprecated-LockManagerClass-tf4586990.html#a13110775 Sent from the Apache DB - ObjectRelationalBridge Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
deprecated LockManagerClass
Hi, Regarding migration ojb 1.0.1 to 1.0.4 I noticed the following line in ojb.properties # @deprecated LockManagerClass=org.apache.ojb.odmg.locking.LockManagerDefaultImpl If I retain this setting a NPE occurs in the doClose() invoke in org.apache.ojb.odmg.TransactionImpl.commit() The NPE doesn't occur when changing the LockManagerClass implementation to: LockManagerClass=org.apache.ojb.broker.locking.LockManagerInMemoryImpl However I could not found any information about the reason of org.apache.ojb.odmg.locking.LockManagerDefaultImpl being deprecated; I would like to know the impact of using the other implementation. So, what is the reason behind this change? Regards, Robert -- View this message in context: http://www.nabble.com/deprecated-LockManagerClass-tf4586990.html#a13093301 Sent from the Apache DB - ObjectRelationalBridge Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Maps
Hi Armin, UserType is a complex object that is used as a property in other objects. AccessRight is an enum. The XDoclet I currently have is: /** * @ojb.field jdbc-type="LONGVARCHAR" conversion="org.apache.ojb.broker.accesslayer.conversions.Object2Base64S tringFieldConversion" */ private EnumMap accessRights = new EnumMap(AccessRight.class); I was just wondering if there is a better way of converting this property? Thanks, Robert Giddings -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: 28 September 2007 16:40 To: OJB Users List Subject: Re: Maps Robert Giddings wrote: > Also forgot to mention, what I really want is the XDoclet code that can > be used with Maps. > Sorry, I don't get it. How are UserType and AccessRight associated (1:n?)? Armin > Robert > > -Original Message- > From: Robert Giddings [mailto:[EMAIL PROTECTED] > Sent: 28 September 2007 14:28 > To: 'OJB Users List' > Subject: RE: Maps > > Hi Armin, > > This is the Map in question: > > private EnumMap accessRights = > new EnumMap(AccessRight.class); > > It is just a data member field in an object called UserType. > > Thanks, > > Robert > > -Original Message- > From: Armin Waibel [mailto:[EMAIL PROTECTED] > Sent: 28 September 2007 14:00 > To: OJB Users List > Subject: Re: Maps > > Hi Robert, > > Robert Giddings wrote: >> Hi, >> >> Does anyone know if and how OJB can handle Maps? >> > > can you describe more detailed what you want to do - using maps in 1:n > or m:n references, direct persist maps, ... > > regards, > Armin > >> Thanks, >> >> Rob >> >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.488 / Virus Database: 269.13.33/1034 - Release Date: 27/09/2007 17:00 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Maps
Also forgot to mention, what I really want is the XDoclet code that can be used with Maps. Robert -Original Message- From: Robert Giddings [mailto:[EMAIL PROTECTED] Sent: 28 September 2007 14:28 To: 'OJB Users List' Subject: RE: Maps Hi Armin, This is the Map in question: private EnumMap accessRights = new EnumMap(AccessRight.class); It is just a data member field in an object called UserType. Thanks, Robert -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: 28 September 2007 14:00 To: OJB Users List Subject: Re: Maps Hi Robert, Robert Giddings wrote: > Hi, > > Does anyone know if and how OJB can handle Maps? > can you describe more detailed what you want to do - using maps in 1:n or m:n references, direct persist maps, ... regards, Armin > Thanks, > > Rob > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.488 / Virus Database: 269.13.33/1034 - Release Date: 27/09/2007 17:00 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.488 / Virus Database: 269.13.33/1034 - Release Date: 27/09/2007 17:00 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Maps
Hi Armin, This is the Map in question: private EnumMap accessRights = new EnumMap(AccessRight.class); It is just a data member field in an object called UserType. Thanks, Robert -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: 28 September 2007 14:00 To: OJB Users List Subject: Re: Maps Hi Robert, Robert Giddings wrote: > Hi, > > Does anyone know if and how OJB can handle Maps? > can you describe more detailed what you want to do - using maps in 1:n or m:n references, direct persist maps, ... regards, Armin > Thanks, > > Rob > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.488 / Virus Database: 269.13.33/1034 - Release Date: 27/09/2007 17:00 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Maps
Hi, Does anyone know if and how OJB can handle Maps? Thanks, Rob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: getPKEnumerationByQuery()
OK, I used getReportQueryIteratorByQuery() and it works. Thanks, Rob -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: 18 September 2007 14:07 To: OJB Users List Subject: Re: getPKEnumerationByQuery() Hi Robert, Robert Giddings wrote: > Hi, > > When using the method getPKEnumerationByQuery() I get the following > error: > > > Caused by: java.util.NoSuchElementException > at > org.apache.ojb.broker.accesslayer.PkEnumeration.nextElement(Unknown S > ource) > at > com.netcase.database.DAOService.getIdsByPropertyMatch(DAOService.java > :117) > > Has anyone else had any problems using OJB's Enumeration implementation? > As the code that iterates through it is this: > > Enumeration pks = broker.getPKEnumerationByQuery(PrimaryKey.class, > query); > Collection ids = new > ArrayList(); > while(pks.hasMoreElements()) { > PrimaryKey pk = > (PrimaryKey)pks.nextElement(); > ids.add(pk.getId()); > } > > And I can't see any problem with this code, and so can only conclude > that the hasMoreElements() or nextElement() method was not implemented > correctly. Please check OJB's logging output. Any error log before the NoSuchElementException? By the way, this class is now deprecated because nobody seems to use it. If you need the PK values to create a user specific PrimaryKey class I would recommend (for best performance) a report query to get all PK's. regards, Armin > > Thanks, > > Robert Giddings > > > - > 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] -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.487 / Virus Database: 269.13.22/1013 - Release Date: 17/09/2007 13:29 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
getPKEnumerationByQuery()
Hi, When using the method getPKEnumerationByQuery() I get the following error: Caused by: java.util.NoSuchElementException at org.apache.ojb.broker.accesslayer.PkEnumeration.nextElement(Unknown S ource) at com.netcase.database.DAOService.getIdsByPropertyMatch(DAOService.java :117) Has anyone else had any problems using OJB's Enumeration implementation? As the code that iterates through it is this: Enumeration pks = broker.getPKEnumerationByQuery(PrimaryKey.class, query); Collection ids = new ArrayList(); while(pks.hasMoreElements()) { PrimaryKey pk = (PrimaryKey)pks.nextElement(); ids.add(pk.getId()); } And I can't see any problem with this code, and so can only conclude that the hasMoreElements() or nextElement() method was not implemented correctly. Thanks, Robert Giddings - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Overriding the ProxyList class
Hi Armin, I solved my problem. It was the protected method loadData() I needed to override. It worked but suffered from infinite loop problems when decrypting/encrypting because of a reference to the collection owner object in each of the collection element objects. I have since looked at other ideas and ways to resolve that issue. Thanks, Robert Giddings -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: 15 September 2007 00:10 To: OJB Users List Subject: Re: Overriding the ProxyList class Hi Robert, Robert Giddings wrote: > The line " but this isn't really practical as I can > override methods such as indexOf(Object o) as they rely on equals." > > Should read "can't override methods" because of relying on equals. > > Anyway, seems as if the ojb methods are never called as I put some > System.out.println() statements in all the methods, and the constructor > and getter/setters get called OK, but the ojb methods never print out > anything. > Why would they never get called? > I think OJB doesn't know about the List proxy class or do you declare this class as List/Collection/(Set) proxy in OJB.properties file? You can't declare specific collection proxy classes per 1:n, m:n reference only a general for all Collection, List and Set references. regards, Armin > Robert Giddings > > -Original Message- > From: Robert Giddings [mailto:[EMAIL PROTECTED] > Sent: 13 September 2007 10:16 > To: 'OJB Users List' > Subject: Overriding the ProxyList class > > Hi, > > Can anyone please tell me why this code doesn't seem to have an effect? > That is I get a class cast exception because an encrypted object for > example EncryptedCostCentre does not get decrypted to a CostCentre. Both > classes implement an interface called ICostCentre, but this interface > has no method signatures etc as the structure of the two classes is > different. I.e. CostCentre has getter/setters and EncryptedCostCentre > has an encrypt and decrypt methods. > The concept works fine, if I override the java.util.List methods and > encrypt and decrypt there, but this isn't really practical as I can > override methods such as indexOf(Object o) as they rely on equals. > The cypherMachine and encryptedClassType are set in the decrypt method > of the owner object, where a reference to the ICostCentre collection is > passed to the decrypted version of that object. > Also what changes am I likely to need to make to the afterStore method? > > Thanks, > > Robert Giddings > > > The code: > > > package com.netcase.database.ojb.proxy; > > import java.lang.reflect.Method; > > import java.util.Iterator; > > import org.apache.ojb.broker.ManageableCollection; > import org.apache.ojb.broker.PBKey; > import org.apache.ojb.broker.PersistenceBroker; > import org.apache.ojb.broker.PersistenceBrokerException; > import org.apache.ojb.broker.core.proxy.ListProxyDefaultImpl; > import org.apache.ojb.broker.query.Query; > > import com.netcase.encryption.CypherMachine; > > public class EncryptableCollectionProxy extends ListProxyDefaultImpl { > > private CypherMachine cypherMachine; > > private Class encryptedClassType; > > public EncryptableCollectionProxy(PBKey brokerKey, > java.lang.Class collClass, Query query) { > super(brokerKey, collClass, query); > cypherMachine = null; > encryptedClassType = null; > } > > public EncryptableCollectionProxy(PBKey brokerKey, Query query) > { > super(brokerKey, query); > cypherMachine = null; > encryptedClassType = null; > } > > /** >* @return the cypherMachine >*/ > public CypherMachine getCypherMachine() { > return cypherMachine; > } > > /** >* @param cypherMachine the cypherMachine to set >*/ > public void setCypherMachine(CypherMachine cypherMachine) { > this.cypherMachine = cypherMachine; > } > > /** >* @return the encryptedClassType >*/ > public Class getEncryptedClassType() { > return encryptedClassType; > } > > /** >* @param encryptedClassType the encryptedClassType to set >*/ > public void setEncryptedClassType(Class encryptedClassType) { > this.encryptedClassType = encryptedClassType; > } > > private Object decryptObject(Object o) { > try { > Method decrypt = > encryptedClassType.getMethod("d
RE: Overriding the ProxyList class
The line " but this isn't really practical as I can override methods such as indexOf(Object o) as they rely on equals." Should read "can't override methods" because of relying on equals. Anyway, seems as if the ojb methods are never called as I put some System.out.println() statements in all the methods, and the constructor and getter/setters get called OK, but the ojb methods never print out anything. Why would they never get called? Robert Giddings -----Original Message- From: Robert Giddings [mailto:[EMAIL PROTECTED] Sent: 13 September 2007 10:16 To: 'OJB Users List' Subject: Overriding the ProxyList class Hi, Can anyone please tell me why this code doesn't seem to have an effect? That is I get a class cast exception because an encrypted object for example EncryptedCostCentre does not get decrypted to a CostCentre. Both classes implement an interface called ICostCentre, but this interface has no method signatures etc as the structure of the two classes is different. I.e. CostCentre has getter/setters and EncryptedCostCentre has an encrypt and decrypt methods. The concept works fine, if I override the java.util.List methods and encrypt and decrypt there, but this isn't really practical as I can override methods such as indexOf(Object o) as they rely on equals. The cypherMachine and encryptedClassType are set in the decrypt method of the owner object, where a reference to the ICostCentre collection is passed to the decrypted version of that object. Also what changes am I likely to need to make to the afterStore method? Thanks, Robert Giddings The code: package com.netcase.database.ojb.proxy; import java.lang.reflect.Method; import java.util.Iterator; import org.apache.ojb.broker.ManageableCollection; import org.apache.ojb.broker.PBKey; import org.apache.ojb.broker.PersistenceBroker; import org.apache.ojb.broker.PersistenceBrokerException; import org.apache.ojb.broker.core.proxy.ListProxyDefaultImpl; import org.apache.ojb.broker.query.Query; import com.netcase.encryption.CypherMachine; public class EncryptableCollectionProxy extends ListProxyDefaultImpl { private CypherMachine cypherMachine; private Class encryptedClassType; public EncryptableCollectionProxy(PBKey brokerKey, java.lang.Class collClass, Query query) { super(brokerKey, collClass, query); cypherMachine = null; encryptedClassType = null; } public EncryptableCollectionProxy(PBKey brokerKey, Query query) { super(brokerKey, query); cypherMachine = null; encryptedClassType = null; } /** * @return the cypherMachine */ public CypherMachine getCypherMachine() { return cypherMachine; } /** * @param cypherMachine the cypherMachine to set */ public void setCypherMachine(CypherMachine cypherMachine) { this.cypherMachine = cypherMachine; } /** * @return the encryptedClassType */ public Class getEncryptedClassType() { return encryptedClassType; } /** * @param encryptedClassType the encryptedClassType to set */ public void setEncryptedClassType(Class encryptedClassType) { this.encryptedClassType = encryptedClassType; } private Object decryptObject(Object o) { try { Method decrypt = encryptedClassType.getMethod("decrypt", CypherMachine.class); return decrypt.invoke(o, cypherMachine); } catch(Exception e) { return null; } } private Object encryptObject(Object o) { try { Method encrypt = encryptedClassType.getMethod("encrypt", CypherMachine.class); return encrypt.invoke(o, cypherMachine); } catch(Exception e) { return null; } } public void ojbAdd(Object anObject) { super.ojbAdd(this.decryptObject(anObject)); } public void ojbAddAll(ManageableCollection otherCollection) { Iterator i = otherCollection.ojbIterator(); while(i.hasNext()) { this.ojbAdd(i.next()); } } public Iterator ojbIterator() { EncryptableCollectionProxy ecp = new EncryptableCollectionProxy(this.getBrokerKey(), this.getCollectionClass(), this.getQuery()); for(Object o: this) { ecp.add(this.encry
Overriding the ProxyList class
Hi, Can anyone please tell me why this code doesn't seem to have an effect? That is I get a class cast exception because an encrypted object for example EncryptedCostCentre does not get decrypted to a CostCentre. Both classes implement an interface called ICostCentre, but this interface has no method signatures etc as the structure of the two classes is different. I.e. CostCentre has getter/setters and EncryptedCostCentre has an encrypt and decrypt methods. The concept works fine, if I override the java.util.List methods and encrypt and decrypt there, but this isn't really practical as I can override methods such as indexOf(Object o) as they rely on equals. The cypherMachine and encryptedClassType are set in the decrypt method of the owner object, where a reference to the ICostCentre collection is passed to the decrypted version of that object. Also what changes am I likely to need to make to the afterStore method? Thanks, Robert Giddings The code: package com.netcase.database.ojb.proxy; import java.lang.reflect.Method; import java.util.Iterator; import org.apache.ojb.broker.ManageableCollection; import org.apache.ojb.broker.PBKey; import org.apache.ojb.broker.PersistenceBroker; import org.apache.ojb.broker.PersistenceBrokerException; import org.apache.ojb.broker.core.proxy.ListProxyDefaultImpl; import org.apache.ojb.broker.query.Query; import com.netcase.encryption.CypherMachine; public class EncryptableCollectionProxy extends ListProxyDefaultImpl { private CypherMachine cypherMachine; private Class encryptedClassType; public EncryptableCollectionProxy(PBKey brokerKey, java.lang.Class collClass, Query query) { super(brokerKey, collClass, query); cypherMachine = null; encryptedClassType = null; } public EncryptableCollectionProxy(PBKey brokerKey, Query query) { super(brokerKey, query); cypherMachine = null; encryptedClassType = null; } /** * @return the cypherMachine */ public CypherMachine getCypherMachine() { return cypherMachine; } /** * @param cypherMachine the cypherMachine to set */ public void setCypherMachine(CypherMachine cypherMachine) { this.cypherMachine = cypherMachine; } /** * @return the encryptedClassType */ public Class getEncryptedClassType() { return encryptedClassType; } /** * @param encryptedClassType the encryptedClassType to set */ public void setEncryptedClassType(Class encryptedClassType) { this.encryptedClassType = encryptedClassType; } private Object decryptObject(Object o) { try { Method decrypt = encryptedClassType.getMethod("decrypt", CypherMachine.class); return decrypt.invoke(o, cypherMachine); } catch(Exception e) { return null; } } private Object encryptObject(Object o) { try { Method encrypt = encryptedClassType.getMethod("encrypt", CypherMachine.class); return encrypt.invoke(o, cypherMachine); } catch(Exception e) { return null; } } public void ojbAdd(Object anObject) { super.ojbAdd(this.decryptObject(anObject)); } public void ojbAddAll(ManageableCollection otherCollection) { Iterator i = otherCollection.ojbIterator(); while(i.hasNext()) { this.ojbAdd(i.next()); } } public Iterator ojbIterator() { EncryptableCollectionProxy ecp = new EncryptableCollectionProxy(this.getBrokerKey(), this.getCollectionClass(), this.getQuery()); for(Object o: this) { ecp.add(this.encryptObject(o)); } return ecp.ojbIterator(); } public void afterStore(PersistenceBroker broker) throws PersistenceBrokerException { super.afterStore(broker); } } An example of the XDoclet code is: /** * @ojb.collection element-class-ref="com.netcase.netspat.recordSystem.encryption.encrypted Objects.EncryptedCostCentre" * foreignkey="clientId" * proxy="true" * auto-retrieve="true" * auto-update="none" * auto-d
RE: Error with nested class
Thanks -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: 10 September 2007 13:05 To: OJB Users List Subject: Re: Error with nested class Hi Robert, Robert Giddings wrote: > Hi Armin, > > Here is the code of the class and inner class in question. > > Rob > > package com.netcase.netspat.recordSystem.bo; > > import com.netcase.bo.BaseObject; > > public class Country extends BaseObject { > ... > /* >* Nested >*/ > > /** >* @ojb.nested >* @ojb.modify-nested name="id" > *primarykey="" >*/ > private CountryDateSet publicationDates; > ... > > /* >* Constructors >*/ > > public Country() { > super(); > } > ... > > > public class CountryDateSet extends BaseObject { > > /* >* Fields >*/ OJB can't instantiate a non-static inner class. Declare CountryDateSet as static inner class - this should solve the problem (this is only possible if CountryDateSet doesn't use access to outer class Country members - I don't check this). regards, Armin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.485 / Virus Database: 269.13.12/997 - Release Date: 09/09/2007 10:17 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Error with nested class
/ public void setLatestDate(CountryDateOptions latestDate) { this.latestDate = latestDate; } } public enum CountryDateOptions { PRIORITY, SUBSTANTIVE_FILING, ACTUAL_FILING_DATE, SUBMIT_SEARCH_REQUEST, SUBMIT_EXAMINATION_REQUEST, GRANT_ACCEPTANCE, ACTUAL_GRANT; } public enum EPMemberOptions { NO, NORMAL, EXTENSION; } public enum EPTranslationOptions { ALL_PAGES, CLAIMS_PAGES_ONLY; } public enum PCTMemberOptions { YES, NO, YES_BUT_NO_FILING_ALLOWED; } public enum RenewalsOptions { NO_RENEWALS, ANNIVERSARIES_FROM_SF, ANNIVERSARIES_FROM_SF_CATCH_UP_FROM_GRANT, MONTHS_FROM_GRANT, ANNIVERSARIES_FROM_GRANT, CLAIMS_BASED_RENEWALS; } } -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: 10 September 2007 10:34 To: OJB Users List Subject: Re: Error with nested class Hi Robert, could you please post the mapping and java source for class Country (I expect that this is the class which declares field 'publicationDates'?) too. regards, Armin Robert Giddings wrote: > Hi, > > Can anyone tell me why I get this runtime exception when using OJB as > the inner class is neither abstract nor an interface and has a no > parameter default constructor. The inner class does extend an abstract > class, but that doesn't seem to be a problem. > > Thanks, > > Robert Giddings > > Caused by: org.apache.ojb.broker.metadata.MetadataException: Can't > create nested > object of type 'class > com.netcase.netspat.recordSystem.bo.Country$CountryDateSe > t' for field 'publicationDates' > at > org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectImpl. > set(Unknown Source) > at > org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.buildOrRefresh > Object(Unknown Source) > at > org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.readObjectFrom > (Unknown Source) > at > org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(U > nknown Source) > at org.apache.ojb.broker.accesslayer.RsIterator.next(Unknown > Source) > at > org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery( > Unknown Source) > at > org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery( > Unknown Source) > at > org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery( > Unknown Source) > at > org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery > (Unknown Source) > at > org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionB > yQuery(Unknown Source) > at > org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionB > yQuery(Unknown Source) > at > com.netcase.database.DAOService.getObjectsByType(DAOService.java:41) > ... 21 more > Caused by: java.lang.InstantiationException: > com.netcase.netspat.recordSystem.bo > .Country$CountryDateSet > at java.lang.Class.newInstance0(Class.java:335) > at java.lang.Class.newInstance(Class.java:303) > at org.apache.ojb.broker.util.ClassHelper.newInstance(Unknown > Source) > ... 33 more > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.485 / Virus Database: 269.13.12/997 - Release Date: 09/09/2007 10:17 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Error with nested class
Hi, Can anyone tell me why I get this runtime exception when using OJB as the inner class is neither abstract nor an interface and has a no parameter default constructor. The inner class does extend an abstract class, but that doesn't seem to be a problem. Thanks, Robert Giddings Caused by: org.apache.ojb.broker.metadata.MetadataException: Can't create nested object of type 'class com.netcase.netspat.recordSystem.bo.Country$CountryDateSe t' for field 'publicationDates' at org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectImpl. set(Unknown Source) at org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.buildOrRefresh Object(Unknown Source) at org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.readObjectFrom (Unknown Source) at org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(U nknown Source) at org.apache.ojb.broker.accesslayer.RsIterator.next(Unknown Source) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery( Unknown Source) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery( Unknown Source) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery( Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery (Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionB yQuery(Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionB yQuery(Unknown Source) at com.netcase.database.DAOService.getObjectsByType(DAOService.java:41) ... 21 more Caused by: java.lang.InstantiationException: com.netcase.netspat.recordSystem.bo .Country$CountryDateSet at java.lang.Class.newInstance0(Class.java:335) at java.lang.Class.newInstance(Class.java:303) at org.apache.ojb.broker.util.ClassHelper.newInstance(Unknown Source) ... 33 more
Oracle timestamp with time zone
Hi All, Is there a way to save and retrieve data to/from Oracle such that all of the information in Oracle's "timestamp with time zone" data type is preserved? (e.g. data like "October 29, 2006 1:30 A.M. Eastern Daylight Time"). So far, we've only been able to get date/time/time zone information - we can't find a way to also retrieve the daylight saving's information. We're currently using Oracle 10 and the ojb 1.1.0 branch. Thanks for any input you can provide, Jim smime.p7s Description: S/MIME cryptographic signature
Oracle timestamp with time zone
Hi All, Is there a way to save and retrieve data to/from Oracle such that all of the information in Oracle's "timestamp with time zone" data type is preserved? (e.g. data like "October 29, 2006 1:30 A.M. Eastern Daylight Time"). So far, we've only been able to get date/time/time zone information - we can't find a way to also retrieve the daylight saving's information. We're currently using Oracle 10 and the ojb 1.1.0 branch. Thanks for any input you can provide, Jim smime.p7s Description: S/MIME cryptographic signature
Problem with findByTemplate
Hello, I'm developing in Eclipse 3.1.2 with the Tomcat (3.1.0) and OJB (3.01.) plugins. I've got a value object with the following: private Integer userNum; private String screenName; private String passwordOne; private String emailOne; private String sex; private java.sql.Date birthDate; private float initialWeight; private float height; private float targetWeight; private java.sql.Date expDate; private java.sql.Date startDate; private String transactionXID; private String creditAuth; private long lessonNum; public Vector weight = new Vector(); // of type WeightVO There are get/set methods for all. The mapping in repository.xml (to PostgreSQL 8.0) is: My problem is that I cannot populate the value object with the email/password combination and find the entry in the database. I have used the findByTemplate methods in the OJB tutorial. debug shows this: 2006-04-18 18:53:13,491 {http-8080-Processor25} DEBUG org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl -createPool was called 2006-04-18 18:53:13,585 {http-8080-Processor25} DEBUG org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl -makeObject called 2006-04-18 18:53:15,743 {http-8080-Processor25} DEBUG org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl -Create new connection using DriverManager: [EMAIL PROTECTED] 2006-04-18 18:53:15,759 {http-8080-Processor25} DEBUG org.apache.ojb.broker.accesslayer.ConnectionManagerImpl -Request new connection from ConnectionFactory: [EMAIL PROTECTED] 2006-04-18 18:53:16,025 {http-8080-Processor25} DEBUG org.apache.ojb.broker.accesslayer.JdbcAccessImpl -executeQuery: SELECT A0.password,A0.initial_weight,A0.user_num,A0.credit_auth,A0.lesson_num, A0.transaction_xid,A0.sex,A0.height,A0.target_weight,A0.dob,A0.email, A0.screen_name,A0.start_date,A0.exp_date FROM users A0 WHERE ( A0.password = d) AND A0.email = [EMAIL PROTECTED]) AND A0.initial_weight = 0.0) AND A0.height = 0.0) AND A0.target_weight = 0.0) AND A0.lesson_num = 0 2006-04-18 18:53:16,334 {http-8080-Processor25} DEBUG org.apache.ojb.broker.accesslayer.RsIterator -RsIterator[ org.apache.ojb.broker.accesslayer.RsQueryObject[query: QueryByCriteria from class com.beeslender.userdata.UserVO where [passwordOne = d, emailOne = [EMAIL PROTECTED], initialWeight = 0.0, height = 0.0, targetWeight = 0.0, lessonNum = 0], class descriptor: com.beeslender.userdata.UserVO]] initialized 2006-04-18 18:53:16,358 {http-8080-Processor25} DEBUG org.apache.ojb.broker.accesslayer.RsIterator -hasNext() -> false 2006-04-18 18:53:16,366 {http-8080-Processor25} DEBUG org.apache.ojb.broker.core.PersistenceBrokerImpl -PB.close was called: [EMAIL PROTECTED] I've read the Howto and Tutorial, Googled for the past several hours and can't find what I'm doing wrong. Can anyone give me a little guidance? Much Appreciated, Bob Harrison -- "In theory there is no difference between theory and practice. In practice there is." Yogi Berra
Save Data with Default Database Column
Hy List, We have an Database-Table with an default-Column (now()), and want to save data in it. How can i configure OJB to insert Data in this table to use the Database-Funktion to create the Data of this field? The Table is created like this: --- cut --- CREATE TABLE import_log ( log_tst TIMESTAMP NOT NULL DEFAULT now(), log_importer VARCHAR(64), PRIMARY KEY (log_tst) ); --- cut --- normaly i can Insert Data into the Table like --- cut --- INSERT INTO import_log (log_importer) VALUES ('re'); --- cut --- can i let OJB do the same? Thanks for Help best Greetings, \Robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Solved] Re: Caching of ojb and hsqldb
Hy Armin, yes, it works. Thanks a lot. \Robert Armin Waibel schrieb: Hi Robert, think it could be a problem with the SET WRITE_DELAY {{TRUE | FALSE} | | MILLIS setting of hsql. http://hsqldb.org/doc/guide/ch04.html#N10D67 regards, Armin Robert Einsle wrote: Hy List, i have an strange problem using ojb 1.0.3 on Hsqldb 1.8.0. We develop an RichClientApplication, and ojb is our Tool doing the Mapping between Java Pois and the Database. On Laptops, we are using HsqlDB as Client-Database. When we store an Java-Object and exit the Application, the Data isn't in the Database. When we wait for about 20 seconds, then the Data is stored in the Database. Using another Database (like Postgres) the Data ist Stored quikly. Has anyone an Hint how to resolve this Problem? Thanks for Help - 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]
Caching of ojb and hsqldb
Hy List, i have an strange problem using ojb 1.0.3 on Hsqldb 1.8.0. We develop an RichClientApplication, and ojb is our Tool doing the Mapping between Java Pois and the Database. On Laptops, we are using HsqlDB as Client-Database. When we store an Java-Object and exit the Application, the Data isn't in the Database. When we wait for about 20 seconds, then the Data is stored in the Database. Using another Database (like Postgres) the Data ist Stored quikly. Has anyone an Hint how to resolve this Problem? Thanks for Help - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Posibility to let ojb create the Database-Tables
Hy List, is ist posible to let OJB automaticly create and alter the Database-Tables? I think hibernate has this feature, and for developement, i think, it is very usefully. Thanks for answer. \Robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Cleaning up OJB when shutting down an application
y}, if any. * @param key * @return null if no open [EMAIL PROTECTED] org.apache.ojb.broker.PersistenceBroker} found. */ public static PersistenceBroker currentPersistenceBroker(PBKey key) throws PBFactoryException, PersistenceBrokerException { HashMap map = (HashMap) currentBrokerMap.get(); WeakHashMap set; PersistenceBroker broker = null; if (map == null) { return null; } set = (WeakHashMap) map.get(key); if (set == null) { return null; } // seek for an open broker, preferably in transaction for (Iterator it = set.keySet().iterator(); it.hasNext(); ) { PersistenceBroker tmp = (PersistenceBroker) it.next(); if (tmp == null || tmp.isClosed()) { it.remove(); continue; } broker = tmp; if (tmp.isInTransaction()) { break; // the best choice found } } return broker; } /** Clean up static fields and any registered ThreadLocal contents to grant a clean * shutdown/reload of OJB within hot-deployable applications. */ public static void shutdown() { for ( Iterator it = loadedHMs.iterator(); it.hasNext(); ) { ((HashMap) it.next()).clear(); } loadedHMs.clear(); loadedHMs = null; currentBrokerMap = null; } } > Hi Danilo, Bob, > > AFAIK there was no patch checked in conjunction with PBThreadMapping. > As you said the threads in tomcat will be recycled and it seems that > ThreadLocal will cause a memory leak in this case: > http://www.jroller.com/page/tackline/20050310 > (sounds similar, but maybe I'm wrong) > > So we need some kind of shutdown method in PBF and in PBThreadMapping. > Could you both summarize the needed changes I will check in a patch. I > found the patch for PBThreadMapping (the new "shutdown"-method). > What's needed too? > > regards, > Armin > > Danilo Tommasina wrote: > >> Hello, >> >> please see my post 'ThreadLocal causing memory leak' of 9. Jun. 2005, >> this is the same problem described there. I posted some code that can >> be used as temporary solution or workaround and discussed a bit about >> the issue with Martin Kalén, however I do not know the current >> status... >> >> Both the workaround in the PersistenceBrokerFactoryDefaultImpl and my >> proposed 'clean' solution in the PersistenceBrokerThreadMapping (I >> sent the definitive code directly to Martin) seems to work correctly >> in our application. To note is that we are using only the PB API and >> are not using proxies. The workaround in the >> PersistenceBrokerFactoryDefaultImpl 'may' cause problems or >> performance issues with proxies, however I cannot test it, I did just >> a short and not very deep analysis of the code searching for possible >> side effects. >> >> As I cannot currently access the apache CVS (it seems to be flooded >> and it is currently down), I cannot say if the issue has already been >> patched in the latest CVS version or not. >> >> bye >> Danilo >> >> Glugla, Robert T wrote: >> >>> Environment: >>> >>> OJB: 1.0.3 >>> JProfiler: 4.0.1 >>> Tomcat: 5.0.19 >>> JVM: Sun 1.4.2_06-b03 >>> >>> While profiling our OJB application, we noticed that after we shut >>> it down in Tomcat, we had plenty of org.apache.ojb.broker.* and >>> org.apache.ojb.metadata.* objects left behind in memory. Using >>> JProfiler we tracked it down to several static variables not getting >>> cleared out >>> including: >>> >>> PersistenceBrokerFactoryFactory.singleton >>> MetadataManager.singleton >>> ...several others... >>> >>> Does anyone have any suggestions as to how to clean these up >>> properly? I looked for destroy methods and couldn't find any. As a >>> test, I downloaded the OJB source and added destroy methods to >>> PersistenceBrokerFactoryFactory & MetadataManager that I called from >>> a context listener and it worked ok. Really, really don't want to >>> do this myself. I'm guessing I'm just overlooking some easy way for >>> cleaning these up already provided in OJB. >>> >>> Any suggestions? >>> >>> Thanks. >>> >>> Bob Glugla >>> Boeing >>> >>> --
Cleaning up OJB when shutting down an application
Environment: OJB:1.0.3 JProfiler: 4.0.1 Tomcat: 5.0.19 JVM:Sun 1.4.2_06-b03 While profiling our OJB application, we noticed that after we shut it down in Tomcat, we had plenty of org.apache.ojb.broker.* and org.apache.ojb.metadata.* objects left behind in memory. Using JProfiler we tracked it down to several static variables not getting cleared out including: PersistenceBrokerFactoryFactory.singleton MetadataManager.singleton ...several others... Does anyone have any suggestions as to how to clean these up properly? I looked for destroy methods and couldn't find any. As a test, I downloaded the OJB source and added destroy methods to PersistenceBrokerFactoryFactory & MetadataManager that I called from a context listener and it worked ok. Really, really don't want to do this myself. I'm guessing I'm just overlooking some easy way for cleaning these up already provided in OJB. Any suggestions? Thanks. Bob Glugla Boeing - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Derby on OJB?
Hey Has anyone successfully gotten Derby to work with OJB, and if so what platform did you use to specify OJB to use? I have it set to DB2 right now, but I'm not getting any love from it, OJB is complaining that the schema does not exist, but in my little test JSP it indeed does exist and works when I connect directly using a Connection. Thanks R - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: question about collection references...
Bobby Lawrence wrote: Thanx Robert. I am letting OJB handle the PK/FK stuff - that is the problem is seems. I have one object, but I want to change a field...this field is a PK. I want OBJ to update, but it inserts a new one... --Bobby I could be wrong as I am not very familiar w/ the internals of OJB's code, maybe one of the commiters can help more, but my understanding is that if you change a PK then OJB is going to interpret this as new/different object than before, since the PK is what it is using to track identity. You can setup SQL debugging to see the exact statements generated; but my guess is that the best you are going to be able to do is: clone your Object, delete the old object, add the new object (using a custom sequence manager). If you really want to take things into your own hands I guess you could get a java.sql.Connection object from OJB and use that to issue SQL update commands, then flush the object cache... -- Robert r. Sanders Chief Technologist iPOV (334) 821-5412 www.ipov.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: question about collection references...
Bobby Lawrence wrote: How does OJB handle collection references internally? If I have an object that contains a collection of other objects, and I remove one, will OJB remove that same one from the database? If you use that API correctly (see the tutorials), then yes, OJB with track changes to collections, etc... Typical setup is so that if you remove an object from a collection the foriegn key is removed in the DB, but the actual 'object'/row is still there unless you explicitly delete this. I can't remember off the top of my head, but I believe there is a configuration option (per-collection) to change this so a remove == a db delete. Also - if I have a collection that contains only one object and I change the primary key, does OJB update that object or insert a new one? I seems like the latter... You should let OJB handle the primary (and foreign) keys for you; they end up being the items that OJB is using to track object identity, so the behavior that your seeing is not unexpected (changing the primary key essentially changes the object reference as far as the SQL portion of OJB is concerned). -- Robert r. Sanders Chief Technologist iPOV (334) 821-5412 www.ipov.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat 5.5.9 and OJB?
On Apr 20, 2005, at 7:01 PM, [EMAIL PROTECTED] wrote: java.lang.NoClassDefFoundError: org/apache/commons/dbcp/ AbandonedConfig Do you have the wrong version of commons dbcp? Or perhaps does Tomcat 5.5.9 include one by default and it's colliding with what OJB is expecting? R Robert S. Sfeir robert(at)codepuccinoNOSPAM.com "Make everything as simple as possible, but not simpler" - Einstein - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OJB queries.....
If I understand your question: Since OJB is a object-to-relational mapping framework this is done in steps: First you map the java classes that you want to store to the database tables and columns using the repository.xml Second you query using one of the OJB APIs; the query is for the Java Object you want, and references Objects, Fields, etc... not tables and columns. Then OJB translates your query into SQL, runs the SQL, and constructs Objects from the returns values. So, if what you want to do is run a query that joins multiple tables, then setting up the repository.xml correctly should be all you need to do. If you are asking how to map one class onto multiple tables then the section of the docs at http://db.apache.org/ojb/docu/guides/advanced-technique.html#Mapping+Classes+on+Multiple+Joined+Tables explains it (partially). If this doesn't help, then please try rephrasing your question and maybe I will be able to understand it better. jefferson chaves gomes wrote: Hi, I'm from Brazil, then it forgives my English, I want to use OJB and divulge it in Brazil, but I have a problem .. How I can do a querie with more than one table. For example(this example was removed of your site OK): I know that this reply it is in the site: http://db.apache.org/ojb/docu/guides, but I am not understanding. Please, you can say me as to make this example below since the beginning, or either, with the mapping of the archive repository_database.xml and the necessary classes .java for I make it ? SELECT DISTINCT A0.ID, A1.VALUEFROM CONTAINER A0 INNER JOIN ABSTRACT_ATTRIBUTE A1 ON A0.ID=A1.REF_ID INNER JOIN ABSTRACT_ATTRIBUTE A2 ON A0.ID=A2.REF_ID INNER JOIN ABSTRACT_ATTRIBUTE A3 ON A0.ID=A3.REF_IDWHERE (( A0.NAME = 'companyName' ) AND (A0.VALUE = 'iBanx' )) AND (( A1.NAME = 'contactPerson' ) AND (A1.VALUE LIKE '%janssen%' )) AND (( A2.NAME = 'size' ) AND (A2.VALUE = '500' )) My main doubt is: How to work with more than with one table ? This because to use one table in the querie for me is not problem OK? Please, help me to learn and to divulge this framework here in Brazil -- Robert r. Sanders Chief Technologist iPOV (334) 821-5412 www.ipov.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: status on 1.02 release?
Brian is working on the release as we speak. R On Mar 24, 2005, at 12:08 PM, Ryan Vanderwerf wrote: Just checking if anyone knows the target date for 1.02? I am looking to upgrade but am afraid of the cache problem in 1.01. Ryan !DSPAM:42434831247681776579306! Robert S. Sfeir robert(at)codepuccinoNOSPAM.com "Make everything as simple as possible, but not simpler" - Einstein - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How does OBJ find it's Config (Eclipse Plugin)
Hy, i make this like the others Java-Projects, a have an seperate resources-Folder, putting the OJB-Configuration in it. The Structure is: WEB-INF/ src resources classes Where the propperties are in resources. This is working. My Problem is the usage in an Eclipse-RCP-Application. Here the Classloader is different, and found an solution, overwriting the ClassLoader. Thanks for Help \Robby Vamsi Atluri schrieb: If you have a web application, the OJB.properties will be found if placed under WEB-INF/classes folder. But there is a problem with this folder. If you rebuild the entire project, the classes folder is wiped out first. So, your OJB.properties file will be lost. I am still trying to find a solution this problem. However, I am using WSAD. I am sure the behavior will be similar in Eclipse. Hope this helps. -Vamsi --- Robert Einsle <[EMAIL PROTECTED]> wrote: Hy List, i'm wondering, OBJ don't find its config in an Eclipse Plugin (or Eclipse RCP). Starting the Application, while loading OBJ, it reports me: --- cut --- [BOOT] WARN: Could not load properties file 'OJB.properties'. Using default settings! /home/re/OJB.properties (Datei oder Verzeichnis nicht gefunden) java.io.FileNotFoundException: /home/re/OJB.properties (Datei oder Verzeichnis nicht gefunden) --- cut --- Eclipse workspace is in /home/re/workspaces/lakon Normaly OBJ loads its config over the Classloader,, but here, it will not work. I don't knew what to do, hope, someone here can help me. Thanks. \Robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How does OBJ find it's Config (Eclipse Plugin)
Hy, Starting like an normal Java-Application, i can set this Setting, but not link an Eclipse Application. But i found an resolution, setting the ClassLoader: ClassHelper.setClassLoader(getClass().getClassLoader()); Yet, it is working. Thanks. \Robert Jakob Braeuchi schrieb: hi robert, it's in the arguments screen of the run-config. jakob Robert Einsle schrieb: - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How does OBJ find it's Config (Eclipse Plugin)
Hy Jakob, can you give me an Tip where to find this Setting?? I use Eclipse 3.0.1 Thanks. \Robert Jakob Braeuchi schrieb: hi robert, i always use the 'working directoty' setting in the run config to point to the directory where the repository resides, ie: ${workspace_loc:db-ojb}/target/test/ojb or ${workspace_loc:db-ojb}/src/test/org/apache/ojb db-ojb is the name of the eclipse-project. hth jakob Robert Einsle schrieb: Hy List, i'm wondering, OBJ don't find its config in an Eclipse Plugin (or Eclipse RCP). Starting the Application, while loading OBJ, it reports me: --- cut --- [BOOT] WARN: Could not load properties file 'OJB.properties'. Using default settings! /home/re/OJB.properties (Datei oder Verzeichnis nicht gefunden) java.io.FileNotFoundException: /home/re/OJB.properties (Datei oder Verzeichnis nicht gefunden) --- cut --- Eclipse workspace is in /home/re/workspaces/lakon Normaly OBJ loads its config over the Classloader,, but here, it will not work. I don't knew what to do, hope, someone here can help me. Thanks. \Robert - 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]
How does OBJ find it's Config (Eclipse Plugin)
Hy List, i'm wondering, OBJ don't find its config in an Eclipse Plugin (or Eclipse RCP). Starting the Application, while loading OBJ, it reports me: --- cut --- [BOOT] WARN: Could not load properties file 'OJB.properties'. Using default settings! /home/re/OJB.properties (Datei oder Verzeichnis nicht gefunden) java.io.FileNotFoundException: /home/re/OJB.properties (Datei oder Verzeichnis nicht gefunden) --- cut --- Eclipse workspace is in /home/re/workspaces/lakon Normaly OBJ loads its config over the Classloader,, but here, it will not work. I don't knew what to do, hope, someone here can help me. Thanks. \Robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Excalibur Integration
I haven't tried putting the xml files in a jar before as I've felt that I wanted to preserve the editablity. It sounds like the entity resolver (or some such, my xml terminology isn't the best) is only looking in the file system. From my understanding there is a way to implement custom entity resolvers, and I think even some open source ones that will load from classpath I think this is what you'd need to do. Alternatively, you might look at the Spring support for OJB which should allow you to configure a bean with the datasource configuration and then propogate that where needed. Markus Wolf wrote: Martin Kalén wrote: Markus Wolf wrote: > is there a way to reuse existing connections for the whole OJB > setup? I've implemented a ConnectionFactory for OJB as Excalibur > component, but when I create a new database and open it (as stated > in the tutorials) the repository_database.xml part is always > expected. Are there any workarounds? (Best would be a complete > reuse of existing connections without having to specify a > repository_database.xml) Or maybe is there some way to put the > repository_database.xml in a jar-file (which is possible for the > entiry repository.xml but only for the whole file...) Without going into the re-use issue I can just report that there is no problem placing the different repository*.xml files in a JAR. Just make sure the DTD is there to make XML-validation possible. The files are loaded without path so place the in the root of your JAR. So doesn't this log output mean the files are not found?... Am I missing something here? Can anybody give me a hint how to successful load the repository.xml from a jar-file? I have all repository parts in the root (default-package) of my jar-file. [snip console-output] ... [org.apache.ojb.broker.metadata.RepositoryPersistor] INFO: OJB Descriptor Repository: jar:file:/home/markusw/temp/jservices/jservices-server-0.0.1.jar!/repository.xml [org.apache.ojb.broker.metadata.RepositoryPersistor] INFO: Building repository from :jar:file:/home/markusw/temp/jservices/jservices-server-0.0.1.jar!/repository.xml [org.apache.ojb.broker.metadata.RepositoryPersistor] DEBUG: RespostoryPersistor using SAXParser : org.apache.xerces.jaxp.SAXParserImpl [org.apache.ojb.broker.metadata.RepositoryXmlHandler] DEBUG: startDoc [org.apache.ojb.broker.metadata.MetadataManager] INFO: No repository.xml file found, starting with empty metadata and connection configuration [org.apache.ojb.broker.metadata.MetadataManager] INFO: No 'default-connection' attribute set in jdbc-connection-descriptors, thus it's currently not possible to use 'defaultPersistenceBroker()' convenience method to lookup PersistenceBroker instances. But it's possible to enable this at runtime using 'setDefaultKey' method. ... [/snip] Regards Markus Wolf -- Robert r. Sanders Chief Technologist iPOV (334) 821-5412 www.ipov.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ANY database?
OJB uses different profiles for different databases, defaulting to a generic SQL profile is no more specific profile can be found. I suggest that you try out a simple test and see if it works, if so there is an extensive test suite that you could run to verify functionality. Also if your DB doesn't work fully, and you still want to use it and OJB then the customizations to make it work shouldn't be too painful. David Cavassana wrote: Is the OJB compatible with ANY database? And is OJB compatible with Centura SQLBase? Thanks... __ Converse com seus amigos em tempo real com o Yahoo! Messenger http://br.download.yahoo.com/messenger/ -- Robert r. Sanders Chief Technologist iPOV (334) 821-5412 www.ipov.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Strange stack
Someone please correct me if I am wrong, but I think the PersistenceBroker is single threaded - meaning that you will either need to write code to explicitly manage sync. of threads, or use multiple PersistenceBrokers, one-per-thread. Xavier Roques wrote: Hi, I'm using OJB 1.0 RC5. I have many threads sharing the same broker. they only use the borker to read in the database. Sometimes, I got this very strange error. INFO | jvm 1| 2005/03/08 21:10:02 | java.lang.ArrayIndexOutOfBoundsException INFO | jvm 1| 2005/03/08 21:10:02 | at java.lang.System.arraycopy(Native Method) INFO | jvm 1| 2005/03/08 21:10:02 | at org.apache.ojb.broker.core.PersistenceBrokerAbstractImpl.addListener(Persist enceBrokerAbstractImpl.java:112) INFO | jvm 1| 2005/03/08 21:10:02 | at org.apache.ojb.broker.core.PersistenceBrokerAbstractImpl.addListener(Persist enceBrokerAbstractImpl.java:87) INFO | jvm 1| 2005/03/08 21:10:02 | at org.apache.ojb.broker.accesslayer.RsIterator.(RsIterator.java:205) INFO | jvm 1| 2005/03/08 21:10:02 | at org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(RsIterator FactoryImpl.java:58) INFO | jvm 1| 2005/03/08 21:10:02 | at org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(Pers istenceBrokerImpl.java:1791) INFO | jvm 1| 2005/03/08 21:10:02 | at org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Persis tenceBrokerImpl.java:1321) INFO | jvm 1| 2005/03/08 21:10:02 | at org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(Persistenc eBrokerImpl.java:1432) INFO | jvm 1| 2005/03/08 21:10:02 | at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Dele gatingPersistenceBroker.java:301) INFO | jvm 1| 2005/03/08 21:10:02 | at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery How can I get rid of this ? Thanks, Xavier. -- Robert r. Sanders Chief Technologist iPOV (334) 821-5412 www.ipov.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Pooling questions
I have had problems with pooling in the past; currently I have an OJB based app running (against a MySQL db) using the following pooling: Vincent Frison wrote: Hi all, I have sometimes troubles with pooling. One of the most frequent exception is: An action has failed: Borrow broker from pool failed, using PBKey org.apache.ojb.broker.PBKey: jcdAlias=default, user=null, password=null It seems that I explode the broker pool capacity (altough I close brokers as soon as possible). I'm not very familiar with pooling so please don't blame me. My poor brain can just understand that there is two different pools: one for the OJB brokers and optionally another one for the JDBC connections. Okay. But there is a lot of points which are very dark. 1) Configuring the PB pool The default values in OJB.properties looks very strange for me: maxIdle=-1 timeBetweenEvictionRunsMillis=-1 If I read the comments, there's no limit and no eviction for idle brokers, so it it sounds for me that they can grow indefinitely (even if whenExhaustedAction != 2)! Or maybe the maxActive value limits idle brokers too? 2) Configuring the JDBC connections pool a) Regarding to OJB: Depending on how OJB brokers handles JDBC connections, is there any rules to respect when configuring this the pools, e.g. PB pool maxActive > JDBC pool maxActive? I guess this is not mandatory since OJB brokers use JDBC connection factory (which could not use pooling btw) and close connections properly, but i'd like to be sure.. b) vs. : I use OJB within Tomcat 5.0.x and I have a JNDI DataSource defined in Tomcat (DBCP Factory). If I want to use it with OJB, I have to declare it in the attribute of . In this case does it mean that OJB don't manage the pool itself and that the declaration will be ignored? Is the ConnectionFactoryDBCPImpl mandatory in that case? Apparently it works better if I use it (compared to ConnectionFactoryPooledImpl). But if a JNDI DataSource - which is not implemented with DBCP - is declared in my container, should I stay with the default implementation? Thanks a lot.. Vinz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Robert r. Sanders Chief Technologist iPOV (334) 821-5412 www.ipov.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sorting Child Objects
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Feb 8, 2005, at 2:06 PM, Jakob Braeuchi wrote: hi robert, imo this behaviour is not specific to child objects. i would also expect it when using getCollectionByQuery with a 'non-sortable' collection class. so i think we'd better document it. Hum I have a few of those, and I don't see the behavior, weird. OK better document for sure... problem is often folks won't read docs, I was thinking a more blunt approach might get their attention :-) R -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (Darwin) iD8DBQFCCRmcJhqny0eCHK8RAhbkAJ4kqFNJk6HbKP6YOfHQB3h29/Z9cQCghtl0 H8EGGemCoo0IjpgMOkGlBm0= =x8nO -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sorting Child Objects
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Feb 8, 2005, at 9:33 AM, Christoph Hermann wrote: ObjectCachePerBrokerImpl now its working fine (until i get a problem with that ;-)). You wouldn't be using Spring Framework by any chance? I did that because Spring requires it as well. R -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (Darwin) iD8DBQFCCNnaJhqny0eCHK8RAopwAJsHLpfuf2/z5VBFxRvyYMaACgwQ5wCcCRkh JIHFyFal+vuNAO9ZwL/4gl8= =81A9 -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sorting Child Objects
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Feb 8, 2005, at 7:16 AM, Christoph Hermann wrote: I have a similar Problem (i think). When retrieving a Collection for the first time, the order is fine like i want it. When retrieving it a second or third, or ... time i seem to get a random order. My disordering is consistently ordered by record ID. So it's not out of order, just not the order I'm telling it to orderby. R -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (Darwin) iD8DBQFCCMSDJhqny0eCHK8RApICAJ4gjEWsxIcn6s3r5tm7pcfWtP4HHgCeKEt6 eojTr+KCFnjN+bHFcjT7Xzo= =AsKJ -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sorting Child Objects
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Steps 1.) and 2.) are imo ok. the sql contains an order by and ArrayList also maintains the order. The problem is in step 3.) how could we warn the user that his list may cause sorting problems ? Yup exactly what I was originally thinking, I do think however that we can just change from a HashSet to a SortedSet, then the ArrayList and *Set Impl will work. HashSet is fine for speed I guess if there is no ordering. So maybe we check to see if we have orderedby and get a SortedSet, if not HashSet. Then document behavior? If not possible, then definitely throw an exception to get the user's attention. R -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (Darwin) iD8DBQFCB9+tJhqny0eCHK8RAhi5AJ4jyv7T1FqX1op3GJDUcB+IVCD9vgCdFLBf oWyJ2aSiuWC9FVN9aBi1qH8= =wf8c -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sorting Child Objects
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 OOPS make that SortedSet, Tree set won't do it either On Feb 7, 2005, at 4:33 PM, Robert S. Sfeir wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Armin, I think the issue might be that we're using a HashSet not an OrderedSet or as Brian suggested TreeSet. it seems that in general in OJB we should be using sorable sets, though hash is faster of course, because of the nature of the purpose. R On Feb 7, 2005, at 4:23 PM, Robert S. Sfeir wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Feb 7, 2005, at 4:03 PM, Jakob Braeuchi wrote: hi robert, i added a simple testcase QueryTest#testPrefetchedCollectionOrderBy that uses the orderby attribute of the CollectionDescriptor. this test passes without any problems. The only potential problem i see is in ColllectionPrefetcher#associateBatched(). ... else { ManageableCollection col = createCollection(collectionClass); for (Iterator it2 = list.iterator(); it2.hasNext();) { col.ojbAdd(it2.next()); } result = col; } ... if the collectionClass of CollectionDescriptor does not maintain the order the we have a problem. Yup that looks like it, I use ManageableCollection, specifically the Set impl but changed to ArrayList impl, it's relying on the Collection to maintain its natural order, hence if the Collection is not sortable, it just adds them as it gets them. (at least this is what I understand from the code). Something has to happen there to tell the user they're full of it, and that you can't sort. R -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (Darwin) iD8DBQFCB9xEJhqny0eCHK8RAjohAJ4srmUKZ+FpWe6n1mKxjzf0HH/VYwCaA1jZ kIUY2hDxVeTCadrHpy7KNbI= =BiF0 -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (Darwin) iD8DBQFCB97HJhqny0eCHK8RAmQgAJ9EYCUdwjYuGW0lPwQ960x8l8L/6wCffYmR YsR4f7d2BMbqtRpmqp7rTaU= =7QPO -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (Darwin) iD8DBQFCB98QJhqny0eCHK8RAhuqAJ9ATlwArcQrjGrhizSvutDSxBHH/gCfQCgy ygtF5NuOZ3NaElAqvL7b7KQ= =cgb5 -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sorting Child Objects
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Armin, I think the issue might be that we're using a HashSet not an OrderedSet or as Brian suggested TreeSet. it seems that in general in OJB we should be using sorable sets, though hash is faster of course, because of the nature of the purpose. R On Feb 7, 2005, at 4:23 PM, Robert S. Sfeir wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Feb 7, 2005, at 4:03 PM, Jakob Braeuchi wrote: hi robert, i added a simple testcase QueryTest#testPrefetchedCollectionOrderBy that uses the orderby attribute of the CollectionDescriptor. this test passes without any problems. The only potential problem i see is in ColllectionPrefetcher#associateBatched(). ... else { ManageableCollection col = createCollection(collectionClass); for (Iterator it2 = list.iterator(); it2.hasNext();) { col.ojbAdd(it2.next()); } result = col; } ... if the collectionClass of CollectionDescriptor does not maintain the order the we have a problem. Yup that looks like it, I use ManageableCollection, specifically the Set impl but changed to ArrayList impl, it's relying on the Collection to maintain its natural order, hence if the Collection is not sortable, it just adds them as it gets them. (at least this is what I understand from the code). Something has to happen there to tell the user they're full of it, and that you can't sort. R -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (Darwin) iD8DBQFCB9xEJhqny0eCHK8RAjohAJ4srmUKZ+FpWe6n1mKxjzf0HH/VYwCaA1jZ kIUY2hDxVeTCadrHpy7KNbI= =BiF0 -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (Darwin) iD8DBQFCB97HJhqny0eCHK8RAmQgAJ9EYCUdwjYuGW0lPwQ960x8l8L/6wCffYmR YsR4f7d2BMbqtRpmqp7rTaU= =7QPO -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sorting Child Objects
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Feb 7, 2005, at 4:03 PM, Jakob Braeuchi wrote: hi robert, i added a simple testcase QueryTest#testPrefetchedCollectionOrderBy that uses the orderby attribute of the CollectionDescriptor. this test passes without any problems. The only potential problem i see is in ColllectionPrefetcher#associateBatched(). ... else { ManageableCollection col = createCollection(collectionClass); for (Iterator it2 = list.iterator(); it2.hasNext();) { col.ojbAdd(it2.next()); } result = col; } ... if the collectionClass of CollectionDescriptor does not maintain the order the we have a problem. Yup that looks like it, I use ManageableCollection, specifically the Set impl but changed to ArrayList impl, it's relying on the Collection to maintain its natural order, hence if the Collection is not sortable, it just adds them as it gets them. (at least this is what I understand from the code). Something has to happen there to tell the user they're full of it, and that you can't sort. R -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (Darwin) iD8DBQFCB9xEJhqny0eCHK8RAjohAJ4srmUKZ+FpWe6n1mKxjzf0HH/VYwCaA1jZ kIUY2hDxVeTCadrHpy7KNbI= =BiF0 -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sorting Child Objects
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Feb 7, 2005, at 11:52 AM, Jakob Braeuchi wrote: hi robert, Robert S. Sfeir schrieb: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Yeah I know, I was avoiding the query customizer didn't want to make it that specific for this particular need, your suggestion of orderby turned out to be the perfect solution. That said, the orderby in the collection-descriptor doesn't order anything if the collection is not sortable. that's strange. afaik orderby is only handled in the generated sql ?? does ojb at least include 'order by' in the sql ? Not that I could see in child objects, which is why I think it's affected after the select happens using Collections.sort(...). R -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (Darwin) iD8DBQFCB55mJhqny0eCHK8RAjTMAJ0ddp+xgzh/yYz8Jyk9zcE4S6UJbgCeId3D STOb3QdpeEPrdW2K6k0opzE= =aJ9L -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sorting Child Objects
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Yeah I know, I was avoiding the query customizer didn't want to make it that specific for this particular need, your suggestion of orderby turned out to be the perfect solution. That said, the orderby in the collection-descriptor doesn't order anything if the collection is not sortable. So if I had: private Collection myFooChild = Collections.EMPTY_SET; when OJB runs the query and then the sub query to go get myFooChild objects, and I have orderby="order" which is referenced in the collection-descriptor pointing to the Foo object's descriptor info, it sorts nothing, the myFooChild objects are sorted in what ever order they come back from the DB. However, if I had: private List myFooChild = Collections.EMPTY_LIST; then orderby="order" works correctly and sorts the objects in the way I expect them to. So either there's a bug in OJB, or OJB should be throwing an exception, or at the very least a warning, letting people know something like: "The [insert type of object name (Set, Collection)] you are trying to order your auto-retrieved objects using the orderby in your collection-descriptor is not sortable. Please change your object type to a sortable type in order for this functionality to work properly". Just a thought. Right now with the default orderby and using List, I do one select and get everything back the way I need it for the view, so the functionality is beautiful when it works, but I bet I'm not the only one who might have hit that and wondered what's going on. The orderby doesn't seem to affect the query itself, rather it affects the object after it's retrieved from the DB. R On Feb 7, 2005, at 11:36 AM, Jakob Braeuchi wrote: hi robert, the orderby should be used in the sql when retrieving this children. if you want to modify the orderby you could use a query-customizer. hth jakob Robert S. Sfeir schrieb: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Yes, that gives it a default, but there is no way to change that based on query as far as I can tell, I wanted to make sure I didn't miss anything. R On Feb 6, 2005, at 3:58 AM, Jakob Braeuchi wrote: hi robert, have you tried the orderby in collection-descriptor ? jakob Robert S. Sfeir schrieb: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Either I'm rusty or this is a little trickier to do... The issue is that I have a TicketType, which has a Collection of Attribute which itself has a Collection of AttributeType. When I do a select for a Collection of Attribute(s) for a TicketType (select * from ticket_types tt, attributes a where ticket_type=1 and tt.type_id = a.type_id order by a.attribute_order) I get a TicketType with its Attribute Collection and the Attribute Collection is correctly sorted by the order column. But I need to take this a step further because an Attribute has a Collection of AttributeValue(s), and I want those AttributeValue objects to also be sorted by a specific column. In other words I need the 3rd IN query that OJB triggers to get the AttributeValue to be sorted... What's the most efficient way to do this? I'd rather not do 2 selects myself, I like having one select and have OJB deal with the prefetched relationships... and sorting... I have another example which goes deeper from project to tickettype etc... Thanks R -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (Darwin) iD8DBQFCBVhrJhqny0eCHK8RAvnjAJ0ZxKTArcUkJyxQlBZJ36JuEWOg5wCfXiCP 56Ietiiuhj5oIMVgHTFepT8= =WJoc -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (Darwin) iD8DBQFCBhojJhqny0eCHK8RAsD7AJ9FW2OovX5gPaljRPfBY2QhVab4oQCghHlA wDpEg4gAbx99IF0qJVzUuec= =8LLJ -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (Darwin) iD8DBQFCB5xwJhqny0eCHK8RAlKjAJ9qNlv8zyZq+0ppZLJ9BFbAsk3LywCdF6zo afLuz1fF5sns2KZt3yutPM8= =H3wd -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sorting Child Objects
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jacob, I tried adding orderby to at least have a default sort for collections... it does nothing, the order is wrong. I added orderby="order" which is the field name in the referenced collection, the sort is not even close, either there's a bug (and I should dig into it) or I didn't understand how to use it. R On Feb 6, 2005, at 3:58 AM, Jakob Braeuchi wrote: hi robert, have you tried the orderby in collection-descriptor ? jakob Robert S. Sfeir schrieb: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Either I'm rusty or this is a little trickier to do... The issue is that I have a TicketType, which has a Collection of Attribute which itself has a Collection of AttributeType. When I do a select for a Collection of Attribute(s) for a TicketType (select * from ticket_types tt, attributes a where ticket_type=1 and tt.type_id = a.type_id order by a.attribute_order) I get a TicketType with its Attribute Collection and the Attribute Collection is correctly sorted by the order column. But I need to take this a step further because an Attribute has a Collection of AttributeValue(s), and I want those AttributeValue objects to also be sorted by a specific column. In other words I need the 3rd IN query that OJB triggers to get the AttributeValue to be sorted... What's the most efficient way to do this? I'd rather not do 2 selects myself, I like having one select and have OJB deal with the prefetched relationships... and sorting... I have another example which goes deeper from project to tickettype etc... Thanks R -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (Darwin) iD8DBQFCBVhrJhqny0eCHK8RAvnjAJ0ZxKTArcUkJyxQlBZJ36JuEWOg5wCfXiCP 56Ietiiuhj5oIMVgHTFepT8= =WJoc -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (Darwin) iD8DBQFCBmFfJhqny0eCHK8RAgegAJ98vIxFDOi7w1nNE0HrAYjnQ+KfYwCfZ4Te CeJ29I/wlx8Q1DWNWcWVQg8= =iode -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sorting Child Objects
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Yes, that gives it a default, but there is no way to change that based on query as far as I can tell, I wanted to make sure I didn't miss anything. R On Feb 6, 2005, at 3:58 AM, Jakob Braeuchi wrote: hi robert, have you tried the orderby in collection-descriptor ? jakob Robert S. Sfeir schrieb: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Either I'm rusty or this is a little trickier to do... The issue is that I have a TicketType, which has a Collection of Attribute which itself has a Collection of AttributeType. When I do a select for a Collection of Attribute(s) for a TicketType (select * from ticket_types tt, attributes a where ticket_type=1 and tt.type_id = a.type_id order by a.attribute_order) I get a TicketType with its Attribute Collection and the Attribute Collection is correctly sorted by the order column. But I need to take this a step further because an Attribute has a Collection of AttributeValue(s), and I want those AttributeValue objects to also be sorted by a specific column. In other words I need the 3rd IN query that OJB triggers to get the AttributeValue to be sorted... What's the most efficient way to do this? I'd rather not do 2 selects myself, I like having one select and have OJB deal with the prefetched relationships... and sorting... I have another example which goes deeper from project to tickettype etc... Thanks R -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (Darwin) iD8DBQFCBVhrJhqny0eCHK8RAvnjAJ0ZxKTArcUkJyxQlBZJ36JuEWOg5wCfXiCP 56Ietiiuhj5oIMVgHTFepT8= =WJoc -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (Darwin) iD8DBQFCBhojJhqny0eCHK8RAsD7AJ9FW2OovX5gPaljRPfBY2QhVab4oQCghHlA wDpEg4gAbx99IF0qJVzUuec= =8LLJ -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Sorting Child Objects
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Either I'm rusty or this is a little trickier to do... The issue is that I have a TicketType, which has a Collection of Attribute which itself has a Collection of AttributeType. When I do a select for a Collection of Attribute(s) for a TicketType (select * from ticket_types tt, attributes a where ticket_type=1 and tt.type_id = a.type_id order by a.attribute_order) I get a TicketType with its Attribute Collection and the Attribute Collection is correctly sorted by the order column. But I need to take this a step further because an Attribute has a Collection of AttributeValue(s), and I want those AttributeValue objects to also be sorted by a specific column. In other words I need the 3rd IN query that OJB triggers to get the AttributeValue to be sorted... What's the most efficient way to do this? I'd rather not do 2 selects myself, I like having one select and have OJB deal with the prefetched relationships... and sorting... I have another example which goes deeper from project to tickettype etc... Thanks R -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (Darwin) iD8DBQFCBVhrJhqny0eCHK8RAvnjAJ0ZxKTArcUkJyxQlBZJ36JuEWOg5wCfXiCP 56Ietiiuhj5oIMVgHTFepT8= =WJoc -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multible webapps on tomcat using ojb
Are the OJB jars in the web application's lib directories? (stupid question, but still...) If its not that then I'm not really sure what it would be... [EMAIL PROTECTED] wrote: I'm running 2 seperate apps in one Tomcat server. Both use ojb to access the db. With one app this works fine. But the second app uses the same connection the first one uses. Both apps get the PersistanceBroker with PersistenceBrokerFactory.getDefaultPersistanceBroker(). But I have two separate repository_database.xml for each app. Is there only one defaultPersistanceBroker in my Tomcat runtime environment? How can I run several apps? Using PBKey top create my PersistanceBroker. Which of my repository_database.xml will be used? Thanks for help Markus -- Robert r. Sanders Chief Technologist iPOV www.ipov.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: no primary key
Have you tried it? I am pretty sure it works; I think I've done it before, but if it doesn't work then I'd be interested to know. Bobby Lawrence wrote: Is there a way to have a class with no primary key field descirptor? All I want to do with OJB is retrieval. -- Bobby - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Robert r. Sanders Chief Technologist iPOV www.ipov.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Optimistic Locking Problem.
tionMan W J2CA0075W: An >>>>>> active transaction should be present while processing method >>>>>> initializeForUOW. >>>>>> [12/2/04 15:48:04:637 CST] 6de77661 SystemErr R CLIENTADDERDELAY: >>>>>> After Update: 1 >>>>>> [12/2/04 15:48:04:637 CST] 797e3663 SystemErr R >>>>>> *** END >>>>>> [12/2/04 15:48:47:729 CST] 797e3663 SystemErr R >>>>>> *** START **** >>>>>> [12/2/04 15:48:47:729 CST] 797e3663 SystemErr R SERVLET: Starting >>>>>> ClientAdderDelay >>>>>> [12/2/04 15:48:47:729 CST] 797e3663 SystemErr R SERVLET: Sleeping >>>>>> 1000 millis >>>>>> [12/2/04 15:48:47:779 CST] 1ec7f672 ConnectionMan W J2CA0075W: An >>>>>> active transaction should be present while processing method >>>>>> allocateMCWrapper. >>>>>> [12/2/04 15:48:47:840 CST] 1ec7f672 ConnectionMan W J2CA0075W: An >>>>>> active transaction should be present while processing method >>>>>> initializeForUOW. >>>>>> [12/2/04 15:48:47:850 CST] 1ec7f672 SystemErr R CLIENTADDERDELAY: >>>>>> Before Update: 1 >>>>>> [12/2/04 15:48:47:850 CST] 1ec7f672 SystemErr R CLIENTADDERDELAY: >>>>>> Sleeping for 5000 millis >>>>>> [12/2/04 15:48:48:931 CST] 797e3663 SystemErr R SERVLET: Starting >>>>>> ClientAdder >>>>>> [12/2/04 15:48:48:931 CST] 797e3663 SystemErr R SERVLET: Joining >>>>>> to ClientAdder >>>>>> [12/2/04 15:48:48:931 CST] 1ec0f672 ConnectionMan W J2CA0075W: An >>>>>> active transaction should be present while processing method >>>>>> allocateMCWrapper. >>>>>> [12/2/04 15:48:49:031 CST] 1ec0f672 ConnectionMan W J2CA0075W: An >>>>>> active transaction should be present while processing method >>>>>> initializeForUOW. >>>>>> [12/2/04 15:48:49:041 CST] 1ec0f672 SystemErr R CLIENTADDER: >>>>>> Before Update: 0 >>>>>> [12/2/04 15:48:49:041 CST] 1ec0f672 SystemErr R CLIENTADDER: >>>>>> Changing name to 1 >>>>>> [12/2/04 15:48:49:051 CST] 1ec0f672 ConnectionMan W J2CA0075W: An >>>>>> active transaction should be present while processing method >>>>>> allocateMCWrapper. >>>>>> [12/2/04 15:48:49:061 CST] 1ec0f672 ConnectionMan W J2CA0075W: An >>>>>> active transaction should be present while processing method >>>>>> initializeForUOW. >>>>>> [12/2/04 15:48:49:081 CST] 1ec0f672 SystemErr R CLIENTADDER: >>>>>> After Update: 1 >>>>>> [12/2/04 15:48:49:081 CST] 797e3663 SystemErr R SERVLET: Joingin >>>>>> to ClientAdderDelay >>>>>> [12/2/04 15:48:52:857 CST] 1ec7f672 SystemErr R CLIENTADDERDELAY: >>>>>> Changing name to 1 >>>>>> [12/2/04 15:48:52:857 CST] 1ec7f672 ConnectionMan W J2CA0075W: An >>>>>> active transaction should be present while processing method >>>>>> allocateMCWrapper. >>>>>> [12/2/04 15:48:52:867 CST] 1ec7f672 ConnectionMan W J2CA0075W: An >>>>>> active transaction should be present while processing method >>>>>> initializeForUOW. >>>>>> [12/2/04 15:48:52:877 CST] 1ec7f672 SystemErr R CLIENTADDERDELAY: >>>>>> After Update: 1 >>>>>> [12/2/04 15:48:52:877 CST] 797e3663 SystemErr R >>>>>> *** END >>>>>> >>>>>> Let me know if any more information would be helpful... >>>>>> >>>>>> - >>>>>> 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] R -- Robert S. Sfeir Software Developer Codepuccino "Make everything as simple as possible, but not simpler." -- Einstein http://www.codepuccino.com blog: http://blogs.codepuccino.com/dude - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to obtain autoincrement field value once an object is created?
Not if you setup the primary key correctly and the foreign references. On 12/2/04 11:00 PM, "Gene" <[EMAIL PROTECTED]> wrote: > But before I can store() the object, I must filled the TheSameValueField > with values(same as Id field) as it is a not null field/column. > Otherwise, database error will be raised. > > Gene > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] R -- Robert S. Sfeir Software Developer Codepuccino "Make everything as simple as possible, but not simpler." -- Einstein http://www.codepuccino.com blog: http://blogs.codepuccino.com/dude - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to obtain autoincrement field value once an object is created?
Most of the time the broker.store() object will return the object you passed in with the ID (primary key value) filled in. So just do a Object.getID() (of course substituting your object name and method name) after you've done the store and you'll have the ID. R On 12/2/04 7:31 PM, "Gene" <[EMAIL PROTECTED]> wrote: > Hi, anyone can tell me if I can obtain the autoincrement field value when I > create an object? Because I would like to assign the same value to another > field. For example: > field "Id" is an autocrement field, and "TheSameValueField" is a normal field, > I > want to default/assign the value of "Id" field to field "TheSameValueField", > how > to realize that? > > Any ideas are appreciated. Thanks. > > Gene > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] R -- Robert S. Sfeir Software Developer Codepuccino "Make everything as simple as possible, but not simpler." -- Einstein http://www.codepuccino.com blog: http://blogs.codepuccino.com/dude - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OJB can't open database
r instances. But it's possible to enable this >>> at runtime using 'setDefaultKey' method. >>> (metadata.ConnectionRepository ? ) Could not find >>> org.apache.ojb.broker.metadata.JdbcConnectionDescriptor for PBKey >>> org.apache.ojb.broker.PBKey: jcdAlias=default, user=null, >>> password=null >>> (odmg.DatabaseImpl ? ) Open database failed: >>> Borrow broker from pool failed, using PBKey >>> org.apache.ojb.broker.PBKey: jcdAlias=default, user=null, >>> password=null >>> org.apache.ojb.broker.PBFactoryException: Borrow broker from pool >>> failed, using PBKey org.apache.ojb.broker.PBKey: jcdAlias=default, >>> user=null, password=null >>>at > org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.createPersist > enceBroker(Unknown >>> Source) >>>at > org.apache.ojb.broker.PersistenceBrokerFactory.createPersistenceBroker(Unkno > wn >>> Source) >>>at org.apache.ojb.odmg.DatabaseImpl.open(Unknown Source) >>>at CountryDA.main(CountryDA.java:33) >>> Caused by: org.apache.ojb.broker.PBFactoryException: Given PBKey >>> org.apache.ojb.broker.PBKey: jcdAlias=default, user=null, >>> password=null does not match in metadata configuration >>>at > org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.createNewBrokerI > nstance(Unknown >>> Source) >>>at > org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl$PBKeyedPoolab > leObjectFactory.makeObject(Unknown >>> Source) >>>at > org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeye > dObjectPool.java:792) >>>... 4 more >>> org.odmg.DatabaseNotFoundException: OJB can't open database default >>> Borrow broker from pool failed, using PBKey >>> org.apache.ojb.broker.PBKey: jcdAlias=default, user=null, >>> password=null >>>at org.apache.ojb.odmg.DatabaseImpl.open(Unknown Source) >>>at CountryDA.main(CountryDA.java:33) >>> org.odmg.DatabaseClosedException: Database is NULL, must have a DB in >>> order to create a transaction >>>at org.apache.ojb.odmg.ImplementationImpl.newTransaction(Unknown > Source) >>>at CountryDA.main(CountryDA.java:42) >>> Exception in thread "main" >>> >>> >> >> The error states that OJB could not find the repository.xml file on the >> classpath, so check its position: for a webapp put it into >> WEB-INF/classes along with OJB.properties and also don't put OJB into >> the server's shared lib folder but into the WEB-INF/lib folder of your >> webapp. >> >> Tom >> >> - >> 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] > > > > ___ > HPD Software Ltd. - Helping Business Finance Business > Email terms and conditions: www.hpdsoftware.com/disclaimer > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] R -- Robert S. Sfeir Software Developer Codepuccino "Make everything as simple as possible, but not simpler." -- Einstein http://www.codepuccino.com blog: http://blogs.codepuccino.com/dude - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: criteria/query by object
I haven't looked at the source of OJB for quite a while; and then it wan't in any depth. I'd suggest you double-check the mappings in your repository.xml; I think you might have a typo, or mismatch... I believe the xml for what you're mapping should look something like: class="com.x.y.TestStep" table="TestStep"> name="id" column="id" jdbc-type="BIGINT" primarykey="true" autoincrement="true"/> name="testRunId" column="testRunId" jdbc-type="BIGINT" access="anonymous"/> name="testRun" class-ref="com.x.y.TestRun" refresh="true" auto-retrieve="true" auto-update="true" auto-delete="false"> class="com.x.y.TestRun" table="TestRun"> name="id" column="id" jdbc-type="BIGINT" primarykey="true" autoincrement="true"/> ... While you would then need a TestStep class like: public class TestStep { private TestRun testRun = null; } Aside from double checking these I can't think of anything. I have not had any trouble with this type of mapping. Beeker, Andreas wrote: Hi Robert, that was my first bet too, but in the StatementManager it will simply try to bind the TestRun-instance onto the parameter instead of binding the anonymous key. I rechecked my repository, but it seems to be ok. Any ideas? Thanks, Andreas. Robert r. Sanders wrote: If your TestStep object has a field testRun then the query should only need to: TestRun myTestRun = ...; Criteria criteria = new Criteria(); criteria.addEqualTo("testRun", myTestRun); OJB will take care of all the identity lookups for you (as long as the configuration xml is correct). Beeker, Andreas wrote: Hi all, I retrieved an object (class TestRun) by an existing Iterator-Query. Now I want to find all objects of class TestStep which reference the former TestRun-object. My primary keys are all anonymous keys and also the foreign key of class TestStep (attribute "testRun"/ anonymous key "testRunId"). I've managed to find the right objects by this criteria: TestRun run = ...; Criteria crit = new Criteria(); crit.addEqualTo("testRun", new Identity(run, broker).getPrimaryKeyValues()[0]); I've also tried to use a subquery, which lead to an ClassCastException in SqlQueryStatement, because it assumes to get a QueryByCriteria: crit.addIn("testRun", new QueryByIdentity(run)); My OJB version is 1.0.1 and I only use the PB-API. I've seen that there was a PB-extension for JDO (Criteria.addIdentityEqualTo) which could solve the problem. Is this the right way or is there another more convienent way to define the criteria (... without knowing how many keys must be specified)? Thanks, Andreas. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Robert r. Sanders Chief Technologist iPOV www.ipov.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] -- Robert r. Sanders Chief Technologist iPOV www.ipov.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Mysql deadlock / timeout
Huh is OJB competing with some other processes trying to update the same table/db? It looks like it's complaining that it can't get a lock on row, and what ever process is not giving it up. Make also sure that all your transactions end by closing the PB instance. I would add some debugging info to see which record is being updated at the time, with a timestamp to tell you when it was happening, and I would try to catch this specific exception and resubmit the update again once or twice before failing, if there indeed is another process updating the DB. Last thought... Is it around a time when you have a DB backup going on? Some backups make the db/table read only, and that could be a problem. HTH R On 11/30/04 12:43 PM, "Jin Bal" <[EMAIL PROTECTED]> wrote: > Hello > > I have an app in production that occasionally suffers from what seems to be a > deadlock or timout when doing a simple update inside a transaction > > here is the stacktrace - can anyone shed any light on things?? > > TIA > > Caused by: org.apache.ojb.broker.PersistenceBrokerSQLException: > java.sql.SQLException: Deadlock found when trying to get lock; Try restarting > transaction, message from server: "Lock wait timeout exceeded; Try restarting > transaction" > > at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeUpdateSQL(Unknown > Source) > > at org.apache.ojb.broker.core.MtoNBroker.deleteMtoNImplementor(Unknown Source) > > at org.apache.ojb.broker.core.PersistenceBrokerImpl.storeAndLinkMtoN(Unknown > Source) > > at org.apache.ojb.broker.core.PersistenceBrokerImpl.storeCollections(Unknown > Source) > > at org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(Unknown Source) > > at org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown Source) > > at org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown Source) > > at org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown > Source) > > at org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown > Source) > > at com.buyacar.dtofactory.OJBTransactionImpl.save(OJBTransactionImpl.java:54) > > at com.buyacar.dtofactory.UserFactory.saveUser(UserFactory.java:28) > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: criteria/query by object
If your TestStep object has a field testRun then the query should only need to: TestRun myTestRun = ...; Criteria criteria = new Criteria(); criteria.addEqualTo("testRun", myTestRun); OJB will take care of all the identity lookups for you (as long as the configuration xml is correct). Beeker, Andreas wrote: Hi all, I retrieved an object (class TestRun) by an existing Iterator-Query. Now I want to find all objects of class TestStep which reference the former TestRun-object. My primary keys are all anonymous keys and also the foreign key of class TestStep (attribute "testRun"/ anonymous key "testRunId"). I've managed to find the right objects by this criteria: TestRun run = ...; Criteria crit = new Criteria(); crit.addEqualTo("testRun", new Identity(run, broker).getPrimaryKeyValues()[0]); I've also tried to use a subquery, which lead to an ClassCastException in SqlQueryStatement, because it assumes to get a QueryByCriteria: crit.addIn("testRun", new QueryByIdentity(run)); My OJB version is 1.0.1 and I only use the PB-API. I've seen that there was a PB-extension for JDO (Criteria.addIdentityEqualTo) which could solve the problem. Is this the right way or is there another more convienent way to define the criteria (... without knowing how many keys must be specified)? Thanks, Andreas. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Robert r. Sanders Chief Technologist iPOV www.ipov.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Newbie Q] obj-blank xdoclet ant task not generating repository_user
Thomas Dudziak wrote: The OJB XDoclet module does not process the type because you misspelled the xdoclet tags: its @[EMAIL PROTECTED], not @[EMAIL PROTECTED] (this is quite hard to catch ;-) ) I am so embarrassed :) Thanks! --Rob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Newbie Q] obj-blank xdoclet ant task not generating repository_user
Hi all, I'm using the obj-blank project as is, except that I have added a single file: src/java/genealogy/data/CitationPartType.java: package genealogy.data; /** * @obj.class */ public class CitationPartType { /** * @obj.field */ private String name; /** * @obj.field * attributes="primarykey" */ private int id; } I haven't altered anything in build.properties. The problem is that when I run "ant xdoclet", I end up with none of this information in the repository_user.xml file: Buildfile: build.xml compile: [mkdir] Created dir: /Users/ek/jbproject/Genealogy/build [mkdir] Created dir: /Users/ek/jbproject/Genealogy/build/classes [javac] Compiling 1 source file to /Users/ek/jbproject/Genealogy/build/classes build: [copy] Copying 7 files to /Users/ek/jbproject/Genealogy/build/resources compile: xdoclet: [ojbdoclet] (XDocletMain.start 47 ) Running [ojbdoclet] Generating ojb repository descriptor (build/resources//repository_user.xml) [ojbdoclet] Processed 0 types [ojbdoclet] Processed 0 types [ojbdoclet] (XDocletMain.start 47 ) Running [ojbdoclet] Generating torque schema (build/resources//project-schema.xml) [ojbdoclet] Processed 0 types BUILD SUCCESSFUL Total time: 3 seconds Ant properly builds one file, sticks it in build/classes/genealogy/data, but then the xdoclet task doesn't seem to notice that my class has objdoclet tags in it. Resulting repository_user.xml file: Any ideas on how to debug this problem? Thanks, --Rob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using alternate key instead of primary key when relating an class descriptor with a collection descriptor
Look at: doc/docu/guides/basic-technique.html#Support+for+Non-Decomposed+m%3An+Mappings in the OJB documentation. I think I was able to get something along these lines to work in a test (pre- 1.0). I think it would be relatively straight forward for you to implement a test and see if it works; I would simpy mark the username as a key, and then try it. Changes to the OJB meta-data that prevent this would be my main concern Sean Dockery wrote: Hello. I've searched the gmane archives, but I was unable to find any messages related to my question. Suppose that I have the following classes... public class User { private Integer id; // primary key field private String username; // alternate key field private Collection userRoles; // collection of UserRole objects related by username }; public class UserRole { private String username; // foreign key private String rolename; } ...and I wanted to relate User and UserRole in a repository mapping based on the equality of the username fields in both User and UserRole. Can this exact schema be handled through a repository mapping? (Does fk-pointing-to-this-class work without using an indirection-table? Is there an alternative?) Most of the rest of the data model in the application uses User.id as a foreign key, so we can't easily change the primary key of the user table. The UserRole fields were chosen for compatibility with Tomcat JDBCRealm-like declarative security implementations. The only way that I can see to work around this problem is to duplicate the User.id field in the UserRole table, along with the username. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Robert r. Sanders Chief Technologist iPOV www.ipov.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Unique query without using primary key?
The only thing to worry about with Anonymous keys and using them on primary keys is an issue with clustering, there is a warning about it on the Anonymous keys page docs. If you're not clustering there is no reason why you can't do what you're describing below. R On 11/23/04 4:00 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Thank you so much. I have done lots of crazy queries, but have not done one > where I was not wanting a primary key in the result. I have some learning to > do as to which is better way to handle this. I have to look up both > rowreaders and anonymous keys. > > I would prefer if the searchword table didn't even have a primary key, but > just an indexed sidsince search words will be added and deleted all the > time. > > Thanks for the great nudge, > > JohnE > > > > - Original Message - > From: Danilo Tommasina <[EMAIL PROTECTED]> > Date: Tuesday, November 23, 2004 4:44 am > Subject: Re: Unique query without using primary key? > >> A ReportQueryByCriteria should do the job: >> >> something like this: >> >> Criteria crit = new Criteria(); >> crit.addLike( "state", "somestate" ); >> crit.addLike( ".searchword", "somesearchword" ); >> >> ReportQueryByCriteria query = new ReportQueryByCriteria( >> SearchKeys.class, new String [] { "sid" }, crit, true ); >> >> PersistenceBroker pb = null; >> try { >> pb = PersistenceBrokerFactory.defaultPersistenceBroker(); >> >> ArrayList results = new ArrayList(); >> for ( Iterator resultsIt = pb.getReportQueryIteratorByQuery( >> query ); resultsIt.hasNext(); ) { >> results.add( ((Object []) resultsIt.next())[ 0 ] ); >> } >> >> // The results ArrayList now contains all the ids you need >> // Note: always extact the values from the Iterator before >> closing the broker. >> >> } catch ( Exception e ) { >> // Do exception handling >> } finally { >> if ( pb != null ) { >> pb.close(); >> } >> } >> >> Replace with the reference path defined in >> your repository.xml >> I didn't tested the code, so there are probably syntax errors... >> >> >>> I am not getting this. I need a nudge in the right direction. >>> >>> I want to do this query: >>> select distinct sk.sid from searchkeys sk, searchwords sw >>>where sw.searchword="somesearchword" >>> sw.sid = sk.sid >>> sk.state="somestate"; >>> >>> table searchkeys: >>> sid <-- unique PK >>> state >>> >>> table searchwords: >>> swid <-- unique PK I wish OJB >> didn't require >>> sid <-- sid in searchkey table >>> searchword >>> >>> searchkeys and searchwords having a 1:n relationship. >>> >>> >>> Right now I both tables mapped according to their >> characteristics which I have done many times before. In the past >> I have always wanted the primary keys and full records. >>> >>> Here I don't want the full records or mapping, but just a >> collection of the unique sid. I would prefer not to get the full >> records and I only require this for read and not write. Imagine >> I am doing a keyword search and I just want to know which services >> match the search criteria. >>> >>> Can anybody nudge me in the right direction? Would be great to >> get past this problem. I am trying to inprove the searching on my >> live OJB used site by including parts of the Lucene project, but >> need to be able to do this for it to work. >>> >>> Thanks lots. >>> >>> >>> >>> >>> >>> - >> >>> 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: Unique query without using primary key?
Anonymous keys R On 11/22/04 8:46 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I am not getting this. I need a nudge in the right direction. > > I want to do this query: > select distinct sk.sid from searchkeys sk, searchwords sw >where sw.searchword="somesearchword" > sw.sid = sk.sid > sk.state="somestate"; > > table searchkeys: > sid <-- unique PK > state > > table searchwords: > swid <-- unique PK I wish OJB didn't require > sid <-- sid in searchkey table > searchword > > searchkeys and searchwords having a 1:n relationship. > > > Right now I both tables mapped according to their characteristics which I have > done many times before. In the past I have always wanted the primary keys and > full records. > > Here I don't want the full records or mapping, but just a collection of the > unique sid. I would prefer not to get the full records and I only require > this for read and not write. Imagine I am doing a keyword search and I just > want to know which services match the search criteria. > > Can anybody nudge me in the right direction? Would be great to get past this > problem. I am trying to inprove the searching on my live OJB used site by > including parts of the Lucene project, but need to be able to do this for it > to work. > > Thanks lots. > > > > > > - > 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: OJB sub query with effective date and effective sequence logic
I am not too familiar with the ReportQueries; but have you tried turning on SQL logging in the OJB.properties file to see what SQL is being produced? A breif look at the documentation for ReportQueries (doc/docu/guides/query.html#Report+Queries) suggests to me that the current implementation may be a little too limited to do what you want - for instance I think the setAttributes() call is actually setting the Object properties/attributes to return (if I am wrong I hope someone more knowledgeable can corret this). You might try the Criteria.addSql("") to add the MAX() statement (although how you would then retrieve it I can't see). Alternatively, you can use either: persistenceBroker.serviceJdbcAccess() or persistenceBroker.serviceConnectionManager().getConnection() to get an object (JdbcAccess or Connection respectively) from which you can execute arbitrary SQL. Stark, Roman wrote: Hi All I am evaluating OJBs functionality for our project. Currently most of the sql is written by hand since it's complex logic against People Soft (ERP) tables. Right now I am trying to use sub query to query data from just one table based on effective dates. The sql I want to create is: SELECT * FROM ps_names a WHERE a.emplid = '005170' AND a.name_type = 'PRF' AND a.effdt = (SELECT MAX(b.effdt) FROM ps_names b WHERE a.emplid = b.emplid AND a.name_type = b.name_type) The code I wrote (think it would work) is: broker = PersistenceBrokerFactory.defaultPersistenceBroker(); // Build sub query for effdt logic ReportQueryByCriteria subQry = null; subCrit.addEqualToField("EMPLID", Criteria.PARENT_QUERY_PREFIX + "EMPLID"); subCrit.addEqualToField("NAME_TYPE", Criteria.PARENT_QUERY_PREFIX + "NAME_TYPE"); subQry = QueryFactory.newReportQuery(PsNames.class, subCrit); subQry.setAttributes(new String[] {"MAX(EFFDT)"}); // Build main query crit.addColumnEqualTo("EFFDT", subQry); crit.addColumnEqualTo("EMPLID", "005170"); crit.addColumnEqualTo("NAME_TYPE", "PRF"); // Execute Query mainQry = QueryFactory.newQuery(PsNames.class, crit); Collection results = broker.getCollectionByQuery(mainQry); Unfortunately, the result is nothing. Table definition: EMPLID N VARCHAR211 Primary key NAME_TYPE N VARCHAR23 Primary key EFFDT N DATE7 Primary key FIRST_NAME N VARCHAR230 MIDDLE_NAME N VARCHAR230 LAST_NAME N VARCHAR230 NAMEN VARCHAR250 ... What am I missing? Am I not using the sub query right? This is only a simple table that doesn't contain an effective sequence in addition to the effective date, let alone joining two tables both with effective date and sequence logic. Any ideas are appreciated. Thanks Roman ----- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Robert r. Sanders Chief Technologist iPOV www.ipov.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to markup for xdoclet inheritance structure?
Wow nice catch! I didn't even notice, I guess I was looking quick. I wonder if it was Wallace's copy paste problem. R On 11/16/04 2:19 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I haven't successfully used xdoclet, but if it is like javadoc, you need to > start the comments with double asterisk: /** not just /*. > > my 2 cents > CQ > > Original Message: > - > From: Gelhar, Wallace Joseph [EMAIL PROTECTED] > Date: Tue, 16 Nov 2004 10:56:09 -0600 > To: [EMAIL PROTECTED] > Subject: RE: How to markup for xdoclet inheritance structure? > > > Actually this is the logger output as well. Where do I start to debug > this? > > repository-files: > java.util.logging.ErrorManager: 2 > java.lang.NullPointerException > at org.apache.tools.ant.Project.getThreadTask(Project.java:1985) > at org.apache.tools.ant.Project.demuxOutput(Project.java:1086) > at > org.apache.tools.ant.DemuxOutputStream.processBuffer(DemuxOutputStream.j > ava:172) > at > org.apache.tools.ant.DemuxOutputStream.write(DemuxOutputStream.java:147) > at > org.apache.tools.ant.DemuxOutputStream.write(DemuxOutputStream.java:241) > at java.io.PrintStream.write(PrintStream.java:258) > at > sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(StreamEncoder.java:336) > at > sun.nio.cs.StreamEncoder$CharsetSE.implFlushBuffer(StreamEncoder.java:40 > 4) > at > sun.nio.cs.StreamEncoder$CharsetSE.implFlush(StreamEncoder.java:408) > at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:152) > at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:213) > at java.util.logging.StreamHandler.flush(StreamHandler.java:224) > at > java.util.logging.ConsoleHandler.publish(ConsoleHandler.java:88) > at java.util.logging.Logger.log(Logger.java:424) > at java.util.logging.Logger.doLog(Logger.java:446) > at java.util.logging.Logger.logp(Logger.java:562) > at > org.apache.commons.logging.impl.Jdk14Logger.log(Jdk14Logger.java:91) > at > org.apache.commons.logging.impl.Jdk14Logger.info(Jdk14Logger.java:162) > at xdoclet.XDocletMain.start(XDocletMain.java:47) > at xdoclet.DocletTask.start(DocletTask.java:462) > at xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:110) > at > org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269) > at org.apache.tools.ant.Task.perform(Task.java:364) > at org.apache.tools.ant.Target.execute(Target.java:301) > at org.apache.tools.ant.Target.performTasks(Target.java:328) > at org.apache.tools.ant.Project.executeTarget(Project.java:1215) > at > org.apache.tools.ant.Project.executeTargets(Project.java:1063) > at > org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:1 > 78) > at > org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:2 > 52) > at > org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:125) > Generating ojb repository descriptor (repository_user.xml) > Type uwec.fpm.persistence.report.Report > Type uwec.fpm.persistence.report.ReportParameterValueImpl > Type uwec.fpm.persistence.report.ReportParameterValue > Type uwec.fpm.persistence.report.ReportField > Type uwec.fpm.persistence.report.ReportParameterImpl > Type uwec.fpm.persistence.PersistentObjectImpl > Type uwec.fpm.persistence.report.ReportFieldType > Type uwec.fpm.persistence.report.ReportParameter > Type uwec.fpm.persistence.PersistentObject > Processed 9 types > Warning: The class uwec.fpm.persistence.PersistentObject has no primary > key > Warning: The class uwec.fpm.persistence.PersistentObjectImpl has no > primary key > Warning: The class uwec.fpm.persistence.report.ReportParameterImpl has > no primary key > Warning: The class uwec.fpm.persistence.report.ReportParameterValue has > no primary key > Warning: The class uwec.fpm.persistence.report.ReportParameterValueImpl > has no primary key > Processed 9 types > > > -Original Message- > From: Gelhar, Wallace Joseph > Sent: Tuesday, November 16, 2004 10:24 AM > To: OJB Users List > > Subject: RE: How to markup for xdoclet inheritance structure? > > What is wrong with this markup. I've followed your advice and allowed > xdoclet to generate a table for the persistent base class (even though > the fields are in each concrete classes table), but this fails to > produce *any* fields in the repository. Do I really have to duplicate > each @ojb.field tag FIVE times for each property? > > BTW, I am using xdoclet-1.2.1, xdoclet-ojb-module-1.2.1, and > xjavadoc-1.0.3 from CVS. > > Any other suggestions? > > /** > * @ojb.class > */ > public interface PersistentObject { > > /* > * @ojb.field column="ID" > *jdbc-type="INTEGER" > *primarykey="true" > */ > public Integer getId(); > /* > * @ojb.field column="ID" > *
Re: How to markup for xdoclet inheritance structure?
Well the docs say you only need to set it on either the get or set. Not both. I put it on the get. Also, I believe (haven't tried yet), since java docs are inherited by the impl, you only need to set it there. Third you need to put a little more than that in your class definition otherwise xdoclet has no idea what your table is called, especially if you intend to use Interfaces. The following below should figure it all out for you: @ojb.class table="cdpcno_projects" determine-extents="true" include-inherited="true" generate-table-info="true" refresh="true" For your ID fields you might want to consider something like this: @ojb.field indexed="true" column="project_id" jdbc-type="INTEGER" primarykey="true" autoincrement="ojb" Hth more. R On 11/16/04 11:23 AM, "Gelhar, Wallace Joseph" <[EMAIL PROTECTED]> wrote: > What is wrong with this markup. I've followed your advice and allowed > xdoclet to generate a table for the persistent base class (even though > the fields are in each concrete classes table), but this fails to > produce *any* fields in the repository. Do I really have to duplicate > each @ojb.field tag FIVE times for each property? > > BTW, I am using xdoclet-1.2.1, xdoclet-ojb-module-1.2.1, and > xjavadoc-1.0.3 from CVS. > > Any other suggestions? > > /** > * @ojb.class > */ > public interface PersistentObject { > > /* > * @ojb.field column="ID" > *jdbc-type="INTEGER" > *primarykey="true" > */ > public Integer getId(); > /* > * @ojb.field column="ID" > *jdbc-type="INTEGER" > *primarykey="true" > */ > public void setId(Integer id); > ... > } > > /** > * @ojb.class > */ > public abstract class PersistentObjectImpl implements PersistentObject { > > /* > * @ojb.field column="ID" > *jdbc-type="INTEGER" > *primarykey="true" > */ > protected Integer id; > /* > * @ojb.field column="ID" > *jdbc-type="INTEGER" > *primarykey="true" > */ > public Integer getId() { return id; } > /* > * @ojb.field column="ID" > *jdbc-type="INTEGER" > *primarykey="true" > */ > public void setId(Integer id) { this.id = id; } > ... > } > > /** > * @ojb.class > */ > public interface ReportParameterValue extends PersistentObject { > /* > * @ojb.field column="ParameterValue" > */ > public String getValue(); > /* > * @ojb.field column="ParameterValue" > */ > public void setValue(String value); > } > > /** > * @ojb.class table="tblRptReportParameterValue" > * @ojb.field name="reportParameterID" > *column="ReportParameterID" > *jdbc-type="INTEGER" > */ > public class ReportParameterValueImpl extends PersistentObjectImpl > implements ReportParameterValue { > /* > * @ojb.field column="ParameterValue" > */ > protected String value; > ... > /* > * @ojb.field column="ParameterValue" > */ > public String getValue() { return value; } > /* > * @ojb.field column="ParameterValue" > */ > public void setValue(String value) { this.value = value; } > } > > This is the repository it produces: > > > > > class="uwec.fpm.persistence.PersistentObject" > table="PersistentObject" >> > class-ref="uwec.fpm.persistence.PersistentObjectImpl"/> > class-ref="uwec.fpm.persistence.report.ReportParameterValue"/> > > class="uwec.fpm.persistence.PersistentObjectImpl" > table="PersistentObjectImpl" >> > class-ref="uwec.fpm.persistence.report.ReportParameterValueImpl"/> > > class="uwec.fpm.persistence.report.ReportParameterValue" > table="ReportParameterValue" >> > class-ref="uwec.fpm.persistence.report.ReportParameterValueImpl"/> > > class="uwec.fpm.persistence.report.ReportParameterValueImpl" > table="tblRptReportParameterValue" >> > name="reportParameterID" > column="ReportParameterID" > jdbc-type="INTEGER" > access="anonymous" >> > > > > > -Original Message- > From: Thomas Dudziak [mailto:[EMAIL PROTECTED] > Sent: Monday, November 15, 2004 6:09 PM > To: OJB Users List > Subject: Re: How to markup for xdoclet inheritance structure? > > Gelhar, Wallace Joseph wrote: > >> I am trying to use xdoclet to map an inheritance hierarchy as follows, > >> but it fails to include any inherited fields. Any ideas? > > The generate-table-info="false" setting disables generation of > field/reference/collection entries. See here for details: > > http://db.apache.org/ojb/docu/guides/xdoclet-module.html#ojb.class > > You should also put the ojb.field tags at the getter or setter methods > in the interfaces because this will cause their definition to be > inherited in all implementing classes. >
Re: Friendly messages
I tried looking for how to submit patches via Scarab, but its interface is just plain unusable. Anyway, I figured that I'd try and add usefully error messages to the locations where PersistenceBrokerSQLException. Most of them were already logging some information before throwing the exception, so I just added what they were logging as the PersistenceBrokerSQLException message. Hopefully this is useful. Armin Waibel wrote: ... Didn't you get an error log message before the exception was thrown? I can find 7 classes throwing PersistenceBrokerSQLException most of them do not specify the classname causing the SQLException. Will add this on my endless todo-list ;-) regards, Armin ... -- Robert r. Sanders Chief Technologist iPOV www.ipov.net Index: src/java/org/apache/ojb/broker/accesslayer/JdbcAccessImpl.java === RCS file: /home/cvspublic/db-ojb/src/java/org/apache/ojb/broker/accesslayer/JdbcAccessImpl.java,v retrieving revision 1.24 diff -U3 -r1.24 JdbcAccessImpl.java --- src/java/org/apache/ojb/broker/accesslayer/JdbcAccessImpl.java 20 Sep 2004 14:33:14 - 1.24 +++ src/java/org/apache/ojb/broker/accesslayer/JdbcAccessImpl.java 12 Nov 2004 14:24:46 - @@ -95,7 +95,7 @@ if (stmt == null) { logger.error("getDeleteStatement returned a null statement"); -throw new PersistenceBrokerException("getDeleteStatement returned a null statement"); +throw new PersistenceBrokerException("JdbcAccessImpl: getDeleteStatement returned a null statement"); } broker.serviceStatementManager().bindDelete(stmt, cld, obj); @@ -130,12 +130,12 @@ } catch (SQLException e) { -logger.error( -"SQLException during the execution of the delete (for a " -+ cld.getClassOfObject().getName() -+ "): " -+ e.getMessage(), e); -throw new PersistenceBrokerSQLException(e); +String msg = "SQLException during the execution of the delete (for a " ++ cld.getClassOfObject().getName() ++ "): " ++ e.getMessage(); +logger.error(msg, e); +throw new PersistenceBrokerSQLException("JdbcAccessImpl: " + msg, e); } finally { @@ -167,13 +167,12 @@ } catch (SQLException e) { -logger.error( -"SQLException during the execution of delete by query (for a " -+ cld.getClassOfObject().getName() -+ "): " -+ e.getMessage(), -e); -throw new PersistenceBrokerSQLException(e); +String msg = "SQLException during the execution of delete by query (for a " ++ cld.getClassOfObject().getName() ++ "): " ++ e.getMessage(); +logger.error(msg,e); +throw new PersistenceBrokerSQLException(msg, e); } finally { @@ -312,8 +311,9 @@ } catch (SQLException e) { -logger.error("SQLException during the execution of the query (for a " -+ cld.getClassOfObject().getName() + "): " + e.getMessage(), e); +String msg = "SQLException during the execution of the query (for a " ++ cld.getClassOfObject().getName() + "): " + e.getMessage(); +logger.error(msg, e); /* * MBAIRD: error condition could result in our * ResultSetAndStatement not being returned, and not being closed @@ -324,7 +324,7 @@ { retval.close(); } -throw new PersistenceBrokerSQLException(e); +throw new PersistenceBrokerSQLException(msg, e); } } @@ -376,7 +376,8 @@ } catch (SQLException e) { -logger.error("SQLException during the execution of the SQL query: " + e.getMessage(), e); +String msg = "SQLException during the execution of the SQL query: " + e.getMessage(); +logger.error(msg, e); /** * MBAIRD: error condition could result in our ResultSetAndStatement not being returned, and not being closed * since it is opened before the try loop, we should release it if there is a problem. @@ -385,7 +386,7 @@ { retval.close(); } -throw new PersistenceBrokerSQLException(e); +throw new PersistenceBrokerSQLException(msg, e); } } @@ -427,15
Re: arbitrary SQL
I believe you need to do something like: java.sql.Connection connection = persistenceBroker.serviceConnectionManager().getConnection(); Statement statement = connection.createStatement(); statement.executeUpdate(...); Anthony E. Carlos wrote: Hello, How do I fire off a an arbitrary SQL statement that doesn't require a return value? For example, (I already know how to do this using O/R mapping-- this is just a simple example) INSERT INTO colors VALUES ('red'); I've looked at the FAQs, but the only example is for SELECT statements, which obviously return values. I've tried using String sql = "INSERT INTO colors (color) VALUES ('red')"; Query query = QueryFactory.newQuery(ColorVO.class, sql); I was using broker.getObjectByQuery(query); but it complains that I have an invalid column. The problem is, why do I need "ColorVO.class" at all? I've also tried broker.getReportQueryIteratorByQuery(query); and it complains that I have an invalid SQL statement. So, is there any way to fire off arbitrary SQL without a return value? Thanks, -Anthony - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Robert r. Sanders Chief Technologist iPOV www.ipov.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: references foreign key
Wild guess... Is your idServicio an integer or a string? It seems like you might have it defined as a string when it should be an int. R On 11/3/04 2:42 PM, "David Morales de Frias" <[EMAIL PROTECTED]> wrote: > Hi ¡ > > Please, can you help me? > > When i throw a queryByCriteria, querying an object that have foreign keys, > this sql spends a lot of time executing and suddenly it throws this error > > [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: > SQL:SELECT > A0.ID_PACKAGES,A0.NUM_TFNO_DESTINO,A0.COD_TLLAMADA,A0.NUM_RESUMEN,A0.SERVICIO_ > LLAMADA,A0.COD_MERCADO,A0.COD_TTARIFA,A0.FECHA,A0.COD_TSERVICIO,A0.CODIGO_AREA > ,A0.COD_TDESTINO,A0.CATEGORIA_LLAMADA,A0.COD_TPERIODO,A0.DURACION,A0.COSTE,A0. > TCATEGORIA,A0.MSISDN,A0.NUM_TFNO_ORIGEN,A0.CODIGO_PAIS,A0.MODELO_TARIFAS,A0.CO > D_FACTURA,A0.HORA_INICIO,A0.FECHA_FACTURA,A0.COSTE_IC FROM > AUNABILL_DES.TAFM_DETALLE_LLAMADAS A0 WHERE A0.COD_FACTURA = ? > > [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: > SQL:SELECT A0.DESCRIPCION2,A0.COD_TSERVICIO,A0.DESCRIPCION1,A0.DESCRIPCION3 > FROM AUNABILL_DES.TSERVICIOS A0 WHERE A0.COD_TSERVICIO = ? > > [PersistentField] ERROR: while set field: > > [try to set 'object value' in 'target object' > > target obj class: es.indra.aunabill.vo.Tafm_detalle_llamadasJOIN > > target field name: idServicio > > target field type: class java.lang.String > > object value class: es.indra.aunabill.vo.Tservicios > > object value: [COD_TSERVICIO] TEL [DESCRIPCION1] Telefonía [DESCRIPCION2] > Telefonía [DESCRIPCION3] Telefonía > > ] > > org.apache.ojb.broker.metadata.MetadataException: IllegalAccess error setting > field:idServicio in object:es.indra.aunabill.vo.Tafm_detalle_llamadasJOIN > > > > > - > 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]
Problems with retrieving of object with 1:1 associations
Hello, I'm experiencing problems while trying to retrieve an object with two 1:1 associations. The first time I ask the PersistenceBroker for a collection I get the expected result, i. e. a complete object including all attributes from DomainDTO and featuresDTO. Following queries are sent to the database: SELECT A0.password,A0.lastname,A0.feature_id,A0.uid,A0.firstname,A0.domain_id,A0.gid,A0.email_wo_domain,A0.homedir,A0.maildir,A0.id,A1.domainname as ojb_col_12 FROM users A0 INNER JOIN domains A1 ON A0.domain_id=A1.id ORDER BY 12,8; SELECT A0.disable_pop3,A0.quota,A0.id,A0.disable_imap FROM features A0 WHERE A0.id IN (44,39,40,41,43,31); SELECT A0.domainname,A0.description,A0.email,A0.website_statistics,A0.website,A0.id,A0.ftp FROM domains A0 WHERE A0.id IN (20,18,17,53); Now if I insert a new record into table users the call to getCollectionByQuery leads to following statement: SELECT A0.password,A0.lastname,A0.feature_id,A0.uid,A0.firstname,A0.domain_id,A0.gid,A0.email_wo_domain,A0.homedir,A0.maildir,A0.id,A1.domainname as ojb_col_12 FROM users A0 INNER JOIN domains A1 ON A0.domain_id=A1.id ORDER BY 12,8; The queries against the tables features and domains is not done. I am missing the domainname from the referenced object DomainDTO. It is null. As soon as I create a new record in table domains I again get the expected behaviour. My mapping for the relevant classes looks as follows: ... other fields ... ... other fields ... ... other fields ... Can anyone please explain this? Thanks in advance Robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Simple DISTINCT query
"JDBC]Invalid column name: AMOUNT" Seems in your xml you're referring to a column called AMOUNT, but your table either doesn't have it, or it's not the right name. R You Said Something Like: Ian HunterYou Were Done Here. > Like this? (This is what failed) > > public static Collection getAllBillDates (AuthorizedUser user) throws > PersistenceException, PermissionDeniedException { > Criteria c = new Criteria(); > ReportQueryByCriteria q = QueryFactory.newReportQuery > (BillItem.class, c, true); > q.setAttributes(new String[] { "billingRun" }); > q.addOrderByDescending("billingRun"); > DataStore ds = new DataStore (user); > Collection result = ds.getCollectionByQuery(q); // <--- exception > is thrown here > ArrayList dates = new ArrayList(); > Iterator i = result.iterator(); > while (i.hasNext()) { > BillItem bi = (BillItem) i.next(); > dates.add (bi.getBillingRun()); > } > return dates; > } > > The "datastore" object wraps calls to the PB API. You can see a call to > "getCollectionByQuery" which basically calls "getCollectionByQuery" and > catches PersistenceBrokerExceptions and redefines them as > generic-to-application "PersistenceException" objects. > > The actual object definition is this: > > >primarykey="true" autoincrement="true" /> >jdbc-type="INTEGER" nullable="false"/> >auto-retrieve="true" auto-update="none" auto-delete="none"> > > >jdbc-type="TIMESTAMP" > conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimest > ampFieldConversion" /> >nullable="false" /> >nullable="false" /> >jdbc-type="VARCHAR" nullable="false" /> >conversion="org.apache.ojb.broker.accesslayer.conversions.Boolean2IntFieldCo > nversion" nullable="false" /> > > > The error I got was: > > Caused by: org.apache.ojb.broker.PersistenceBrokerException: Error reading > class type: BillItem from result set, current read field was amount > at > org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.readValuesFrom(RowRea > derDefaultImpl.java:205) > at > org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.readObjectArrayFrom(R > owReaderDefaultImpl.java:176) > at > org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(RsIterat > or.java:427) > at org.apache.ojb.broker.accesslayer.RsIterator.next(RsIterator.java:265) > at > org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryRe > ferenceBroker.java:121) > at > org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryRe > ferenceBroker.java:232) > ... 89 more > Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for > JDBC]Invalid column name: AMOUNT > at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source) > at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source) > at com.microsoft.jdbc.base.BaseResultSet.getColumnOrdinal(Unknown Source) > at com.microsoft.jdbc.base.BaseResultSet.getDouble(Unknown Source) > at > org.apache.ojb.broker.util.JdbcTypesHelper$T_Float.readValueFromResultSet(Jd > bcTypesHelper.java:773) > at > org.apache.ojb.broker.util.JdbcTypesHelper$BaseType.getObjectFromColumn(Jdbc > TypesHelper.java:302) > at > org.apache.ojb.broker.util.JdbcTypesHelper$BaseType.getObjectFromColumn(Jdbc > TypesHelper.java:281) > at > org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.readValuesFrom(RowRea > derDefaultImpl.java:199) > ... 94 more > > So why is it referring to "amount" at all? > > - Original Message - > From: "Stijn de Witt" <[EMAIL PROTECTED]> > To: "OJB Users List" <[EMAIL PROTECTED]> > Sent: Thursday, September 30, 2004 12:33 PM > Subject: Re: Simple DISTINCT query > > >> Look at ReportQueries, they are part of the PersistenceBroker interface >> and let you perform selects where the result is not a complete object. >> >> -Stijn >> >> Ian Hunter wrote: >> >> >I've been pulling my ahir out trying to accomplish something simple. >> Say > I >> >have a table called FOO, with fields FOOID (int), FOODATE (datetime), >> and >> >FOOAMOUNT (double). Some process writes data to this table, where >> FOOID > is >> >a autoincrement field, FOODATE is a datestamp, for which there can be >> >duplicates, and FOOFOO which represents some number. >> > >> >I want to generate this query: SELECT DISTINCT FOODATE FROM FOO; -- I > can't >> >figure out how to do this, because it seems like OBJ is wanting to load > all >> >the fields from the resulting query, including ones I don't need, such >> as >> >FOOAMOUNT. >> > >> >How do I do this? >> > >> >--- >> >beati pacifici quoniam filii Dei vocabuntur >> > >> > >> >- >> >To unsubscribe, e-mail: [EMAIL PROTECTED] >> >For additional commands, e-mail: [EMAIL PROTECTED] >> > >> > >> > >> >> ---
Re: auto-xxx
As I understand it both the OTM and ODMG implementations do this internally, so you must turn it off at the persistance-broker level. I have tried OTM (I don't particularly care for the ODMG API) but as I want to use the Spring framework I decided to stick w/ the PersistanceBroker for now. Martin I. Levi wrote: Hi Armin, I see in the documentation that I cannot use auto-update=true with ODMG. Is there any way to get OJB working this way: auto-retrieve=true auto-update=true auto-delete=false through OTM ? suggestions are welcome! On Mon, 2004-09-27 at 18:24, Armin Waibel wrote: Hi Martin, about repository.dtd http://db.apache.org/ojb/docu/guides/repository.html the auto-xxx settings http://db.apache.org/ojb/docu/guides/basic-technique.html#Setting+Load%2C+Update%2C+and+Delete+Cascading and as sub-section in 1:1, 1:n section, e.g. http://db.apache.org/ojb/docu/guides/basic-technique.html#1%3A1+auto-xxx+setting regards, Armin -- Robert r. Sanders Chief Technologist iPOV www.ipov.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Storing binary streams/arrays?
I have a table mapped as follows: The column on the database is a binary field (MySQL blob). The photoData field in the GearPhotoDataInstance class is a byte[]. Whenever I try to store an object, I get this exception: org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException: [B not found in OJB Repository I'm pretty sure "[B" is the "class" for a byte array, but I thought the BINARY jdbc-type stored and read byte arrays. I've checked the documentation and the mailing lists, but can't find what I'm doing wrong. Also, I'd LOVE to do this with a Blob object, to improve memory usage, but can't figure out how to use it. The documentation for that's not complete. Any tips? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tableless Mapping?
This may seem kind of dumb, but I recently ran into a case where I have a class which is essentially a custom collection (adding runtime behavior and checks) of persistent objects. I can manually construct a new object by retrieving a collection its collection of child objects and explicitly setting it (the custom collection has no persistent data outside of the child collection). I could add a separate table and force an association using a collection-reference, but that solution really feels like a kludge to me; if possible I would really prefer to create some sort of custom mapper and then use OJB to transparently query from the custom collection class. If this isn't feasible now I understand, but it would be a really nice piece of functionality. Thanks, -- Robert r. Sanders Chief Technologist iPOV www.ipov.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Official implementation request.
I'd tend to force an artificial primary key (as an extra field); but I suppose the customization options offered by OJB would allow you to write your own call-back to enable the kind of functionality your talking about. Clóvis Wichoski wrote: Hi, When we need this, I never use database NULL value for PK, instead I use a String initiated with 'NULL' then the Querys can change from: SELECT * FROM table1 WHERE field1 IS NULL AND field2 = '0001' to: SELECT * FROM table1WHERE field1 = 'NULL' AND field2 = '0001' This idea work on any Database, only you must to do is define what is your constant to NULL value. Hope this help Clóvis Nathan Smith wrote: Hi all, LabPro 2000 Ltd is a specialist provider of information management systems including LIMS (Laboratory Information Management Systems). We here at www.labpro2000.com currently use OJB as part of our eQual application development (http://demo.labpro2000.com). This is a redevelopment of the current application Labpro. To put it simply LabPro, is a QA solution for any testing. We use an RDBMS developed by a little known company called Progress (http://www.progress.com/progress/index.ssp). The RDBMS is a very good database but not many people have heard of it, so it is not really mainstream. The problem is this RDBMS allows records to be inserted with blank or null values for fields of the primary key. For example we have a table that uses 7 fields/columns as part of the PK. A record could be inserted with 6 of those fields blank or null. The use of the table is a special case as it defines range limits that testing results must fall within for a particular product to be assigined a quality code. One of the records in this table depending on what fields are blank can used for multiple products. We also have another table which is used in similar fashion The proposal: Can the repository.xml contain some property or database specific metadata element which can be used to determine whether NULL's or blanks can be used as ligitimate values for PK fields. Or maybe another way would be to enable some sort of callback that can be implemented through the Platform interface. Look forward to hearing your ideas. Nathan Smith Software Developer LabPro 2000 Limited Phone: +64 4 586 6840 Facsimile: +64 4 586 6841 <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED] <http://www.labpro2000.com/> www.labpro2000.com Level 6, Riverside Tower on Daly, 15 Daly Street Lower Hutt, New Zealand - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Robert r. Sanders Chief Technologist iPOV www.ipov.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OJB vs Hibernate
I wasn't kidding, HB list might help him figure out why it's so slow, it would be interesting to know what we're doing better that causes this. R On 8/9/04 9:24 AM, "Brian McCallister" <[EMAIL PROTECTED]> wrote: > On Aug 9, 2004, at 9:13 AM, Robert S. Sfeir wrote: > >> >> P.S. Did you post this on Hibernate list??? :-) >> > > gack, I realize this is a joke, but... please don't! The last thing we > need are more O/R pissing matches :-) > > -Brian > > > > - > 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: OJB vs Hibernate
Brian, Thanks for the post. The times between rc2 and 1.0, I believe, are actually to new PersistentFieldIntrospectorImplNew. If you're not using that, you should and you'll see an even bigger diff. That setting can be changed in OJB.properties HTH R P.S. Did you post this on Hibernate list??? :-) On 8/9/04 8:57 AM, "Mcgough, Brian Joseph" <[EMAIL PROTECTED]> wrote: > All, > > I just wanted to share some data points that were recently collected > that compare OJB and Hibernate and the ability to scale with both. > > We had a data file with only 10,000 records in it that we needed to load > into our database. Typically we use our batch environment, but given > that we are a java shop now, we wanted to see if we could use java and > our ORM tool to get the job done. > > We started out using Hibernate for this, and we found that we had some > real problems. It just would not scale whether or not we were using > transactions. We found that it would take greater than 17 hours to load > only 7500 of the records. Obviously this is unacceptable performance, > and so we thought to try the same thing using OJB. > > I am happy to report that using OJB we were able to load the whole file > of 10,000 in under 12 minutes. > > In addition to this, we just recently upgraded a project from OJB 1.0 > rc2 to OJB 1.0 and I am happy to report that for that particular project > db performance was improve by a factor greater than 10. This is mostly > due to the new implementation for FieldAccess. > > I just wanted to thank the developers for their attention to detail in > regards to ensuring that the overhead above jdbc was minimal, and for > all of the tests that they have written to ensure that is the case. We > are very happy that we are still able to use ORM for this instead of > straight jdbc, because the rest of the application is written using the > ORM. > > Anyway I just wanted to share these points with the group, for those of > you that are out there and are on the sidelines as far as which > framework will scale better. > > Brian McGough > IU - UITS - UIS - SIT > (812) 856-4871 > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Assistance with Timestamp
Dunno what DB you're on, but the DB will store the timestamp based on the JDBC driver/format your DB wants. On the retrieving of the Timestamp be sure that you're calling it the right way, OJB does nothing to remove information, if it doesn't come back from you DB, it's not going to show up. R On 8/2/04 8:15 PM, "Kalichar" <[EMAIL PROTECTED]> wrote: > I have a simple POJO that is defined in Oracle as DATE_TEST {ID, CREATED} of > type {NUMBER (9), DATE}. The equivalent POJO is: > > class DateTest { >public Integer ID; >public Timestamp created; > >// Evuivalent getter/setters > > } > > repository mapping file is defined as follows: > name="created" >column="CREATED" >jdbc-type="TIMESTAMP" > /> > > > I am hoping to store the Date in the format .MM.dd HH:mm:ss. How can I > accomplish this. When I attempt to store my POJO, it stores it in a different > format and while retrieving it, I seem to lose the "HH:mm:ss". > > Any assitance in the matter would be great. Thanks in advance. > Kalichar > > > - > 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]
Another piece of the puzzle? (was Re: Negative Sequence Numbers?)
I double-checked the configuration of my tests and realized I was running tests on a subclass, not the original User class that gets the wrong sequence numbers. So I dropped back and ran just the superclass. Everything worked fine; the sequence numbers were assigned correctly. So the configuration's OK for that class. Then I ran the tests again with the subclass. This class extends the original User class, with the extended information stored on a separate table, joined by the primary key. The second table's reference-descriptor is this: This time the key's messed up. It looks like the problem's related to the super-class relationship. Any ideas? I'm going to try the idea of having different primary keys on each table, with the subclass table referring to the superclass table in one of its columns. I don't know why this would work any better, but... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Negative Sequence Numbers?
Charles N. Harvey III said: > It means that something isn't set correctly in the database. > This has happened to me many times. It always happens when I turn on "native" sequencing (IDENTITY in MSSQL or AUTOINCREMENT in MySql). Check the PK of your database, it might not be properly set to increment. Whenever > this isn't set properly I get -1 and -2 for sequence numbers all the time. The database is OK -- I tested it directly, and it assigns sequence numbers correctly. This is the code; I've added transaction calls for the PB-api, but the table I'm using this with doesn't have transactions enabled, so those are effectively just null-ops: broker = PersistenceBrokerFactory.createPersistenceBroker(getPbKey()); broker.beginTransaction(); // 1. make sure no user with that username exists Criteria c = new Criteria(); c.addEqualTo("emailAddress", username); Query q = QueryFactory.newQuery(getUserInstanceClass(), c); Collection col = broker.getCollectionByQuery(q); if (col.size() > 0) { throw new DuplicateUsernameException(username); } // 2. create the new user and return its object User user = (User) getUserInstanceClass().newInstance(); user.setEmailAddress(username); user.setPassword(password); user.setFirstName(firstName); user.setLastName(lastName); broker.store(user); broker.commitTransaction(); Here's the class descriptor: I'm using the 1.0.0 release of OJB, if that matters. I've tried re-creating the table with the "auto_increment" and "primary key" attributes reversed on the table definition; that didn't change anything. I've tried forcing the userNbr field on the object to zero; that didn't change anything. Any ideas? -- "In discussing [terrorists], 'Capturing their hearts and minds' only makes sense if by that you mean, literally, capturing their hearts and minds and putting them in mason jars." -- Jonah Goldberg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Negative Sequence Numbers?
Armin Waibel said: > Robert Crawford wrote: > >> Armin Waibel said: >> >>>Robert Crawford wrote: >>> >>> >>>>Armin Waibel said: >>>> >>>> >>>>>Do you only use the PB-api? This bug is odmg-api related. >>>> >>>> >>>>I only use the PB-api. >>>> >>> >>>Then you shouldn't get problems with negative sequence numbers. >>>Can you describe me with some pseudo code an test case to reproduce your >>>problem? >> >> > > Don't you use transaction demarcation or is this code snip from an > managed environment with JTA transaction? I haven't been using transactions; that's one of the things I want to try tonight. I have other code where it works fine as-is, though. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Negative Sequence Numbers?
Armin Waibel said: > Robert Crawford wrote: > >> Armin Waibel said: >> >>>Do you only use the PB-api? This bug is odmg-api related. >> >> >> I only use the PB-api. >> > > Then you shouldn't get problems with negative sequence numbers. > Can you describe me with some pseudo code an test case to reproduce your > problem? >From memory, the code looks something like this: PersistenceBroker broker = PersistenceBrokerFactory.createPersistenceBroker(pbKey); User user = new User(); user.setEmailAddress(emailAddress); // more setters here, nothing that touches the primary key broker.store(user); At this point the database has a negative number for the primary key and, from what I can recall from my debugging, the user object has zero in the primary key field. Here's the start of the class descriptor: - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Negative Sequence Numbers?
Armin Waibel said: > Do you only use the PB-api? This bug is odmg-api related. I only use the PB-api. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Negative Sequence Numbers?
Armin Waibel said: > Hi Robert, > > there is bug in ODMG-api FK assignment when using > SequenceManagerNativeImpl (using DB Identity columns). > Test case is in CVS and we will try to fix this problem asap. > > workaround: use the PB-api to insert new object with 1:1 reference I'm not sure I understand, because I'm already using the PB-api. I'll try to give your sample code a try tonight, though. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Negative Sequence Numbers?
I'm using database sequence numbers with MySQL, and keep getting negative numbers for the primary keys. I understand these are coming from a temporary sequence ID used by OJB, but I thought that setting the right platform, sequence manager, and field attributes (primarykey="true" autoincrement="true" access="readonly") would force OJB to use the database sequence. I'm sure I'm missing something very simple; anyone know where I should look? Thanks! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
OTM makePersistent Error.
Hi, I've been following OJB for sometime now. I recently decided to switch a small web-app from using the PersistanceBroker to using OTM (I also updated from RC 6 to 1.0 final). After reading through the OTM tutorial, I changed my code to use OTM; however I get the following error when attempting to store new Objects. Is there some setting that I need to change or something? org.apache.ojb.otm.copy.ObjectCopyException: java.io.NotSerializableException: net.ipov.timesheet.TimeEntry at org.apache.ojb.otm.copy.SerializeObjectCopyStrategy.copy(Unknown Source) at org.apache.ojb.otm.copy.ReflectiveObjectCopyStrategy.handleObjectWithNoArgsConstructor(Unknown Source) at org.apache.ojb.otm.copy.ReflectiveObjectCopyStrategy.clone(Unknown Source) at org.apache.ojb.otm.copy.ReflectiveObjectCopyStrategy.copy(Unknown Source) at org.apache.ojb.otm.copy.MetadataObjectCopyStrategy.clone(Unknown Source) at org.apache.ojb.otm.copy.MetadataObjectCopyStrategy.clone(Unknown Source) at org.apache.ojb.otm.copy.MetadataObjectCopyStrategy.copy(Unknown Source) at org.apache.ojb.otm.core.ConcreteEditingContext.insertInternal(Unknown Source) at org.apache.ojb.otm.core.ConcreteEditingContext.insert(Unknown Source) at org.apache.ojb.otm.core.BaseConnection.makePersistent(Unknown Source) -- Robert r. Sanders Chief Technologist iPOV www.ipov.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OJB, MySql.... how do I create the data structures?
I have been using the OJB XDoclet module with good results. Just put some tags in the java files and you get XML mappings, etc... Paolo Salvan wrote: Hi! Ok, third mail... I've heard that reverse-db can be the wroing road What do you suggest to create the various java, xml and sql db? Is it more confortable using torque, druid or what? Starting from the .java class, some xml file or the sql DB? And how to generate all the remaining files? Thanks and bye! Paolo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Robert r. Sanders Chief Technologist iPOV www.ipov.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OJb Blog entry, JDO and other things.
Hahaha, that article feels old now :-) I'm working on a second one, dunno if I can get more OJB stuff past my editor, we'll see. Thanks though. R On 6/3/04 8:08 AM, "Antonio Gallardo" <[EMAIL PROTECTED]> wrote: > Hi Robert: > > Thanks for the answer. I agree with you, OJB needs to concentrate in > release the so long awaited 1.0 release. We have better thing to do. > > BTW, I already posted again your OJB article to TSS. I hope this time they > will publish it. :-) > > Best Regards, > > Antonio Gallardo > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- Robert S. Sfeir Technical Lead HHS Portal robert_sfeir(at)sra.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OJb Blog entry, JDO and other things.
Antonio, First of all you explain yourself really well, and write english better than a lot of people I know who live here. That said, I did understand the meaning of win. I was being funny, and perhaps that slipped through the translation cracks. What understood as win is that Hibernate wins the competition to OJB, and OJB is the loser no one looks at or is much less popular. My question is though, is it THAT important that OJB be #1? I know Apache is, and for very good reasons, but Apache is a different beast that existed at a different time and plays in a much different OS market. We're sitting in smack in the middle of the hottest market bed there is: Java, JDO, EJB, and J2EE. I don't know of a more hotly contested area of java right now. It is by far the busiest area of technology and there are new things invented every hour. I'd love OJB to be popular. It justifies my hours of research before I decided to dive in and use it over Hibernate. It might become and it might not. As far as JDO is concerned and friend of mine and I are already looking with Brian McCallister on how we would approach the JDO implementation and what is needed for it. I know Thomas has started working on the parser, perhaps the hardest part of the whole thing. So we're moving forward and everyone is doing what they can to keep it going forward, and that's important. I also believe we have a better framework already in place which would allow us to do that. I don't think Hibernate does. What's important is that we never allow OJB to become a political OS project. It's important that we write what we believe is useful and right. It's important that we write it well, present a product that performs well, and goes beyond what people expect from it. What's not important is playing the "I want to be popular too" game, and play right into the political game, which is only an emotional battle over territory all for the benefit of cry babies and ass kissers. In the end, the people who will be so fed up with the political garbage going on, will migrate to OJB simply because it's there, it's quiet and friendly, and it does everything they need, without the added lameness political issues bring along. What we do need to do right now is spew out an official version 1.0, and let the rest come along. R On 6/2/04 11:56 PM, "Antonio Gallardo" <[EMAIL PROTECTED]> wrote: > Robert Sfeir dijo: >> Win what? :-) >> >> The whole thing about java and open source is choice, there is no winner. >> Yes there could be more adopters, and yes some of the Hibernate stuff will >> end up in EJB 3.0, but in the end EJB is EJB, and the complexity of it all >> is not for every project. OJB is for every project, it's lightweight and >> follows existing standards, Hibernate doesn't, and EJB 3 is a ways out. >> >> If EJB 3 is Hibernate, good let Hibernate go to the dogs with EJB3 and in >> the end OJB will be around for people like most of us on here who really >> don't want to deal with the layers EJB brings along. > > Hi Robert and all: > > I know you recently wrote an article about OJB. As you remember, I also > send a post to TSS, but was never published. The reason why they decided > to not publish, is obscure to me. But amazing is that, after I ranting at > TSS a new Cocoon article that I posted a link few days before my public > rant, was published! The OJB article never. I will try to post it again. > > The "win" expression is a metaphore. For some people (including me), > english is not our first language and it is hard to express correctly what > we think in your language. > > In the literal sense of "win", maybe there are no winners expressed in a > cash income. I think even in OS there are winners too. ie: The Apache > httpd project is a winner. It is used for more than 60% of web servers in > the world and not just because it is free. And is perceived also as a > winner. A winner in the same sense when you win a race in the school. You > don't receive a money (or nothing) for your victory, but you are happy of > that. You feel as a winner. > > In the same sense, I think we need to let developers know that here is a > wonderful project called OJB. I think Open Source projects also need > publicity (as your article) and more links to OJB in the web. I already do > little efforts about that. I will be glad to see more OJB users. > > I have also concerns that the Open Source world is become very political. > Today I hear more often hear people saying that "because of politics" > things go this way. I think it damage the overall OS communities. I think > that the big commercial player have a big share in that. They need to > pr
Re: OJb Blog entry
Win what? :-) The whole thing about java and open source is choice, there is no winner. Yes there could be more adopters, and yes some of the Hibernate stuff will end up in EJB 3.0, but in the end EJB is EJB, and the complexity of it all is not for every project. OJB is for every project, it's lightweight and follows existing standards, Hibernate doesn't, and EJB 3 is a ways out. If EJB 3 is Hibernate, good let Hibernate go to the dogs with EJB3 and in the end OJB will be around for people like most of us on here who really don't want to deal with the layers EJB brings along. JMHO. R On 6/2/04 9:58 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Very interesting. I find myself asking the same questions. > > Hibernate is over hyped. But, could win anyways if OJB doesn't get the > recognition it deserves. > > Quoting Brian McCallister <[EMAIL PROTECTED]>: > >> Found this =) >> >> http://blog.w1c.ca/index.do?post=40288383fce5876c00fce6365cac0011 >> >> -Brian >> >> >> >> - >> 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] -- Robert S. Sfeir Technical Lead HHS Portal robert_sfeir(at)sra.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Intercepting updates and inserts
Hi, That seems like it will do what I need. I'll let you all know what I figure out. Thanks Rob :) From: Ron Gallagher [mailto:[EMAIL PROTECTED] Sent: Mon 31-May-04 4:17 p.m. To: OJB Users List Subject: RE: Intercepting updates and inserts Robert -- Check out these two interfaces: org.apache.ojb.broker.PBLifeCycleListener org.apache.ojb.broker.PBStateListener The PBLifeCycleListener provides callbacks that reflect all object-level operations (lookup, insert, update, delete). This is probably what you'll want to utilize. The PBStateListener interface provides callbacks that reflect "PersistenceBroker-level" operations (open, close, begin, commit, rollback). Both of the interfaces referenced above extend org.apache.ojb.broker.PBListener. So, if you've got an object that implements one or both of these interfaces, you can use the org.apache.ojb.broker.PersistenceBroker::addListener(PBListener) method to register that object as a 'listener'. On my last project, we made extensive use of these listener interfaces for the same reasons you've described. In our situation, we had our own 'factory' object that was used to serve up PersistenceBroker instances, so it was easy enough for us to set up one or more listeners before we served up any PersistenceBrokers. Ron Gallagher Atlanta, GA ron dot gallagher at bellsouth dot net -Original Message- From: Coup, Robert Muir [mailto:[EMAIL PROTECTED] Sent: Sunday, May 30, 2004 12:51 AM To: OJB Users List Subject: Intercepting updates and inserts Hi all, We're using OJB to interface our application to an online database (Postgre) as well as an offline database (HSQLDB). I'm in the process of writing some simple replication code to allow offline updates to be reconciled when the data is synchronised with the online database. What I would like to do is to intercept each update or delete being run by OJB and log some information about it (statement type, table, user, time, etc) it to another table. I could make all the persistent objects implement PersistenceBrokerAware and then do the logging in afterUpdate and afterDelete, but that isn't a stunningly elegant solution and I was wondering if there was another place I could hook into which wouldn't involve making changes to my persistent classes? If not, where would be the best place to jump into the OJB source to do what I need? Thanks again, Rob :) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Which release of postgresql use ?
You can also get the latest driver from here: http://jdbc.postgresql.org/download.html R On May 31, 2004, at 3:24 AM, A Leg wrote: Hi Antonio Thank's for your fast answer. The link to jdbc is helpfull. Andre Antonio Gallardo wrote: A Leg dijo: Which postgres release is best adapted to ojb 7.4.2, 7.3.6, 7.2.4 ? OJB is independent of the version. It uses JDBC to connect to the database. For that reason, I think you can choice any of them. Of course the lastest is the best. Also make sure to download the lastest JDBC driver from http://jdbc.postgresql.org/ Best Regards, Antonio Gallardo - 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] Robert S. Sfeir Technical Lead HHS Portal [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Which release of postgresql use ?
JDBC is installed with the Postgresql version you use. It's not something OJB has. You usually look somewhere under /usr/local/psql/shared/java (or somewhere close) hth R On May 31, 2004, at 3:24 AM, A Leg wrote: Hi Antonio Thank's for your fast answer. The link to jdbc is helpfull. Andre Antonio Gallardo wrote: A Leg dijo: Which postgres release is best adapted to ojb 7.4.2, 7.3.6, 7.2.4 ? OJB is independent of the version. It uses JDBC to connect to the database. For that reason, I think you can choice any of them. Of course the lastest is the best. Also make sure to download the lastest JDBC driver from http://jdbc.postgresql.org/ Best Regards, Antonio Gallardo - 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] Robert S. Sfeir Technical Lead HHS Portal [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Intercepting updates and inserts
Hi all, We're using OJB to interface our application to an online database (Postgre) as well as an offline database (HSQLDB). I'm in the process of writing some simple replication code to allow offline updates to be reconciled when the data is synchronised with the online database. What I would like to do is to intercept each update or delete being run by OJB and log some information about it (statement type, table, user, time, etc) it to another table. I could make all the persistent objects implement PersistenceBrokerAware and then do the logging in afterUpdate and afterDelete, but that isn't a stunningly elegant solution and I was wondering if there was another place I could hook into which wouldn't involve making changes to my persistent classes? If not, where would be the best place to jump into the OJB source to do what I need? Thanks again, Rob :) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Additional properties for connection.
Hi, For postgresql we just add it to the dbAlias attribute Eg. Dbalias="//myserver.example.com?ssl" to use a ssl connection Following the same logic you could use something like dbAlias="//myserver.example.com?charSet=Big5&prop2=value2&prop3=value3" Good luck, Rob :) > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Monday, 24 May 2004 6:27 a.m. > To: [EMAIL PROTECTED] > Subject: Additional properties for connection. > > hello, all! > > Is it possible to specify some additional properties, that > should be used for creation the connection in OJB? > > For example, I need to create connection something like this: > > // Load the JDBC-ODBC bridge driver >Class.forName(sun.jdbc.odbc.JdbcOdbcDriver) ; > >// setup the properties >java.util.Properties prop = new java.util.Properties(); >prop.put("charSet", "Big5"); >prop.put("user", username); >prop.put("password", password); > >// Connect to the database >con = DriverManager.getConnection(url, prop); > > How can I specify in repository.xml some additional > properties (like charSet in prop object) for connection? > Or it is impossible? > > Best Regards, > Alexey Kakunin > Project Manager > PIKOS GmbH > Post Str. 24 > 53111 Bonn > > Tel: +49 30 43 72 92-30 > Fax: +49 30 43 72 92-30 > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
questions: api, old objects, list to column mapping
Hi, I have some questions about OJB. There are three APIs that you can use: Persistence Broker, ODMG and JDO. Do you have to choose one of these APIs to use in your project, or is it normal to mix them and use the one that is most convenient at the moment? What if the database in your application is running for some time and you want to change the definition of the class ir change the mapping. For example you want to add a Nationality field to a Person class. What will happen to the old persistent Person objects? Can you specify a default value for the old objects? Is it possible to map a List to a table in such a way that entry 1 to 5 is mapped to column 1 to 5 in a table? Thanks for any answers, Robert. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Creating Reports
A quick search of sourceforge finds: OpenReports : http://sourceforge.net/projects/oreports/ JasperReports : http://sourceforge.net/projects/jasperreports/ JFreeReport : http://sourceforge.net/projects/jfreereport/ I think all 3 of these tools use an xml based syntax. I have played around w/ then a little, but not enough to offer any advice. I don't think any integrate directly w/ OJB, but you could probably write a wrapper for the OJB Report Query class for use with the tools. Good luck. Keith Rogers wrote: I've gotten around to the part of my application that needs to produce reports on various things. Rather than hard-code reports, which would, admittedly make my job more secure :-) , I'd like to be able to write a definition of the report in XML, and have some parser take this and produce the report automatically on demand. I realise that this is not going to be a trivial task, so my first question is - Has anyone done anything similar for OJB? Assuming the answer is "No", I suppose I'll have to try it myself... Does anyone know of a similar report-from-xml-definition that I might draw ideas from? Keith -- Robert r. Sanders Chief Technologist iPOV www.ipov.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]