Re: Newbie question on field access error
Hi Andy, Whitaker, Andy wrote: Hello, I'm new to OJB and I'm maintaining an app that uses OJB 1.0.0 and I'm receiving an IllegalAccess error setting a field that is used by OJB for locking. The database is MySQL 4.0.21 on Windows. The runtime error being thrown by Tomcat is: org.apache.ojb.broker.PersistenceBrokerException: org.apache.ojb.broker.metada .MetadataException: IllegalAccess error setting field:lockingNumber in object: u.iu.uis.ccm.ccl.data.ApplicationConstants at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuer QueryReferenceBroker.java:240) hmm, could be a problem of metadata setting. 'lockingNumber' has type Long, in your repository (xdoclet tags) you set JDBC type of INTEGER. But Long will normally be mapped to BIGINT/DECIMAL http://db.apache.org/ojb/docu/guides/jdbc-types.html so you should change the jdbc type to BIGINT/DECIMAL (or similar type supported by your DB) regards, Armin The section of code that this refers to is: /** * @ojb.field column="CCL_CNST_NM" *primarykey="true" *length="100" */ private String appConstantName; // attributes /** * @ojb.field column="CCL_CNST_VAL_TXT" *length="255" */ private String appConstantValue; // used by locking system /** * @ojb.field column="locking_nbr" *locking="true" *jdbc-type="INTEGER" */ private Long lockingNumber; public Long getLockingNumber() { return lockingNumber; } public void setLockingNumber(Long lockingNumber) { this.lockingNumber = lockingNumber; } Does anybody know why I would get this error? Thank you for any help. -Andy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Newbie question on field access error
Hello Andy, > -Original Message- > From: Whitaker, Andy [mailto:[EMAIL PROTECTED] > Sent: Thursday, October 14, 2004 9:48 PM > To: [EMAIL PROTECTED] > Subject: Newbie question on field access error > > > Hello, > I'm new to OJB and I'm maintaining an app that uses OJB 1.0.0 > and I'm receiving an IllegalAccess error setting a field that > is used by OJB for locking. > > The database is MySQL 4.0.21 on Windows. > > The runtime error being thrown by Tomcat is: > > org.apache.ojb.broker.PersistenceBrokerException: > org.apache.ojb.broker.metada > .MetadataException: IllegalAccess error setting > field:lockingNumber in object: > u.iu.uis.ccm.ccl.data.ApplicationConstants what is your value for key "PersistentFieldClass" in OJB.properties? It might help to change it in order to use the getter-Method to access that field lockingNumber, or to make that field public (probably you won't), or to use PersistentFieldDirectAccessImplNew or the like to enable OJB to access that private field directly. HTH, Olli - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie Question : OTM or ODMG
Hi Oleg, try this [OTM] Massive performance decrease between Feb and Apr version http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgNo=6875 regards, Armin Oleg Nitz wrote: On Wednesday 14 April 2004 15:51, Brian McCallister wrote: Have I missed something? Are there any new performance tests? Armin emailed the -dev list a few days back =) What was the subject? Still can't find. - 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: Newbie Question : OTM or ODMG
On Wednesday 14 April 2004 15:51, Brian McCallister wrote: > > Have I missed something? Are there any new performance tests? > Armin emailed the -dev list a few days back =) What was the subject? Still can't find. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie Question : OTM or ODMG
Ah, I missed the checkin message on that! Thank you! -Brian On Apr 13, 2004, at 5:20 PM, Oleg Nitz wrote: On Tuesday 13 April 2004 15:17, Brian McCallister wrote: Huh, the ODMG slower thing is interesting as Armin just reemed us all out for letting the OTM get so much slower than ODMG ;-) Have I missed something? Are there any new performance tests? Armin emailed the -dev list a few days back =) When I tested last time, OTM was somewhat faster. Of course, when you use OTM PB-style Criteria/Queries instead of ODMG-style OQLQueries, the difference would be more noticeable. But don't forget that OTM provides true ACID transactions, pessimistic and optimistic locking strategies (automatic upgrading of read lock to write lock for modified objects) and some other nice features like automatic storing of object modifications (for modified objects only), automatic creation/deletion of otm-dependent objects, long transactions support. So I guess OTM may be slower in some tests, especially when you run them against in-memory database like HSQL. but it is a little bit less than mature at the moment. It is definately in the unstable category for 1.0. Completely agree. Oleg is in the process of doing a major factoring job on parts of it to clean it up and fix a couple bugs (otm-dependent proxied collections not detecting deletes unless an explicit write lock is obtained on the parent is a particularly unpleasant one for me). The refactoring is now finished, and the bug that you mentioned is now fixed, at least according to my tests. Please re-run your tests. Many thanks to you and to all who try OTM, test OTM and report bugs! ;-) Regards, Oleg - 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: Newbie Question : OTM or ODMG
On Tuesday 13 April 2004 15:17, Brian McCallister wrote: > Huh, the ODMG slower thing is interesting as Armin just reemed us all > out for letting the OTM get so much slower than ODMG ;-) Have I missed something? Are there any new performance tests? When I tested last time, OTM was somewhat faster. Of course, when you use OTM PB-style Criteria/Queries instead of ODMG-style OQLQueries, the difference would be more noticeable. But don't forget that OTM provides true ACID transactions, pessimistic and optimistic locking strategies (automatic upgrading of read lock to write lock for modified objects) and some other nice features like automatic storing of object modifications (for modified objects only), automatic creation/deletion of otm-dependent objects, long transactions support. So I guess OTM may be slower in some tests, especially when you run them against in-memory database like HSQL. > but it is a little bit less than mature at the moment. > It is definately in the unstable category for 1.0. Completely agree. > Oleg is in the process of doing a major factoring job on parts of it to > clean it up and fix a couple bugs (otm-dependent proxied collections > not detecting deletes unless an explicit write lock is obtained on the > parent is a particularly unpleasant one for me). The refactoring is now finished, and the bug that you mentioned is now fixed, at least according to my tests. Please re-run your tests. Many thanks to you and to all who try OTM, test OTM and report bugs! ;-) Regards, Oleg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Newbie Question : OTM or ODMG
Sorry i was being a bit dense early morning after a very long weekend! My app has a huge amount of db activity, and 99.9% of it doesnt require locking (concurrent actions on the same objects will never happen as users only share read-only objects) So i mainly use the Persistance Broker api directly. (that was what i was refering to with regards to speed) And a little OTM when i need locking for administrative tasks. Daniel. -Original Message- From: Brian McCallister [mailto:[EMAIL PROTECTED] Sent: 13 April 2004 13:17 To: OJB Users List Subject: Re: Newbie Question : OTM or ODMG Huh, the ODMG slower thing is interesting as Armin just reemed us all out for letting the OTM get so much slower than ODMG ;-) Right now there are a couple hidden nasties in the OTM -- I like the OTM a lot (if just so that I can do a query by identity without casting to a TransactionImpl) but it is a little bit less than mature at the moment. It is definately in the unstable category for 1.0. Oleg is in the process of doing a major factoring job on parts of it to clean it up and fix a couple bugs (otm-dependent proxied collections not detecting deletes unless an explicit write lock is obtained on the parent is a particularly unpleasant one for me). I will personally still be using OTM for my development, but we just switched from OTM to ODMG for major app in development where I work because of the relative maturity of the chunks of code. I hope to switch back to OTM in the not-too-distant future (or to JDO as it is shaping up to be a very thin wrapper around the OTM, and it isn't really a bad API from the client side, don't get me started on javax.jdo.spi though ;-) Providing a facade to swap between ODMG and OTM is pretty straightforward as the OTM can handle OQL style queries. -Brian On Apr 13, 2004, at 6:46 AM, Daniel Perry wrote: > From my experience of using both (i ended up doing an ODMG -> OTM > conversion!): > > Note that i dont any of the more complicated stuff - just storing > object > trees, collections, etc, and querying the database. Also i dont use > locking > atall (one thing odmg does better i believe). > > Go with OTM. > > ODMG uses ODMG queries (sql like queries for selecting objects). > OTM use a criteria classes for querying. > > I find OTM to be simpler, but more code intensive. > > ODMG is slower - Ditching ODMG and moving to OTM speeded up our app by > about > 5x! > > Doing complex (nested to several degrees "a.b.c...") in OTM works - i > never > got it working in ODMG. > > Daniel. > > > -Original Message- > From: Jean-Francois Beaulac [mailto:[EMAIL PROTECTED] > Sent: 07 April 2004 17:03 > To: [EMAIL PROTECTED] > Subject: Newbie Question : OTM or ODMG > > > Hi , i'm a real OJB newbie and I wonder which API should I use, i > searched the mailing list and read the entire documentation on the > website (i didnt read the entire JavaDoc of course) but i wasn't able > to > find a great comparison between the two APIs. > > It would be very usefull to me if somebody could post the main > differences between both APIs > > Thanks > Jean-Francois Beaulac > trainee programmer @ www.beetext.com > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - 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: Newbie Question : OTM or ODMG
Huh, the ODMG slower thing is interesting as Armin just reemed us all out for letting the OTM get so much slower than ODMG ;-) Right now there are a couple hidden nasties in the OTM -- I like the OTM a lot (if just so that I can do a query by identity without casting to a TransactionImpl) but it is a little bit less than mature at the moment. It is definately in the unstable category for 1.0. Oleg is in the process of doing a major factoring job on parts of it to clean it up and fix a couple bugs (otm-dependent proxied collections not detecting deletes unless an explicit write lock is obtained on the parent is a particularly unpleasant one for me). I will personally still be using OTM for my development, but we just switched from OTM to ODMG for major app in development where I work because of the relative maturity of the chunks of code. I hope to switch back to OTM in the not-too-distant future (or to JDO as it is shaping up to be a very thin wrapper around the OTM, and it isn't really a bad API from the client side, don't get me started on javax.jdo.spi though ;-) Providing a facade to swap between ODMG and OTM is pretty straightforward as the OTM can handle OQL style queries. -Brian On Apr 13, 2004, at 6:46 AM, Daniel Perry wrote: From my experience of using both (i ended up doing an ODMG -> OTM conversion!): Note that i dont any of the more complicated stuff - just storing object trees, collections, etc, and querying the database. Also i dont use locking atall (one thing odmg does better i believe). Go with OTM. ODMG uses ODMG queries (sql like queries for selecting objects). OTM use a criteria classes for querying. I find OTM to be simpler, but more code intensive. ODMG is slower - Ditching ODMG and moving to OTM speeded up our app by about 5x! Doing complex (nested to several degrees "a.b.c...") in OTM works - i never got it working in ODMG. Daniel. -Original Message- From: Jean-Francois Beaulac [mailto:[EMAIL PROTECTED] Sent: 07 April 2004 17:03 To: [EMAIL PROTECTED] Subject: Newbie Question : OTM or ODMG Hi , i'm a real OJB newbie and I wonder which API should I use, i searched the mailing list and read the entire documentation on the website (i didnt read the entire JavaDoc of course) but i wasn't able to find a great comparison between the two APIs. It would be very usefull to me if somebody could post the main differences between both APIs Thanks Jean-Francois Beaulac trainee programmer @ www.beetext.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Newbie Question : OTM or ODMG
>From my experience of using both (i ended up doing an ODMG -> OTM conversion!): Note that i dont any of the more complicated stuff - just storing object trees, collections, etc, and querying the database. Also i dont use locking atall (one thing odmg does better i believe). Go with OTM. ODMG uses ODMG queries (sql like queries for selecting objects). OTM use a criteria classes for querying. I find OTM to be simpler, but more code intensive. ODMG is slower - Ditching ODMG and moving to OTM speeded up our app by about 5x! Doing complex (nested to several degrees "a.b.c...") in OTM works - i never got it working in ODMG. Daniel. -Original Message- From: Jean-Francois Beaulac [mailto:[EMAIL PROTECTED] Sent: 07 April 2004 17:03 To: [EMAIL PROTECTED] Subject: Newbie Question : OTM or ODMG Hi , i'm a real OJB newbie and I wonder which API should I use, i searched the mailing list and read the entire documentation on the website (i didnt read the entire JavaDoc of course) but i wasn't able to find a great comparison between the two APIs. It would be very usefull to me if somebody could post the main differences between both APIs Thanks Jean-Francois Beaulac trainee programmer @ www.beetext.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Newbie Question
Hi Gavin, The ojb-blank target is a template for your own projects. To simply build ojb use the target "release". Thomas > -Original Message- > From: Gavin Paul Selvaratnam [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 03, 2004 7:46 AM > To: '[EMAIL PROTECTED]' > Subject: Newbie Question > > > Hi I just Installed the "ojb-1.0.rc5". Now I am trying to run "ant > ojb-blank", but I get the following error. > > [javac] > ^ > [javac] > E:\gavin\java\db-ojb-1.0.rc5\target\src\org\apache\ojb\tools\m > apping\reverse > db2\ojbmetat > reemodel\OjbMetaClassDescriptorNode.java:101: cannot resolve symbol > [javac] symbol : constructor OjbMetaExtentClassNode > (org.apache.ojb.broker.metadata.Descriptor > Repository,org.apache.ojb.tools.mapping.reversedb2.ojbmetatree > model.OjbMetaD > ataTreeModel,org.apache. > ojb.tools.mapping.reversedb2.ojbmetatreemodel.OjbMetaClassDesc > riptorNode,jav > a.lang.String) > [javac] location: class > org.apache.ojb.tools.mapping.reversedb2.ojbmetatreemodel.OjbMe > taExtentCl > assNode > [javac] newChildren.add(new > OjbMetaExtentClassNode( > [javac] ^ > [javac] 1 error > > > > Pluss I also get about seven deprication warnings. Please > help me on how to > procede further. > > Thanks, > Gavin > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: newbie question
You should generally let the database set the OID for an object. If you load the object, the OID is set and therefore it will do an UPDATE when storing. If it's new, the OID is empty and therefore will do an INSERT. If you provide an OID for a new object (for example, get a value manually from a sequence generator) then you still get the correct behavior. It's only when you do something "atypical" that you should need to use the ObjectModification parameter. -Original Message- From: Ron Gallagher [mailto:[EMAIL PROTECTED] Sent: Monday, August 04, 2003 4:53 PM To: OJB Users List Subject: Re: newbie question Anthony -- There are two versions of the store method provided by the PersistenceBroker store(Object) store(Object,ObjectModification) It appears that you're using the first version. In this case, ojb will first do a select against your db to see if the record exists. If it does, then ojb will do an update. If it doesn't, then ojb will do an insert. To force ojb to do an insert or an update, use the second version of the store method and pass either org.apache.ojb.broker.util.ObjectModificationDefaultImpl#INSERT or org.apache.ojb.broker.util.ObjectModificationDefaultImpl#UPDATE. Ron Gallagher Atlanta, GA [EMAIL PROTECTED] > > From: "Anthony E. Carlos" <[EMAIL PROTECTED]> > Date: 2003/08/04 Mon PM 04:47:19 EDT > To: [EMAIL PROTECTED] > Subject: newbie question > > Hello all, > > I'm using the PB API and can store a simple object to a table. Even > though table has a primary key constraint on the id column, if I try to > store a different object with the same id, there is no primary key > constraint violation. In fact, OJB _UPDATES_ the existing matching row > in the database, instead of trying to INSERT a new row (which would > trigger the integrity constraint). I'm using Oracle 8i. > > My question, therefore, is: > > Do I have to perform my own referential integrity checks when I use > OJB? Am I missing a basic idea behind OJB (like the lack of a need for > referential integrity)? > > I've searched the mail archives and the online docs, but can't find > the > answer to these simple questions. > > Thanks, > > Anthony Carlos > > > - > 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: newbie question
Anthony -- There are two versions of the store method provided by the PersistenceBroker store(Object) store(Object,ObjectModification) It appears that you're using the first version. In this case, ojb will first do a select against your db to see if the record exists. If it does, then ojb will do an update. If it doesn't, then ojb will do an insert. To force ojb to do an insert or an update, use the second version of the store method and pass either org.apache.ojb.broker.util.ObjectModificationDefaultImpl#INSERT or org.apache.ojb.broker.util.ObjectModificationDefaultImpl#UPDATE. Ron Gallagher Atlanta, GA [EMAIL PROTECTED] > > From: "Anthony E. Carlos" <[EMAIL PROTECTED]> > Date: 2003/08/04 Mon PM 04:47:19 EDT > To: [EMAIL PROTECTED] > Subject: newbie question > > Hello all, > > I'm using the PB API and can store a simple object to a table. Even > though table has a primary key constraint on the id column, if I try to > store a different object with the same id, there is no primary key > constraint violation. In fact, OJB _UPDATES_ the existing matching row > in the database, instead of trying to INSERT a new row (which would > trigger the integrity constraint). I'm using Oracle 8i. > > My question, therefore, is: > > Do I have to perform my own referential integrity checks when I use > OJB? Am I missing a basic idea behind OJB (like the lack of a need for > referential integrity)? > > I've searched the mail archives and the online docs, but can't find the > answer to these simple questions. > > Thanks, > > Anthony Carlos > > > - > 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: Newbie question - Unable to open database
- Original Message - From: "Christopher C Worley" <[EMAIL PROTECTED]> To: "OJB Users List" <[EMAIL PROTECTED]> Sent: Thursday, February 27, 2003 4:10 PM Subject: Re: Newbie question - Unable to open database > Joshua, > > Add jcd-alias attribute to jdbc-connection, set it equal to "default". > Then if your repositlry.xml is in WEB-INF/classes, you should be able > to use: > > db.open("default", Database.OPEN_READ_WRITE); to bypass a known bug in 0.9.9 better use db.open("default#user#password", Database.OPEN_READ_WRITE); regards, Armin > > -chris wroley > > >I am using OJB version 0.9.9. When executing the following line: > > > > db.open("/WEB-INF/classes/repository.xml", > >Database.OPEN_READ_WRITE); > > > >I receive the following error when attempting to open a database > > > > java.lang.NullPointerException > > java.lang.NullPointerException > >at > >org.apache.ojb.broker.util.BrokerHelper.extractAllTokens(Unknown Source) > > at org.apache.ojb.odmg.DatabaseImpl.open(Unknown Source) > > > > > >I am using Tomcat, DBCP and of course OJB. I have declared a DBCP > >datasource in JNDI as "jdbc/myDB". I am able to successfully connect to > >this datasource in a jsp. I have placed the following files in my > >"/WEB-INF/classes" directory: > > > > repository.dtd > > repository.xml > > repository_database.xml > > repository_internal.xml > > repository_junit.xml > > repository_user.xml > > repository_ejb.xml > > OJB.properties > > > >In my repository_database.xml file, I have defined the following: > > > platform="MsSQLServer" > > default-connection="true" > > jdbc-level="2.0" > > jndi-datasource-name="java:/comp/env/jdbc/myDB" /> > > > >In my OJB.properties file, I have tried each of the following without any > >luck: > > > >ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFact oryPo > >oledImpl > > > >ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFact oryNo > >tPooledImpl > > > >ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFact oryMa > >nagedImpl > > > >ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFact oryDB > >CPImpl > > > >Because my jndi database connection is a datasource, I thought I should have > >all commented out except ConnectionFactoryManagedImpl. > > > >Any ideas? > > > >Regards, > > > >Joshua > > > > > >This communication, including attachments, is for the exclusive use of > >addressee and may contain proprietary, confidential or privileged > >information. If you are not the intended recipient, any use, copying, > >disclosure, dissemination or distribution is strictly prohibited. If > >you are not the intended recipient, please notify the sender > >immediately by return email and delete this communication and destroy all copies. > > > > > >- > >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: Newbie question - Unable to open database
Joshua, Add jcd-alias attribute to jdbc-connection, set it equal to "default". Then if your repositlry.xml is in WEB-INF/classes, you should be able to use: db.open("default", Database.OPEN_READ_WRITE); -chris wroley I am using OJB version 0.9.9. When executing the following line: db.open("/WEB-INF/classes/repository.xml", Database.OPEN_READ_WRITE); I receive the following error when attempting to open a database java.lang.NullPointerException java.lang.NullPointerException at org.apache.ojb.broker.util.BrokerHelper.extractAllTokens(Unknown Source) at org.apache.ojb.odmg.DatabaseImpl.open(Unknown Source) I am using Tomcat, DBCP and of course OJB. I have declared a DBCP datasource in JNDI as "jdbc/myDB". I am able to successfully connect to this datasource in a jsp. I have placed the following files in my "/WEB-INF/classes" directory: repository.dtd repository.xml repository_database.xml repository_internal.xml repository_junit.xml repository_user.xml repository_ejb.xml OJB.properties In my repository_database.xml file, I have defined the following: In my OJB.properties file, I have tried each of the following without any luck: ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryPo oledImpl ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryNo tPooledImpl ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryMa nagedImpl ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryDB CPImpl Because my jndi database connection is a datasource, I thought I should have all commented out except ConnectionFactoryManagedImpl. Any ideas? Regards, Joshua This communication, including attachments, is for the exclusive use of addressee and may contain proprietary, confidential or privileged information. If you are not the intended recipient, any use, copying, disclosure, dissemination or distribution is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return email and delete this communication and destroy all copies. - 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: Newbie question - Unable to open database
Joshua, Add jcd-alias attribute to jdbc-connection, set it equal to "default". Then if your repositlry.xml is in WEB-INF/classes, you should be able to use: db.open("default", Database.OPEN_READ_WRITE); -chris wroley I am using OJB version 0.9.9. When executing the following line: db.open("/WEB-INF/classes/repository.xml", Database.OPEN_READ_WRITE); I receive the following error when attempting to open a database java.lang.NullPointerException java.lang.NullPointerException at org.apache.ojb.broker.util.BrokerHelper.extractAllTokens(Unknown Source) at org.apache.ojb.odmg.DatabaseImpl.open(Unknown Source) I am using Tomcat, DBCP and of course OJB. I have declared a DBCP datasource in JNDI as "jdbc/myDB". I am able to successfully connect to this datasource in a jsp. I have placed the following files in my "/WEB-INF/classes" directory: repository.dtd repository.xml repository_database.xml repository_internal.xml repository_junit.xml repository_user.xml repository_ejb.xml OJB.properties In my repository_database.xml file, I have defined the following: In my OJB.properties file, I have tried each of the following without any luck: ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryPo oledImpl ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryNo tPooledImpl ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryMa nagedImpl ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryDB CPImpl Because my jndi database connection is a datasource, I thought I should have all commented out except ConnectionFactoryManagedImpl. Any ideas? Regards, Joshua This communication, including attachments, is for the exclusive use of addressee and may contain proprietary, confidential or privileged information. If you are not the intended recipient, any use, copying, disclosure, dissemination or distribution is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return email and delete this communication and destroy all copies. - 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: newbie question: OJB cannot treat subclass as superclass?
Thank you. It seems to be enough, I will try it. > Hi shivaken, > > did you read the tutorial on mapping inheritance hierarchies with OJB > already? > http://db.apache.org/ojb/tutorial3.html#mapping%20inheritance%20hierarchies > > and in particular: > > http://db.apache.org/ojb/tutorial3.html#mapping%20all%20classes%20on%20the% >2 0same%20table > > cheers, > Thomas > > > -Original Message- > > From: shivaken [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, February 20, 2003 10:33 AM > > To: OJB Users List > > Subject: newbie question: OJB cannot treat subclass as superclass? > > > > > > I'm using polymorphism around my business classes in order to add new > > subclasses dose not have unique attribute. > > So, I want to add persistence them with OJB > > and want to store in the same table. But, it seems to be difficult. > > # All subclasses don't have own field. > > > > I created a abstract Call class, and LocalCall class as a > > subclass of it. > > > > Then broker.store(localCall) causes > > org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException: > > com.mydomain.LocalCall not found in OJB Repository > > > > I know persistent classes has to have default (no parameter) > > constructor. > > # They seem to be constructed with that. Then, abstract class > > cannot be used > > # with OJB. > > > > Are there any good ways? > > > > -- shivaken > > > > > > - > > 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: newbie question: OJB cannot treat subclass as superclass?
Hi shivaken, did you read the tutorial on mapping inheritance hierarchies with OJB already? http://db.apache.org/ojb/tutorial3.html#mapping%20inheritance%20hierarchies and in particular: http://db.apache.org/ojb/tutorial3.html#mapping%20all%20classes%20on%20the%2 0same%20table cheers, Thomas > -Original Message- > From: shivaken [mailto:[EMAIL PROTECTED]] > Sent: Thursday, February 20, 2003 10:33 AM > To: OJB Users List > Subject: newbie question: OJB cannot treat subclass as superclass? > > > I'm using polymorphism around my business classes in order to add new > subclasses dose not have unique attribute. > So, I want to add persistence them with OJB > and want to store in the same table. But, it seems to be difficult. > # All subclasses don't have own field. > > I created a abstract Call class, and LocalCall class as a > subclass of it. > > Then broker.store(localCall) causes > org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException: > com.mydomain.LocalCall not found in OJB Repository > > I know persistent classes has to have default (no parameter) > constructor. > # They seem to be constructed with that. Then, abstract class > cannot be used > # with OJB. > > Are there any good ways? > > -- shivaken > > > - > 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: Newbie question, and request for any step by step isolated example
Hello, > -Original Message- > From: Ajitesh Das [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 05, 2003 6:12 AM > To: OJB Users List; [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: RE: Newbie question, and request for any step by > step isolated > example > > > Hi: > Thanks a lot for detailing the steps required to make a > *isolated* example. > Just a quick clarification: > In step 4: > > Copy tutorial1 into a separate directory tree, > > copy the runtime configuration files described above > > >Try to run your copy of the tutorial1 with some-new-directory/ojb > >location, with all /lib/*.jar stuff in the classpath. > > >When you have reached the point where hsql tries to > >open the database, and empty database will be created > > How did you do that? Did you copy build.xml to your location As I pointed out, I did not do it the way I described it. I tried to imaging what could have worked ... I see two possibilities for step 4: 1. copy the build.xml and modify it to use the absolute paths to your actual OJB installation (rather then the relative ones.) As this involves understanding that script, this is not a good idea 2. use an IDE (or your own ant file or the like). That is what I did. > and modified the the targets to compile to copied > source and invoke to generate sqls.Can you please explain > this in little details. Here's what I actually did: I copied (nearly) the complete installation tree, especially the build-scripts, and the src and target subdirectories. Then I threw away step-by-step the non-tutorial and non-junit stuff, i.e., the OJB sourcen themselves. I used an IDE to compile my own copy of the tutorial, so I did not have to modify the build.xml. I tried for a while to separate the torque-xml stuff, which is needed to prepare the database but I did not succeed, in particular because I tried to use sybase, which is not perfectly supported. In the end, I took the generated sql scripts as a starting point and modified them according to my needs. I am afraid I cannot give you more detailed advice. I bet you realize that what I did was not systematic either. Meanwhile I have managed to integrate torque into my build-process. Some (not self-contained) snippets from my build.xml below. But, again, I cannot offer you something isolated that actually works, sorry. -- > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie question, and request for any step by step isolated example
Thanks for kind and informative replies, I'll now try these stuff, and hopefully make some progress. Mehmet - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Newbie question, and request for any step by step isolated example
Hi: Thanks a lot for detailing the steps required to make a *isolated* example. Just a quick clarification: In step 4: > Copy tutorial1 into a separate directory tree, > copy the runtime configuration files described above >Try to run your copy of the tutorial1 with some-new-directory/ojb >location, with all /lib/*.jar stuff in the classpath. >When you have reached the point where hsql tries to >open the database, and empty database will be created How did you do that? Did you copy build.xml to your location and modified the the targets to compile to copied source and invoke to generate sqls.Can you please explain this in little details. thanks in advance -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tue 2/4/2003 6:53 AM To: [EMAIL PROTECTED] Cc: Subject: RE: Newbie question, and request for any step by step isolated example Hello, I started with OJB approx. 2 months ago. > -Original Message- > From: Mehmet D. AKIN [mailto:[EMAIL PROTECTED]] > > Is there any step by step isolated example for basic usage of OJB? I > found the tutorials a little complex. I'm not meaning the > java codes but > the whole configuration steps are really messed up in my > mind. There are > OJB code, ant tasks, torque tasks, source code, tutorial > code, several > XML documents, What steps should I do to prepare a single simple > *isolated* example? I made the same experience. The out-of-the-box experience of OJB is indeed frustrating. An *isolated* example is exactly what we need, in particular because the error messages of OJB are not really helpful is case of typos or the like. here is what I did: I copied the hole OJB installation directory, and then modified the build-process step-by-step in order to get a relatively isolated example, just to see something running that I could modify. Unfortunately, the example has grown by now, so sharing it with you would not be of any use. If you do not what to do it the same way, you might succeed as follows: 1. run the test suite out-of-the-box (see http://jakarta.apache.org/ojb/quickstart.html) 2. inspect the directory /target/test. Its subdirectory ojb is the current working directory during the tests. Here you find two important runtime configuration files: target/test/ojb/repository.xml target/test/ojb/OJB.properties Do not exchange the latter with target/test/OJB.properties, that is the database! The first one includes the other repository_*.xml files by xml means. 3. inspect the directory /target/srctest/org/apache/ojb/tutorial1 There you find the sources for the tutorial1 4. Copy tutorial1 into a separate directory tree, copy the runtime configuration files described above into some-new-directory/ojb. Get rid of the some-new-directory/ojb/repository_ejb.xml, and maybe the some-new-directory/ojb/repository_junit.xml by removing their includes from some-new-directory/ojb/repository.xml Try to run your copy of the tutorial1 with some-new-directory/ojb location, with all /lib/*.jar stuff in the classpath. When you have reached the point where hsql tries to open the database, and empty database will be created (two files named some-new-directory/OJB.properties and some-new-directory/OJB.script) The required tables will be missing and a corresponding error exception will be thrown. You find scripts that generate the tables in /target/src/sql/*-schema.sql Use one of the hsqdb tools (see below) to run them. 5. A helpful tool is the Hsqldb gui tool. You can use it to administrate and inspect hsql (file-) databases. To start it, make sure the /lib/hsqldb.jar in your classpath and run java org.hsqldb.util.DatabaseManager -url jdbc:hsqldb:OJB with some-new-directory as current working directory. (OJB is the database name here.) Good luck! Olli - To uns
RE: Newbie question, and request for any step by step isolated example
Hello, I started with OJB approx. 2 months ago. > -Original Message- > From: Mehmet D. AKIN [mailto:[EMAIL PROTECTED]] > > Is there any step by step isolated example for basic usage of OJB? I > found the tutorials a little complex. I'm not meaning the > java codes but > the whole configuration steps are really messed up in my > mind. There are > OJB code, ant tasks, torque tasks, source code, tutorial > code, several > XML documents, What steps should I do to prepare a single simple > *isolated* example? I made the same experience. The out-of-the-box experience of OJB is indeed frustrating. An *isolated* example is exactly what we need, in particular because the error messages of OJB are not really helpful is case of typos or the like. here is what I did: I copied the hole OJB installation directory, and then modified the build-process step-by-step in order to get a relatively isolated example, just to see something running that I could modify. Unfortunately, the example has grown by now, so sharing it with you would not be of any use. If you do not what to do it the same way, you might succeed as follows: 1. run the test suite out-of-the-box (see http://jakarta.apache.org/ojb/quickstart.html) 2. inspect the directory /target/test. Its subdirectory ojb is the current working directory during the tests. Here you find two important runtime configuration files: target/test/ojb/repository.xml target/test/ojb/OJB.properties Do not exchange the latter with target/test/OJB.properties, that is the database! The first one includes the other repository_*.xml files by xml means. 3. inspect the directory /target/srctest/org/apache/ojb/tutorial1 There you find the sources for the tutorial1 4. Copy tutorial1 into a separate directory tree, copy the runtime configuration files described above into some-new-directory/ojb. Get rid of the some-new-directory/ojb/repository_ejb.xml, and maybe the some-new-directory/ojb/repository_junit.xml by removing their includes from some-new-directory/ojb/repository.xml Try to run your copy of the tutorial1 with some-new-directory/ojb location, with all /lib/*.jar stuff in the classpath. When you have reached the point where hsql tries to open the database, and empty database will be created (two files named some-new-directory/OJB.properties and some-new-directory/OJB.script) The required tables will be missing and a corresponding error exception will be thrown. You find scripts that generate the tables in /target/src/sql/*-schema.sql Use one of the hsqdb tools (see below) to run them. 5. A helpful tool is the Hsqldb gui tool. You can use it to administrate and inspect hsql (file-) databases. To start it, make sure the /lib/hsqldb.jar in your classpath and run java org.hsqldb.util.DatabaseManager -url jdbc:hsqldb:OJB with some-new-directory as current working directory. (OJB is the database name here.) Good luck! Olli - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie question, and request for any step by step isolatedexample
I hear you, and am working (slowly unfortunately, have been in a month long crunch at work) on just this type of tutorial (or Cookbook type articles as Thomas or Matt referred to them). I'd be more than happy to share what I have, except that it is currently written up on dead trees (I think on dead trees) instead of digitally. The best way I have found right now to get going on a standalone project is as follows (in inarticulate and choppy form as I am taking a break from previously mentioned crunch): Download the source install. The binary install is a waste of time. Configure the database stuff for your database (make sure to create the needed database and user before building) and build OJB, then look through the build.xml for the task that builds the testing database via torque run just this target - it will generate the SQL and then actually run it against the database (adding twenty some tables for unit testing). All is not lost though, sql for dropping most of these tables was generated so you don't have to do it by hand, look through the target directory for the sql files and just c&p the drop parts of the scripts into your command line sql client for everything except the ojb_* tables. This will leave you a couple tables that didn't drop because of dependency issues (circular dependency tests), go in and drop the constraints then the tables manually. Now do a dump of your database schema, you have the sql to recreate the OJB required tables for this database in the future. Is a pita, but is how it is right now. Okay, now build the WAR target from ant. You may not be doing a web app, but the benefit of the war target is that it nicely pulls out only the runtime required jars. You will unpack it and extract the jars from the WEB-INF/lib/ directory and put em where you need them. Finally, copy the OJB.properties, repository*.[xml|dtd] to your project and you are good to go. One thing OJB could really use is the equivalent of the struts-blank.war minimal project. The ant WAR target is close to this, but it is rather stilted towards web apps ;-) OJB requires a lot of libraries and a fair bit of configurata, and tracking it all is not perfectly straightforward (luckily I haven't hit version problems in updating the libraries OJB depends on). -Brian On Tue, 2003-02-04 at 09:08, Mehmet D. AKIN wrote: > Is there any step by step isolated example for basic usage of OJB? I > found the tutorials a little complex. I'm not meaning the java codes but > the whole configuration steps are really messed up in my mind. There are > OJB code, ant tasks, torque tasks, source code, tutorial code, several > XML documents, What steps should I do to prepare a single simple > *isolated* example? > > I need an example like this, I have the simplest program with 2-3 classes, > one is like > > class Product{ > int ID; > String name; > methods.. > } > > and a main class to test for accessing DB through OJB ,addin new records > etc. > > so what now? > 1. prepare xml config files? where? > 2. Prepare Database DTD? where? > 3. Should I make a ojb.jar and add it to my project? > 4. where should database driver jar's reside? > 5. What more? > > Sorry but I 'm a little frustrated by all that :). > > I'd greatly appreciate any 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]