RE: Upgrade form 0.9.5 to 1.0rc4 : foreign key problem
The name of the method is : broker.retrieveAllReferences() Frank -Original Message- From: Graham Lounder [mailto:[EMAIL PROTECTED] Sent: woensdag 3 december 2003 15:13 To: 'OJB Users List' Subject: RE: Upgrade form 0.9.5 to 1.0rc4 : foreign key problem Hey Wally, So if I call broker.resolveAllReferences(obj); in my generic store method, I should be able to remove my hack that stops OJB from setting my foreign keys to null? I guess this may slow things down a little but I prefer to get rid of my custom OJB code. Graham -Original Message- From: Gelhar, Wallace Joseph [mailto:[EMAIL PROTECTED] Sent: December 3, 2003 10:07 AM To: OJB Users List Subject: RE: Upgrade form 0.9.5 to 1.0rc4 : foreign key problem Hi Frank, I upgraded from ojb0.9.5 to 1.0 rc4. Some of my unit tests fail because sometimes foreign key values (1 - N relationship) are not stored : Example : - // Create productgroup ProductGroup pg = new ProductGroupBean(); pg.setGroupName(TESTPRODUCTGROUP); pg.setGroupDescription(DESCRIPTION); broker.store(pg); // Create 2 articles for this productgroup for (int j = 1; j = 2; j++) { Article ar = new ArticleBean(); ar.setArticleName(ARTICLE + j); ar.setProductGroupId(pg.getGroupId()); --- NOT stored in the database broker.store(ar); } Is this a bug ? No, this isn't a bug. You have to either set the reference (i.e. ar.setProductGroup(pg)) or set the ID and resolve the reference (i.e. ar.setProductGroupId(pg.getGroupId()); broker.resolveAllReferences(ar); broker.store(ar); ) Hope this helps, Wally Gelhar UW - Eau Claire Facilities Planning Management - 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]
error when start OJB
Hello, I have this error when I launch OJB: [BOOT] INFO: OJB.properties: file:/C:/Eclipse_projects/woc_cocoon_2.1.2/WEB-INF/classes/OJB.properties java.lang.NoClassDefFoundError: org/apache/commons/pool/PoolableObjectFactory at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) etc... I haven't found any class called PoolableObjectFactory in OJB.properties. What does it mean? Thanks Sylvain - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: error when start OJB
[EMAIL PROTECTED] wrote: java.lang.NoClassDefFoundError: org/apache/commons/pool/PoolableObjectFactory What does it mean? It means that an external package that OJB depends on (Jakarta Commons Pool in this case) is not present in your classpath. Check out http://db.apache.org/ojb/deployment.html for the OJB deployment guide, or (more to the point) http://db.apache.org/ojb/dependencies.html for a list of the JAR-files you need to deploy with OJB. -- Martin Kalén Curalia AB Web: http://www.curalia.se Orrspelsvägen 2BMail: [EMAIL PROTECTED] SE-182 79 StocksundTel: +46-8-410 064 40 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Upgrade form 0.9.5 to 1.0rc4 : wildcard problems
Hi, In version 0.9.5 it was possible to use wildcards in where-criteria. Example : criteria.addEqualTo(productGroup.groupName,pro*gro?p 1); This seems not to work anymore in 1.0rc4 ? Is it a bug ? Thanks, Frank
RE : error when start OJB
Hello, All the JAR I need are in the classpath. When I run OJB from a servlet it works well but when I run it from a main() method this error occurs. There is no differences between them. That's a bit strange! Sylvain -Original Message- From: Martin Kalén [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 9:42 AM To: OJB Users List Subject: Re: error when start OJB [EMAIL PROTECTED] wrote: java.lang.NoClassDefFoundError: org/apache/commons/pool/PoolableObjectFactory What does it mean? It means that an external package that OJB depends on (Jakarta Commons Pool in this case) is not present in your classpath. Check out http://db.apache.org/ojb/deployment.html for the OJB deployment guide, or (more to the point) http://db.apache.org/ojb/dependencies.html for a list of the JAR-files you need to deploy with OJB. -- Martin Kalén Curalia AB Web: http://www.curalia.se Orrspelsvägen 2BMail: [EMAIL PROTECTED] SE-182 79 StocksundTel: +46-8-410 064 40 - 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: RE : error when start OJB
Hi, it must be some classpath problem... note that all jars deployed in WEB-INF/lib are automagically added to the classpath by the web server, however if you use OJB in a standalone application, you have to add each jar file to the CLASSPATH and not only the directory where they are located. cheers danilo Hello, All the JAR I need are in the classpath. When I run OJB from a servlet it works well but when I run it from a main() method this error occurs. There is no differences between them. That's a bit strange! Sylvain -Original Message- From: Martin Kalén [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 9:42 AM To: OJB Users List Subject: Re: error when start OJB [EMAIL PROTECTED] wrote: java.lang.NoClassDefFoundError: org/apache/commons/pool/PoolableObjectFactory What does it mean? It means that an external package that OJB depends on (Jakarta Commons Pool in this case) is not present in your classpath. Check out http://db.apache.org/ojb/deployment.html for the OJB deployment guide, or (more to the point) http://db.apache.org/ojb/dependencies.html for a list of the JAR-files you need to deploy with OJB. -- Martin Kalén Curalia AB Web: http://www.curalia.se Orrspelsvägen 2BMail: [EMAIL PROTECTED] SE-182 79 StocksundTel: +46-8-410 064 40 - 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]
Problem mapping inheritance hierarchy using joined tables for subclasses
Hi, I try to map two classes Address and PersonAddress (a subclass of Address) using the joined table per sublcass strategy. This is my mapping: class-descriptor class=de.armax.sandbox.entity.Address table=Address field-descriptor autoincrement=true primarykey=true column=adrOID jdbc-type=VARCHAR name=oID/ field-descriptor column=adrAttribute jdbc-type=VARCHAR name=attribute/ ... /class-descriptor class-descriptor class=de.armax.sandbox.entity.PersonAddress table=PersonAddress field-descriptor autoincrement=true primarykey=true column=padOID jdbc-type=VARCHAR name=oID/ field-descriptor column=padAdditionalAttribute jdbc-type=VARCHAR name=additionalAttribute/ ... reference-descriptor auto-delete=true auto-update=true name=super class-ref=de.armax.sandbox.entity.Address foreignkey field-ref=oID/ /reference-descriptor /class-descriptor Storing new Addresses or Personaddresses works fine. But when I reload Adresses using broker.getIteratorByQuery(QueryFactory.newQuery(Address.class, new Criteria())); OJB seems not to care about what type these addresses have. All returned entities will be of type Address, even if they were stored as PersonAddress. Is this a bug or am I missing something here? Thanks for any help, Peter P.S.: I'm very sorry if this mail appears two times on the list. I send it from a bad account before and I'm not sure weather the ojb user list accepts this. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re:Problem mapping inheritance hierarchy using joined tables for subclasses
Hello Peter, I've worked with inheritance and all works well (with some help of the mailing list). You shoud look at my past post or you should post your complete java code. Hi, I try to map two classes Address and PersonAddress (a subclass of Address) using the joined table per sublcass strategy. This is my mapping: class-descriptor class=de.armax.sandbox.entity.Address table=Address field-descriptor autoincrement=true primarykey=true column=adrOID jdbc-type=VARCHAR name=oID/ field-descriptor column=adrAttribute jdbc-type=VARCHAR name=attribute/ ... /class-descriptor class-descriptor class=de.armax.sandbox.entity.PersonAddress table=PersonAddress field-descriptor autoincrement=true primarykey=true column=padOID jdbc-type=VARCHAR name=oID/ field-descriptor column=padAdditionalAttribute jdbc-type=VARCHAR name=additionalAttribute/ ... reference-descriptor auto-delete=true auto-update=true name=super class-ref=de.armax.sandbox.entity.Address foreignkey field-ref=oID/ /reference-descriptor /class-descriptor Storing new Addresses or Personaddresses works fine. But when I reload Adresses using broker.getIteratorByQuery(QueryFactory.newQuery(Address.class, new Criteria())); OJB seems not to care about what type these addresses have. All returned entities will be of type Address, even if they were stored as PersonAddress. Is this a bug or am I missing something here? Thanks for any help, Peter P.S.: I'm very sorry if this mail appears two times on the list. I send it from a bad account before and I'm not sure weather the ojb user list accepts this. - 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 : RE : error when start OJB
All the JARs needed are in the CLASSPATH, I can check that when I run the standalone application in Eclipse. Just one question: is OJB 0.9.5 OK with JDK 1.4 (because I have just changed it)?? Sylvain -Original Message- From: Danilo Tommasina [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 12:19 PM To: OJB Users List Subject: Re: RE : error when start OJB Hi, it must be some classpath problem... note that all jars deployed in WEB-INF/lib are automagically added to the classpath by the web server, however if you use OJB in a standalone application, you have to add each jar file to the CLASSPATH and not only the directory where they are located. cheers danilo Hello, All the JAR I need are in the classpath. When I run OJB from a servlet it works well but when I run it from a main() method this error occurs. There is no differences between them. That's a bit strange! Sylvain -Original Message- From: Martin Kalén [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 9:42 AM To: OJB Users List Subject: Re: error when start OJB [EMAIL PROTECTED] wrote: java.lang.NoClassDefFoundError: org/apache/commons/pool/PoolableObjectFactory What does it mean? It means that an external package that OJB depends on (Jakarta Commons Pool in this case) is not present in your classpath. Check out http://db.apache.org/ojb/deployment.html for the OJB deployment guide, or (more to the point) http://db.apache.org/ojb/dependencies.html for a list of the JAR-files you need to deploy with OJB. -- Martin Kalén Curalia AB Web: http://www.curalia.se Orrspelsvägen 2BMail: [EMAIL PROTECTED] SE-182 79 StocksundTel: +46-8-410 064 40 - 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: Upgrade form 0.9.5 to 1.0rc4 : wildcard problems
Hello, -Original Message- In version 0.9.5 it was possible to use wildcards in where-criteria. Example : criteria.addEqualTo(productGroup.groupName,pro*gro?p 1); This seems not to work anymore in 1.0rc4 ? Have you tried criteria.addLike()? Is it a bug ? I do not think so. Olli - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
INSERT with empty fields OJB / MySQL
Hello, I'm running ojb v. 1.0.rc4-src. I have a domain object containing some java.sql.Timestamp attributes that might be empty. When I insert them into the datbase via ojb, the empty date-attribues are filled with the current date. I have logged the insert statement with p6spy it looks like this: INSERT INTO T (ID,C_ID,RECEPTION_DATE) VALUES ('123','76','') The mysql-db changes '' to the current date. My repository-xml looks like this: class-descriptor class=com.yyy.T table=T field-descriptor name=id primarykey=true nullable=false column=ID jdbc-type=VARCHAR/ field-descriptor name=cId column=C_ID jdbc-type=VARCHAR/ field-descriptor name=receptionDate column=RECEPTION_DATE jdbc-type=TIMESTAMP/ /class-descriptor My table in the database looks like this +-+---+--+-+-+---+ | Field | Type | Null | Key | Default | Extra | +-+---+--+-+-+---+ | T_ID| varchar(22) | | PRI | | | | C_ID| varchar(22) | YES | | NULL| | | RECEPTION_DATE | timestamp(14) | YES | | NULL| | Is there a possibilty to configure ojb to use null instead of '' or even to write insert statements that only contain the attributes that are != null? Or any other workaround? Thank you Volker Konrad - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Upgrade form 0.9.5 to 1.0rc4 : foreign key problem
Hello, I do not know about your model, but I suppose Aricle has a reference field productGroup of type ProduktGroup and an Integer (or String) field of type productGroupId, which is mapped to a foreign key column. Let me ask a question: Why is there a setter for the latter field? Why is that field modified by your application code? As I understand it, OJB is supposed to treat that field correctly. In our application, that field is private and has no getters and setters. -Original Message- Example : - // Create productgroup ProductGroup pg = new ProductGroupBean(); pg.setGroupName(TESTPRODUCTGROUP); pg.setGroupDescription(DESCRIPTION); broker.store(pg); // Create 2 articles for this productgroup for (int j = 1; j = 2; j++) { Article ar = new ArticleBean(); ar.setArticleName(ARTICLE + j); ar.setProductGroupId(pg.getGroupId()); --- NOT stored in the database If I am write with my assumptions, you should have ar.setProductGroup(pg) here. broker.store(ar); } HTH, Olli - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
WHY OJB SPEND MORE AND MORE TIME TO STORE OBJECTS ?
Hi everybody, i have an important problem of performance. I'd tried every type of object cache (default,empty,perBroker), i instanciated a new PersistenceBroker instance each time i had a storing sequence in my java Code, or I kept the same for all storing sequence. I did it the same thing with MetadataManager. But it isn't better. OJB is slower every time is storing an object, about few seconds more longer. As i store thousand objects, at the end OJB is very slow. I think there is also a problem of memory. So i run the garabage collector after each storing sequence, and the clearCache() of the instance of PersistenceBroker. I use a transaction for each storing sequence. is there somebody who can help me? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem mapping inheritance hierarchy using joined tables for subclasses
Hi Peter, You might want to try declaring PersonAddress as an extend in the class-descriptor for Address (see the Advanced OR Mapping Tutorial on the website). I haven't tried this myself, but I was reading that section of the tutorial last night and I think an extent might solve your problem. Cheers, Greg Plummer -Original Message- From: Peter Wieland [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 4:22 AM To: [EMAIL PROTECTED] Subject: Problem mapping inheritance hierarchy using joined tables for subclasses Hi, I try to map two classes Address and PersonAddress (a subclass of Address) using the joined table per sublcass strategy. This is my mapping: class-descriptor class=de.armax.sandbox.entity.Address table=Address field-descriptor autoincrement=true primarykey=true column=adrOID jdbc-type=VARCHAR name=oID/ field-descriptor column=adrAttribute jdbc-type=VARCHAR name=attribute/ ... /class-descriptor class-descriptor class=de.armax.sandbox.entity.PersonAddress table=PersonAddress field-descriptor autoincrement=true primarykey=true column=padOID jdbc-type=VARCHAR name=oID/ field-descriptor column=padAdditionalAttribute jdbc-type=VARCHAR name=additionalAttribute/ ... reference-descriptor auto-delete=true auto-update=true name=super class-ref=de.armax.sandbox.entity.Address foreignkey field-ref=oID/ /reference-descriptor /class-descriptor Storing new Addresses or Personaddresses works fine. But when I reload Adresses using broker.getIteratorByQuery(QueryFactory.newQuery(Address.class, new Criteria())); OJB seems not to care about what type these addresses have. All returned entities will be of type Address, even if they were stored as PersonAddress. Is this a bug or am I missing something here? Thanks for any help, Peter P.S.: I'm very sorry if this mail appears two times on the list. I send it from a bad account before and I'm not sure weather the ojb user list accepts this. - 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:Problem mapping inheritance hierarchy using joined tables for subclasses
Hi, once again me, I tried to understand your past posts, but I'm afraid I didn't. I found a thread Inheritance delete but I think I am missing some posts and hence I do not understand the answers. I'll repost my problem trying to be a little more explicit this time. The tables: CREATE CACHED TABLE Address ( adrOID VARCHAR(50) NOT NULL, adrAttribute VARCHAR(50), ... PRIMARY KEY (adrOID) ); CREATE CACHED TABLE PersonAddress ( padOID VARCHAR(50) NOT NULL, padAdditionalAttribute VARCHAR(50), ... PRIMARY KEY (padOID) ); The mapping: class-descriptor class=de.armax.sandbox.entity.Address table=Address field-descriptor autoincrement=true primarykey=true column=adrOID jdbc-type=VARCHAR name=oID/ field-descriptor column=adrAttribute jdbc-type=VARCHAR name=attribute/ ... /class-descriptor class-descriptor class=de.armax.sandbox.entity.PersonAddress table=PersonAddress field-descriptor autoincrement=true primarykey=true column=padOID jdbc-type=VARCHAR name=oID/ field-descriptor column=padAdditionalAttribute jdbc-type=VARCHAR name=additionalAttribute/ ... reference-descriptor auto-delete=true auto-update=true name=super class-ref=de.armax.sandbox.entity.Address foreignkey field-ref=oID/ /reference-descriptor /class-descriptor The first part of Java-code: // create the broker, etc ... // create and store person address PersonAddress pad = new PersonAddress(); pad.setAttribute(Attribute); pad.setAdditionalAttribute(Additional attribute); broker.store(pad); // create and store address Address adr = new Address(); adr.setAttribute(Simple address); broker.store(adr); The second part of Java-code: for (Iterator iter = broker.getIteratorByQuery(QueryFactory.newQuery(Address.class, new Criteria()));iter.hasNext();) { Object o = iter.next(); logger.info(Found instance of + o.getClass().getName()); broker.delete(o); } The problem: The first part of Java-code executes the following SQL statements (having exactly the result I am expecting): INSERT INTO Address (adrOID,adrAttribute,adrOrderOID) VALUES ('A1CCAA3F-2E19-71E6-15F1-852ADB0D12C8','Attribute','') INSERT INTO PersonAddress (padOID,padAdditionalAttribute,padPersonOID) VALUES ('A1CCAA3F-2E19-71E6-15F1-852ADB0D12C8','Additional attribute','') INSERT INTO Address (adrOID,adrAttribute,adrOrderOID) VALUES ('56F48112-07C4-BCB3-F16F-AA4FD39AE564','Simple address','') The second part of Java-code produces the following log messages: INFO [OjbMain.java Line:85] Found instance of de.armax.sandbox.entity.Address (OID: 56F48112-07C4-BCB3-F16F-AA4FD39AE564) INFO [OjbMain.java Line:85] Found instance of de.armax.sandbox.entity.Address (OID: A1CCAA3F-2E19-71E6-15F1-852ADB0D12C8) And here is the Proble. I expected one instance of Address and one instance of PersonAddress. The delete statements do of course not delete the entry in the PersonAddress table as OJB does not know that one of the two Address objects corresponds to a person address. I tried to add an extent-class tag to the mapping for address resulting in a StackOverflow error (I found some posts about this in the list archive but just wanted to try it before posting). I also tried changing the auto-*** attributes of the super-reference-descriptor. Didn't help either. I hope that after this more detailed description of my scenario anyone can provide help or hints. I can't imagine that I am the first one trying this :-). Regards, Peter P.S.: Balza, what kind of mapping to you use to map your inheritance hierarchies? I used to use table per concrete class mapping and everything works fine. But I need joined-table per subclass for compatibility reasons and I do not get it work. Hello Peter, I've worked with inheritance and all works well (with some help of the mailing list). You shoud look at my past post or you should post your complete java code. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: WHY OJB SPEND MORE AND MORE TIME TO STORE OBJECTS ?
Can you post the related repository.xml and java code? It's impossible to say without looking at the code. Daniel. - Original Message - From: ghielard [EMAIL PROTECTED] To: OJB User [EMAIL PROTECTED] Sent: Thursday, December 04, 2003 2:23 PM Subject: WHY OJB SPEND MORE AND MORE TIME TO STORE OBJECTS ? Hi everybody, i have an important problem of performance. I'd tried every type of object cache (default,empty,perBroker), i instanciated a new PersistenceBroker instance each time i had a storing sequence in my java Code, or I kept the same for all storing sequence. I did it the same thing with MetadataManager. But it isn't better. OJB is slower every time is storing an object, about few seconds more longer. As i store thousand objects, at the end OJB is very slow. I think there is also a problem of memory. So i run the garabage collector after each storing sequence, and the clearCache() of the instance of PersistenceBroker. I use a transaction for each storing sequence. is there somebody who can help me? - 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]
Antwort: WHY OJB SPEND MORE AND MORE TIME TO STORE OBJECTS ?
Hi, is it possible that you have an index on that table??? If you build a complex index every time you insert a set of data your index takes more time. cheers, Ralf ghielard [EMAIL PROTECTED] schrieb am 04.12.2003 15:23:45: Hi everybody, i have an important problem of performance. I'd tried every type of object cache (default,empty,perBroker), i instanciated a new PersistenceBroker instance each time i had a storing sequence in my java Code, or I kept the same for all storing sequence. I did it the same thing with MetadataManager. But it isn't better. OJB is slower every time is storing an object, about few seconds more longer. As i store thousand objects, at the end OJB is very slow. I think there is also a problem of memory. So i run the garabage collector after each storing sequence, and the clearCache() of the instance of PersistenceBroker. I use a transaction for each storing sequence. is there somebody who can help me? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Antwort: WHY OJB SPEND MORE AND MORE TIME TO STORE OBJECTS ?
There is no index in my database, only primary and foreign keys. The phenomena still the same with an Oracle 8i database or a SQLServer 2000 database. I removed every attributes in my repository_user.xml using datatype CLOB (ora) or TEXT (SQLServer2000). I removed also every conversions in this file, and all reference descriptor. i thougth also it was my database but even if i don't delete all datas before running my application. it started with a good speed but it goes wrong. I removed all datas in my database before each storing sequence. The problem lasts. -Message d'origine- De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Envoye : jeudi 4 decembre 2003 15:50 A : OJB Users List Objet : Antwort: WHY OJB SPEND MORE AND MORE TIME TO STORE OBJECTS ? Hi, is it possible that you have an index on that table??? If you build a complex index every time you insert a set of data your index takes more time. cheers, Ralf ghielard [EMAIL PROTECTED] schrieb am 04.12.2003 15:23:45: Hi everybody, i have an important problem of performance. I'd tried every type of object cache (default,empty,perBroker), i instanciated a new PersistenceBroker instance each time i had a storing sequence in my java Code, or I kept the same for all storing sequence. I did it the same thing with MetadataManager. But it isn't better. OJB is slower every time is storing an object, about few seconds more longer. As i store thousand objects, at the end OJB is very slow. I think there is also a problem of memory. So i run the garabage collector after each storing sequence, and the clearCache() of the instance of PersistenceBroker. I use a transaction for each storing sequence. is there somebody who can help me? - 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: Antwort: WHY OJB SPEND MORE AND MORE TIME TO STORE OBJECTS ?
If you leave data in your database, and run the test again, does it start quickly or slowly? This should tell if the problem is to do with size of database, or to do with the code. any unproxied references in repository.xml? are you closing transactions properly? Daniel. - Original Message - From: ghielard [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Thursday, December 04, 2003 3:23 PM Subject: RE: Antwort: WHY OJB SPEND MORE AND MORE TIME TO STORE OBJECTS ? There is no index in my database, only primary and foreign keys. The phenomena still the same with an Oracle 8i database or a SQLServer 2000 database. I removed every attributes in my repository_user.xml using datatype CLOB (ora) or TEXT (SQLServer2000). I removed also every conversions in this file, and all reference descriptor. i thougth also it was my database but even if i don't delete all datas before running my application. it started with a good speed but it goes wrong. I removed all datas in my database before each storing sequence. The problem lasts. -Message d'origine- De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Envoye : jeudi 4 decembre 2003 15:50 A : OJB Users List Objet : Antwort: WHY OJB SPEND MORE AND MORE TIME TO STORE OBJECTS ? Hi, is it possible that you have an index on that table??? If you build a complex index every time you insert a set of data your index takes more time. cheers, Ralf ghielard [EMAIL PROTECTED] schrieb am 04.12.2003 15:23:45: Hi everybody, i have an important problem of performance. I'd tried every type of object cache (default,empty,perBroker), i instanciated a new PersistenceBroker instance each time i had a storing sequence in my java Code, or I kept the same for all storing sequence. I did it the same thing with MetadataManager. But it isn't better. OJB is slower every time is storing an object, about few seconds more longer. As i store thousand objects, at the end OJB is very slow. I think there is also a problem of memory. So i run the garabage collector after each storing sequence, and the clearCache() of the instance of PersistenceBroker. I use a transaction for each storing sequence. is there somebody who can help me? - 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: Problem mapping inheritance hierarchy using joined tables for subclasses
Well Peter, You've exhausted my knowledge. I would guess it is a bug / incompatibility with using the extent class along with the super reference mapping strategy. Any ideas / comments from the contributors? Wally -Original Message- From: Peter Wieland [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 9:23 AM To: [EMAIL PROTECTED] Subject: RE: Problem mapping inheritance hierarchy using joined tables for subclasses Try refresh=false on the super reference. Does not work either. I tried refresh=false auto-retrieve=false auto-delete=false auto-update=false on the super reference. But I stell get the StackOverflowError when querying: broker.getIteratorByQuery(QueryFactory.newQuery(Address.class, new Criteria())); Peter - 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: Problem mapping inheritance hierarchy using joined tables for subclasses
Well, that's what I tried resulting in a StackOverflow error. I guess it has to do with the auto-update, auto-delete and auto-retrieve attributes of the super reference-descriptor in the subclass. Could anyone tell what settings for those attribute are needed/possible for a correct mapping of inheritance hierarchies? Thanks, Peter Hi Peter, You will need to add PersonAddress as an Extent of Address if you want PersonAddress to be in the seach domain of a query for class Address. Wally - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JDO inheritence
Hallo, I'm trying to store an object which inherits some attributes from a superclass, but values are only be inserted in the subclass table an nothing is inserted in the superclass table. Objectmodel: Class BusinessPartner() Integer bpid; String attribute Class Individual extends BusinessPartner() String oneMoreAttribute; To get it a little bit more complicated I use the JDO plugin my JDO-Files look as follows: == Individual.jdo ?xml version=1.0 encoding=UTF-8? !DOCTYPE jdo PUBLIC -//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 1.0//EN http://java.sun.com/dtd/jdo_1_0.dtd; jdo package name=demo.myshop.model.ojb class name=Individual persistence-capable-superclass=demo.myshop.model.ojb.BusinessPartner field name=fk_bpid persistence-modifier=persistent/field field name=gender persistence-modifier=persistent/field /class /package /jdo == BusinessPartner.jdo ?xml version=1.0 encoding=UTF-8? !DOCTYPE jdo PUBLIC -//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 1.0//EN http://java.sun.com/dtd/jdo_1_0.dtd; jdo package name=demo.myshop.model.ojb class name=BusinessPartner identity-type=datastore field name=Bpid persistence-modifier=persistent/field field name=Adress persistence-modifier=persistent/field field name=Name persistence-modifier=persistent/field /class /package /jdo The Repository.xml looks as follows: class-descriptor class=demo.myshop.model.ojb.BusinessPartner table=OJB_BUSINESSPARTNER field-descriptor name=Bpid column=BPID jdbc-type=INTEGER primarykey=true autoincrement=true/ field-descriptor name=Adress column=ADRESS jdbc-type=VARCHAR/ field-descriptor name=Name column=NAME jdbc-type=VARCHAR/ /class-descriptor class-descriptor class=demo.myshop.model.ojb.Individual table=OJB_INDIVIDUAL field-descriptor name=fk_bpid column=FK_BPID jdbc-type=INTEGER primarykey=true autoincrement=true/ field-descriptor name=gender column=GENDER jdbc-type=VARCHAR/ reference-descriptor name=super class-ref=demo.myshop.model.ojb.BusinessPartner foreignkey field-ref=fk_bpid / /reference-descriptor /class-descriptor The source code: //Individual Testdata Individual ind0 = new Individual(); ind0.setAdress(Adress IND0); ind0.setName(Name IND0); ind0.setGender(male); t.begin(); pm.makePersistent(ind0); t.commit(); So the problem was that there is only an entry in the OJB_INDIVIDUAL table an none in the OJB_BUSINESSPARTNER table. I hope someone can help me ! Thanks, Stephan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem mapping inheritance hierarchy using joined tables for subclasses
Hi Peter, Try refresh=false on the super reference. Wally -Original Message- From: Peter Wieland [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 8:50 AM To: [EMAIL PROTECTED] Subject: RE: Problem mapping inheritance hierarchy using joined tables for subclasses Well, that's what I tried resulting in a StackOverflow error. I guess it has to do with the auto-update, auto-delete and auto-retrieve attributes of the super reference-descriptor in the subclass. Could anyone tell what settings for those attribute are needed/possible for a correct mapping of inheritance hierarchies? Thanks, Peter Hi Peter, You will need to add PersonAddress as an Extent of Address if you want PersonAddress to be in the seach domain of a query for class Address. Wally - 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]
WHY OJB SPEND MORE AND MORE TIME TO STORE OBJECTS ?
Hi everybody, i have an important problem of performance. I'd tried every type of object cache (default,empty,perBroker), i instanciated a new PersistenceBroker instance each time i had a storing sequence in my java Code, or I kept the same for all storing sequence. I did it the same thing with MetadataManager. But it isn't better. OJB is slower every time is storing an object, about few seconds more longer. As i store thousand objects, at the end OJB is very slow. I think there is also a problem of memory. So i run the garabage collector after each storing sequence, and the clearCache() of the instance of PersistenceBroker. I use a transaction for each storing sequence. is there somebody who can help me? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Antwort: WHY OJB SPEND MORE AND MORE TIME TO STORE OBJECTS ?
I used different -X parameter. That ensure that storing sequences will be done but the speed decrease still the same. -Message d'origine- De : Göschl,Siegfried [mailto:[EMAIL PROTECTED] Envoyé : jeudi 4 décembre 2003 16:27 À : OJB Users List Objet : AW: Antwort: WHY OJB SPEND MORE AND MORE TIME TO STORE OBJECTS ? Maybe you can have a look at the memory consumption of a long-running test?! If you run low on memory the JVM starts to trash. Another point to consider is the settings of your JVM ... especially the maximum heap size if you have one defined (-X properties). A non-OJB user Siegfried Goeschl -Ursprüngliche Nachricht- Von: ghielard [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 04. Dezember 2003 16:23 An: OJB Users List Betreff: RE: Antwort: WHY OJB SPEND MORE AND MORE TIME TO STORE OBJECTS ? There is no index in my database, only primary and foreign keys. The phenomena still the same with an Oracle 8i database or a SQLServer 2000 database. I removed every attributes in my repository_user.xml using datatype CLOB (ora) or TEXT (SQLServer2000). I removed also every conversions in this file, and all reference descriptor. i thougth also it was my database but even if i don't delete all datas before running my application. it started with a good speed but it goes wrong. I removed all datas in my database before each storing sequence. The problem lasts. -Message d'origine- De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Envoye : jeudi 4 decembre 2003 15:50 A : OJB Users List Objet : Antwort: WHY OJB SPEND MORE AND MORE TIME TO STORE OBJECTS ? Hi, is it possible that you have an index on that table??? If you build a complex index every time you insert a set of data your index takes more time. cheers, Ralf ghielard [EMAIL PROTECTED] schrieb am 04.12.2003 15:23:45: Hi everybody, i have an important problem of performance. I'd tried every type of object cache (default,empty,perBroker), i instanciated a new PersistenceBroker instance each time i had a storing sequence in my java Code, or I kept the same for all storing sequence. I did it the same thing with MetadataManager. But it isn't better. OJB is slower every time is storing an object, about few seconds more longer. As i store thousand objects, at the end OJB is very slow. I think there is also a problem of memory. So i run the garabage collector after each storing sequence, and the clearCache() of the instance of PersistenceBroker. I use a transaction for each storing sequence. is there somebody who can help me? - 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: DefaultLogger/Log4J
I think if you put this line in your log4j.properties: log4j.logger.org.apache.ojb.broker.cache.ObjectCacheFactory=WARN CACHE STATISTICS logs won't be written any more. -Message d'origine- De : Dave Hodson [mailto:[EMAIL PROTECTED] Envoye : jeudi 4 decembre 2003 03:07 A : [EMAIL PROTECTED] Objet : DefaultLogger/Log4J I'm using Log4J instead of PoorMansLogging and could not figure out how to remove the following debug from my logs 2003-12-03 12:02:11,124 DEBUG [Finalizer] Host: IP: Session: PINID: UID: DEFAULT - [EMAIL PROTECTED] CACHE STATISTICS Count of cached objects=0 lookups=0 failures=0 reclaimed=0 ] After spending some time, I realized that the entry in my log4j.properties file needs to be: log4j.logger.DEFAULT=WARN to only receive msgs that are level WARN or higher. While this is fine when using PoorMans, it seems that this isn't so great when using Log4j, as it is not readily apparent which class/jar/application this entry is for (quite confusing) Has there been any thought to making this something a little more specific (and therefore easy to explain to a sysadmin,etc)? One thought I had was, instead of making the name DEFAULT, changing it to org.apache.ojb.DEFAULT, etc. This way it is a lot more apparent what is occuring. Said another way: log4j.logger.org.apache.ojb.DEFAULT=WARN Instead of log4j.logger.DEFAULT=WARN Thoughts? Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem mapping inheritance hierarchy using joined tables for subclasses
Try refresh=false on the super reference. Does not work either. I tried refresh=false auto-retrieve=false auto-delete=false auto-update=false on the super reference. But I stell get the StackOverflowError when querying: broker.getIteratorByQuery(QueryFactory.newQuery(Address.class, new Criteria())); Peter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem mapping inheritance hierarchy using joined tables for subclasses
Hi Peter, You will need to add PersonAddress as an Extent of Address if you want PersonAddress to be in the seach domain of a query for class Address. Wally -Original Message- From: Peter Wieland [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 4:22 AM To: [EMAIL PROTECTED] Subject: Problem mapping inheritance hierarchy using joined tables for subclasses Hi, I try to map two classes Address and PersonAddress (a subclass of Address) using the joined table per sublcass strategy. This is my mapping: class-descriptor class=de.armax.sandbox.entity.Address table=Address field-descriptor autoincrement=true primarykey=true column=adrOID jdbc-type=VARCHAR name=oID/ field-descriptor column=adrAttribute jdbc-type=VARCHAR name=attribute/ ... /class-descriptor class-descriptor class=de.armax.sandbox.entity.PersonAddress table=PersonAddress field-descriptor autoincrement=true primarykey=true column=padOID jdbc-type=VARCHAR name=oID/ field-descriptor column=padAdditionalAttribute jdbc-type=VARCHAR name=additionalAttribute/ ... reference-descriptor auto-delete=true auto-update=true name=super class-ref=de.armax.sandbox.entity.Address foreignkey field-ref=oID/ /reference-descriptor /class-descriptor Storing new Addresses or Personaddresses works fine. But when I reload Adresses using broker.getIteratorByQuery(QueryFactory.newQuery(Address.class, new Criteria())); OJB seems not to care about what type these addresses have. All returned entities will be of type Address, even if they were stored as PersonAddress. Is this a bug or am I missing something here? Thanks for any help, Peter P.S.: I'm very sorry if this mail appears two times on the list. I send it from a bad account before and I'm not sure weather the ojb user list accepts this. - 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: Antwort: WHY OJB SPEND MORE AND MORE TIME TO STORE OBJECTS ?
it starts normally with a good speed and it is slowing down even if the database is empty or not. The time is always the same, about 40 min for the first sequence, 50 min for the second one etc ... the increasing is between 5 or 20 secondes for each storing sequence. A storing sequence stores about 800 objects . To be sure that the transaction is closed, i used a new PersistenceBroker for each storing sequence after commmit and close the old PersistenceBroker. i don't use proxy in my repository. -Message d'origine- De : Daniel Perry [mailto:[EMAIL PROTECTED] Envoyé : jeudi 4 décembre 2003 16:35 À : OJB Users List Objet : Re: Antwort: WHY OJB SPEND MORE AND MORE TIME TO STORE OBJECTS ? If you leave data in your database, and run the test again, does it start quickly or slowly? This should tell if the problem is to do with size of database, or to do with the code. any unproxied references in repository.xml? are you closing transactions properly? Daniel. - Original Message - From: ghielard [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Thursday, December 04, 2003 3:23 PM Subject: RE: Antwort: WHY OJB SPEND MORE AND MORE TIME TO STORE OBJECTS ? There is no index in my database, only primary and foreign keys. The phenomena still the same with an Oracle 8i database or a SQLServer 2000 database. I removed every attributes in my repository_user.xml using datatype CLOB (ora) or TEXT (SQLServer2000). I removed also every conversions in this file, and all reference descriptor. i thougth also it was my database but even if i don't delete all datas before running my application. it started with a good speed but it goes wrong. I removed all datas in my database before each storing sequence. The problem lasts. -Message d'origine- De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Envoye : jeudi 4 decembre 2003 15:50 A : OJB Users List Objet : Antwort: WHY OJB SPEND MORE AND MORE TIME TO STORE OBJECTS ? Hi, is it possible that you have an index on that table??? If you build a complex index every time you insert a set of data your index takes more time. cheers, Ralf ghielard [EMAIL PROTECTED] schrieb am 04.12.2003 15:23:45: Hi everybody, i have an important problem of performance. I'd tried every type of object cache (default,empty,perBroker), i instanciated a new PersistenceBroker instance each time i had a storing sequence in my java Code, or I kept the same for all storing sequence. I did it the same thing with MetadataManager. But it isn't better. OJB is slower every time is storing an object, about few seconds more longer. As i store thousand objects, at the end OJB is very slow. I think there is also a problem of memory. So i run the garabage collector after each storing sequence, and the clearCache() of the instance of PersistenceBroker. I use a transaction for each storing sequence. is there somebody who can help me? - 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]
hot to reload cached object?
Hello, Does anyone know how to refresh or reload an OJB cached object from the database? Is there any API or method that can help me do this? The situation is: I have an object in OJB cache, the object has been changed in the database. How can I say to OJB to reload my object? Thanks, Jair Jr
Re: hot to reload cached object?
Jair da Silva Ferreira Júnior wrote: Does anyone know how to refresh or reload an OJB cached object from the database? If you are using the PersistenceBroker API, the method to use is: broker.removeFromCache(object); See http://db.apache.org/ojb/api/org/apache/ojb/broker/PersistenceBroker.html#removeFromCache(java.lang.Object) (And then a new load, of course.) -- Martin Kalén Curalia AB Web: http://www.curalia.se Orrspelsvägen 2BMail: [EMAIL PROTECTED] SE-182 79 StocksundTel: +46-8-410 064 40 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JDO Bug (status please)
Well, since I am relatively stuck I peeked under the hood and took a stab at fixing this, based on the assumption that the analysis in the previous news group discussion of a missing state manger is the problem. After some thinking and lots of tracking back and forth through OJB persistence broker stuff and being generally confused I realized that the problem can't really be there... That part is also used by non-jdo implementations, and JDO specific stuff must reside in the o.a.o.jdori.sql classes. (duh, silly me) To do anything involving a state manager outside of that package would make ojb's persistence broker depend on the sun reference implementation of JDO. (I suspect that is unacceptable ;) ). I figure that we want to get the state manager set as early as possible because it may be needed by any class that handles the PC objects generated in the extent. So the first place I could find that one gets a handle on the results of an extent call was the constructor for OJBExtent. (please tell me if there is an earlier/better point to get to the results) I tried hacking the Constructor to look like this just to see if it fixed the problem: private Iterator iterator; private Class clazz; private PersistenceBroker broker; /** * Constructor for OjbExtent. */ public OjbExtent(Class pClazz, PersistenceBroker pBroker) { clazz = pClazz; System.out.println(pBroker.getClass()); Criteria selectExtent = null; Query q = QueryFactory.newQuery(clazz, selectExtent); broker = pBroker; RsIterator iter = (RsIterator) broker.getIteratorByQuery(q); // cycle through the extent and give the objects a statemanager ArrayList temp = new ArrayList(); while (iter.hasNext()) { Object o = iter.next(); Identity oid = new Identity(o, broker); PersistenceCapable pc; // theoretically this should never happen, but... if (o instanceof PersistenceCapable) { pc = (PersistenceCapable) o; } else { throw new RuntimeException(OJBExents are returning classes + that are not javax.jdo.spi.PersistenceCapapble??); } // FIXME: // Something of a Hack... The current implementation of JDO in OJB // guarantees that this cast works, but I don't think it is // in any way guaranteed not to change. PersistenceManagerImpl pm = (PersistenceManagerImpl) pc.jdoGetPersistenceManager(); StateManagerInternal sm = pm.findStateManager(pc); pc.jdoReplaceStateManager(sm); temp.add(pc); } iter.releaseDbResources(); this.iterator = temp.iterator(); } I never got to see if this had an effect though because it caused a very surprising NPE... pc.jdoGetPersistenceManager() is returning null. So not only do the objects not have a state manager, they don't have a persistence manager! Any clue how to address this?? I don't see any way to generate and supply a PersistenceManager for the object. I have a feeling that there is some other place I should be looking I feel like I don't yet understand how the sun RI gets diverted/configured into using the OJB backend That seems like another possible point of attack but I havn't found it yet. -Gus Mahler Thomas wrote: Hi Gus, Yes, I hope to get my hands on the open JDO issues very soon! Thomas -Original Message- From: Gus Heck [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 02, 2003 7:59 PM To: OJB Users List Subject: Re: JDO Bug (status please) I just got bit by this, despite the fact I had read this thread. I forgot and coded a method that asked if an object is persistant, and if not caused it to get a new ID and make itself persistant. I noticed something interesting though I edited and changed an object, then inadvertently created a copy of it because of the ID aquisition issue I just described, but when I did another extent to display a list of all items, both the old object and the inadvertently created object were identical right down to the ID. Logging intto mysql and doing a select shows that this is not what has happened in the DB. So it looks like the transient objects returned by the extent are still cached objects and may become modified without effecting the database. This means that data can appear to be written to the database but in fact is not! I hope you will have time to work on this very soon, I'm digging through the discussion referenced below and having trouble picking out what exactly the work around is... If you or someone else could post a direct workaround for getting a list of all objects of a class that are persistant it would help a lot. TIA, Gus Mahler Thomas wrote: - To
Oracle and Char[size]
All, I am working with Ojb RC4, Oracle 9i. I have a table with a PK with char[5] size. When I update with the value FR OJB tries to insert FR . And so it does an insert instead of an update when I still have a FR value in my PK. I didn't have this trouble with SQLServer..I quiet sure it should be possible to specify this somewhere .? No ? I didn't find anything in the archive on it. Thanks a lot in advance.
Re: Oracle and Char[size]
Emmanuel Dupont wrote: I have a table with a PK with char[5] size. When I update with the value FR OJB tries to insert FR . And so it does an insert instead of an update when I still have a FR value in my PK. You could: A) comply with char[5] and use the String FRwith OJB. B) define the PK as varchar[5] where FR would work just fine (not sure wether Ora9i would like varchar as PK though?). Same thing goes for Oracle and OJB Criteria. If you did critera.addEqualTo(pkAlias, 'FR') char[5] would give you a miss, but varchar[5] would give a hit. criteria.addEqualTo(pkAlias, 'FR ') is the only one that would match char[5] (or addLike(pkAlias, 'FR%') but that is ambigous). Cheers, Martin -- Martin Kalén Curalia AB Web: http://www.curalia.se Orrspelsvägen 2BMail: [EMAIL PROTECTED] SE-182 79 StocksundTel: +46-8-410 064 40 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE : Oracle and Char[size]
Thanks a lot Martin !! -Message d'origine- De : Martin Kalén [mailto:[EMAIL PROTECTED] Envoyé : jeudi 4 décembre 2003 19:08 À : OJB Users List Objet : Re: Oracle and Char[size] Emmanuel Dupont wrote: I have a table with a PK with char[5] size. When I update with the value FR OJB tries to insert FR . And so it does an insert instead of an update when I still have a FR value in my PK. You could: A) comply with char[5] and use the String FRwith OJB. B) define the PK as varchar[5] where FR would work just fine (not sure wether Ora9i would like varchar as PK though?). Same thing goes for Oracle and OJB Criteria. If you did critera.addEqualTo(pkAlias, 'FR') char[5] would give you a miss, but varchar[5] would give a hit. criteria.addEqualTo(pkAlias, 'FR ') is the only one that would match char[5] (or addLike(pkAlias, 'FR%') but that is ambigous). Cheers, Martin -- Martin Kalén Curalia AB Web: http://www.curalia.se Orrspelsvägen 2BMail: [EMAIL PROTECTED] SE-182 79 StocksundTel: +46-8-410 064 40 - 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: hot to reload cached object?
Hi, Jair da Silva Ferreira Júnior wrote: Hello, Does anyone know how to refresh or reload an OJB cached object from the database? Is there any API or method that can help me do this? The situation is: I have an object in OJB cache, the object has been changed in the database. How can I say to OJB to reload my object? If you know which object to reload, you can call broker.removeFromCache(Object obj) if you don't know which objects are changed, you have to clear the whole cache broker.clearCache() or you can use an ObjectCache implementation with object lifetime support (e.g. object was removed from cache after a defined period) (next upcoming release does support per class cache definition and support object timeout in cache implementation) regards, Armin Thanks, Jair Jr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
j2ee.jar not loaded
I added the j2ee.jar and other ojb jars in the WEB-INF/lib dir and got: INFO: Initializing, config='org.apache.webapp.admin.ApplicationResources', retur nNull=true WebappClassLoader: validateJarFile(C:\jakarta-tomcat-4.1.27\webapps\storefront\W EB-INF\lib\j2ee.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offe nding class: javax/servlet/Servlet.class I am using tomcat 4.1.27. Is there someplace else to put it. Do I have the right version of j2ee. I downloaded j2sdkee1.3 and j2sdkee1.4 and neither worked. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem mapping inheritance hierarchy using joined tables for subclasses
hi peter, you could try to define an extent in classdescriptor of Address pointing to PersonAddress. BUT the problem is that extents and super-references do not go together well. you may end up with instances of the wrong class. the support for mapping one class to multiple tables needs improvement ;) jakob Peter Wieland wrote: Hi, I try to map two classes Address and PersonAddress (a subclass of Address) using the joined table per sublcass strategy. This is my mapping: class-descriptor class=de.armax.sandbox.entity.Address table=Address field-descriptor autoincrement=true primarykey=true column=adrOID jdbc-type=VARCHAR name=oID/ field-descriptor column=adrAttribute jdbc-type=VARCHAR name=attribute/ ... /class-descriptor class-descriptor class=de.armax.sandbox.entity.PersonAddress table=PersonAddress field-descriptor autoincrement=true primarykey=true column=padOID jdbc-type=VARCHAR name=oID/ field-descriptor column=padAdditionalAttribute jdbc-type=VARCHAR name=additionalAttribute/ ... reference-descriptor auto-delete=true auto-update=true name=super class-ref=de.armax.sandbox.entity.Address foreignkey field-ref=oID/ /reference-descriptor /class-descriptor Storing new Addresses or Personaddresses works fine. But when I reload Adresses using broker.getIteratorByQuery(QueryFactory.newQuery(Address.class, new Criteria())); OJB seems not to care about what type these addresses have. All returned entities will be of type Address, even if they were stored as PersonAddress. Is this a bug or am I missing something here? Thanks for any help, Peter P.S.: I'm very sorry if this mail appears two times on the list. I send it from a bad account before and I'm not sure weather the ojb user list accepts this. - 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: j2ee.jar not loaded
Hi, you don't need a j2ee.jar in the lib directory of your web app. The necessary classes for a web or full j2ee app are already present in the container's classpath and jars. Jewett, Diane C wrote: I added the j2ee.jar and other ojb jars in the WEB-INF/lib dir and got: INFO: Initializing, config='org.apache.webapp.admin.ApplicationResources', retur nNull=true WebappClassLoader: validateJarFile(C:\jakarta-tomcat-4.1.27\webapps\storefront\W EB-INF\lib\j2ee.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offe nding class: javax/servlet/Servlet.class I am using tomcat 4.1.27. Is there someplace else to put it. Do I have the right version of j2ee. I downloaded j2sdkee1.3 and j2sdkee1.4 and neither worked. - 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: Problem mapping inheritance hierarchy using joined tables for subclasses
hi peter, you could try to define an extent in classdescriptor of Address pointing to PersonAddress. BUT the problem is that extents and super-references do not go together well. you may end up with instances of the wrong class. the support for mapping one class to multiple tables needs improvement ;) jakob Hi, well, I would have prefered another answer but at least it is a clear answer. Are there any plans to spent the work needed on the joined-table per subclass mapping in the near future? Peter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: hot to reload cached object?
Hi Martin, Thank you for your fast reply. Removing an object from cache using broker.removeFromCache(o) and making a new load of the object creates a new JVM object that points to the same database object, right? If this is true, my problem remains because other objects would still reference the old JVM object. Is there a way to reload the object data without having to create a new JVM object? Let me explain with some code what I want to do: transaction.begin(); Customer c=new Customer(); c.setName(customer); transaction.lock(c,transaction.WRITE); //persist the new customer transaction.commit(); //after some time someone changes Customer's name to new customer directly in the database transaction.begin(); Customer c=loadCustomer(); // loads the customer persisted before from cache Order o=new Order(); o.setCustomer(c); cache.reloadObject(c); //reload object data from database boolean referenceOk=(c==o.getCustomer()); // I wanted referenceOk to be true boolean dataReloaded=new customer.equals(c.getName()); //I wanted dataReloaded to be true transaction.commit(); Thank you very much for your help. Sincerely, Jair Jr - Original Message - From: Martin Kalén [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Thursday, December 04, 2003 2:08 PM Subject: Re: hot to reload cached object? Jair da Silva Ferreira Júnior wrote: Does anyone know how to refresh or reload an OJB cached object from the database? If you are using the PersistenceBroker API, the method to use is: broker.removeFromCache(object); See http://db.apache.org/ojb/api/org/apache/ojb/broker/PersistenceBroker.html#re moveFromCache(java.lang.Object) (And then a new load, of course.) -- Martin Kalén Curalia AB Web: http://www.curalia.se Orrspelsvägen 2BMail: [EMAIL PROTECTED] SE-182 79 StocksundTel: +46-8-410 064 40 - 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]