is OJB a JAR, and other newbie questions
I've just started using the apache packages ECS and DBCP for servlets, but would like do more, of course. Maybe I just can't find the correct documentation, but it seems like the fine manual, so to speak, comes in two categories. One glosses over details about where to put files and the other assumes knowledge and familiarity which I lack, and all too often goes off on tangents into performance tuning instead of how to install and use OJB. I've seen reference to a sample war file which is supposed to be built somehow, however I cannot locate it. question #1: thu...@arrakis:~/Desktop/db-ojb-1.0.4/lib$ sudo cp db* /usr/share/java -vi [sudo] password for thufir: `db-ojb-1.0.4.jar' - `/usr/share/java/db-ojb-1.0.4.jar' `db-ojb-1.0.4-junit.jar' - `/usr/share/java/db-ojb-1.0.4-junit.jar' `db-ojb-1.0.4-src.jar' - `/usr/share/java/db-ojb-1.0.4-src.jar' `db-ojb-1.0.4-tools.jar' - `/usr/share/java/db-ojb-1.0.4-tools.jar' but there are about fifty jars in that lib directory! I think I have most of them, like apache commons, ant, etc. Surely I don't need to manually copy all fifty to /usr/share/java and then manually add all fifty or so to the ojb library in netbeans? question #2: what are the scripts for? how, when and why should you run them? thu...@arrakis:~/Desktop/db-ojb-1.0.4/bin$ thu...@arrakis:~/Desktop/db-ojb-1.0.4/bin$ thu...@arrakis:~/Desktop/db-ojb-1.0.4/bin$ chmod 744 * thu...@arrakis:~/Desktop/db-ojb-1.0.4/bin$ ll total 36 -rwxr--r-- 1 thufir thufir 398 2005-12-31 05:12 build.bat -rwxr--r-- 1 thufir thufir 609 2005-12-31 05:12 build.sh -rwxr--r-- 1 thufir thufir 18 2005-12-31 05:12 cp.bat -rwxr--r-- 1 thufir thufir 398 2005-12-31 05:12 tutorial1.bat -rwxr--r-- 1 thufir thufir 287 2005-12-31 05:12 tutorial1.sh -rwxr--r-- 1 thufir thufir 398 2005-12-31 05:12 tutorial2.bat -rwxr--r-- 1 thufir thufir 261 2005-12-31 05:12 tutorial2.sh -rwxr--r-- 1 thufir thufir 380 2005-12-31 05:12 tutorial5.bat -rwxr--r-- 1 thufir thufir 250 2005-12-31 05:12 tutorial5.sh thu...@arrakis:~/Desktop/db-ojb-1.0.4/bin$ thu...@arrakis:~/Desktop/db-ojb-1.0.4/bin$ sudo build.sh [sudo] password for thufir: sudo: build.sh: command not found thu...@arrakis:~/Desktop/db-ojb-1.0.4/bin$ ./build.sh bash: ./build.sh: /bin/sh^M: bad interpreter: No such file or directory thu...@arrakis:~/Desktop/db-ojb-1.0.4/bin$ thu...@arrakis:~/Desktop/db-ojb-1.0.4/bin$ sudo su - r...@arrakis:~# cd /home/thufir/Desktop/db-ojb-1.0.4/bin/ r...@arrakis:/home/thufir/Desktop/db-ojb-1.0.4/bin# ./build.sh -su: ./build.sh: /bin/sh^M: bad interpreter: No such file or directory r...@arrakis:/home/thufir/Desktop/db-ojb-1.0.4/bin# r...@arrakis:/home/thufir/Desktop/db-ojb-1.0.4/bin# I use bash that frequently, but I think one of those should've worked. question #3: The only tutorial I could at least follow was: http://www.onjava.com/pub/a/onjava/2003/01/08/ojb.html but it glossed over installing ojb. When doing a web app from Netbeans and deploying WAR files to Tomcat, where do all the different configuration files go? When doing a console mockup, where do the files go? Which sample configuration file would I use for MS SQL server 2005 (not my choice)? I cannot find documentation nor decipher which of the following would work best: thu...@arrakis:~/Desktop/db-ojb-1.0.4/profile$ ll ms* -rw-r--r-- 1 thufir thufir 5155 2005-12-31 05:12 msaccess.profile -rw-r--r-- 1 thufir thufir 5294 2005-12-31 05:12 mssqldb- JSQLConnect.profile -rw-r--r-- 1 thufir thufir 5392 2005-12-31 05:12 mssqldb-ms.profile -rw-r--r-- 1 thufir thufir 5345 2005-12-31 05:12 mssqldb-Opta2000.profile -rw-r--r-- 1 thufir thufir 5290 2005-12-31 05:12 mssqldb.profile thu...@arrakis:~/Desktop/db-ojb-1.0.4/profile$ I think they all say MS SQL server for the db type (except the access one). question #4 //see q#1 I've seen reference to installing and testing OJB. Is it not just a JAR to add to the classpath? http://ojb.db.terra-intl.com/deployment.html says that it must be built from source. Is that out of date? I'm going through http://db.apache.org/ojb/docu/guides/deployment.html but it seems a rather complex way to ship JAR files. Or, is OJB more than just a JAR file? thanks, Thufir - To unsubscribe, e-mail: ojb-user-unsubscr...@db.apache.org For additional commands, e-mail: ojb-user-h...@db.apache.org
Re: newbie problems
Hi Dmitry, I don't know what's going wrong when running the tutorial (seems that Product.class was correctly enhanced by the JDO enhancer). But I wouldn't recommend OJB's JDO 1.0-api implementation for production environments. The PB-api and ODMG-api are stable and ready for production use http://db.apache.org/ojb/status.html If you want to use JDO, please have a look at JPOX or Speedo (or other projects) http://www.jpox.org/index.jsp http://speedo.objectweb.org/ regards, Armin Dmitry Litvintsev wrote: Hi, I am developing a java application and I am considering OJB technology to store objects' states seamlessly in the PostgreSQL database. In short I am failing to get tutorial5 up and running. I followed instructions on this link: http://db.apache.org/ojb/docu/tutorials/jdo-tutorial.html My actions: 1) downloaded ojb-blank.jar 2) downloaded tutorial5-src.jar 3) downloaded db-ojb-1.0.4.jar 4) downloaded jdo.jar,jdori-enhancer.jar,jdori.jar (jdo 1.0.1 RI) 5) downloaded PostgreSQL drivers pg74.216.jdbc3.jar postgresql-8.1-405.jdbc3.jar my top directory is ojb-blank I put *jar files into lib (ojb-blank/lib) I put tutorial5 sources to (ojb_blank/src/java/org/apache/ojb/tutorial5) I modified buid.properties, so it looks like this: jcdAlias=default databaseName=ojb databaseUser=postgres databasePassword= dbmsName=PostgreSQL jdbcLevel=3.0 jdbcRuntimeDriver=org.postgresql.Driver urlProtocol=jdbc urlSubprotocol=postgresql urlDbalias=//localhost/${databaseName} torque.database=postgresql torque.database.createUrl=${urlProtocol}:${urlSubprotocol}:${urlDbalias} jar.name=my-project.jar source.dir=src source.java.dir=${source.dir}/java source.resource.dir=${source.dir}/resources source.test.dir=${source.dir}/test source.schema.dir=${source.dir}/schema build.dir=build lib.dir=lib target.dir=target I do not recall changing build.xml. 1) DB setup ant build setup-db runs w/ errors, but it creates *.sql files which I run byu hand and next time around ant build setup-db runs w/o errors. So I consider it is a success: $ psql ojb Welcome to psql 8.0.3, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help with psql commands \g or terminate with semicolon to execute query \q to quit ojb=# \d List of relations Schema | Name| Type | Owner +---+---+-- public | ojb_dlist | table | postgres public | ojb_dlist_entries | table | postgres public | ojb_dmap | table | postgres public | ojb_dmap_entries | table | postgres public | ojb_dset | table | postgres public | ojb_dset_entries | table | postgres public | ojb_hl_seq| table | postgres public | ojb_nrm | table | postgres public | product | table | postgres (9 rows) 2) ant build $ ant build Buildfile: build.xml compile: [mkdir] Created dir: /data/postgres/ojb/ojb-blank/build [mkdir] Created dir: /data/postgres/ojb/ojb-blank/build/classes [javac] Compiling 9 source files to /data/postgres/ojb/ojb-blank/build/classes xdoclet: [ojbdoclet] 2006-04-18 18:33:08,102 [main] INFO xdoclet.XDocletMain.start - Running ojbrepository/ [ojbdoclet] Generating ojb repository descriptor (build/repository_user.xml) [ojbdoclet] Type org.apache.ojb.tutorial5.Product [ojbdoclet] Processed 1 types [ojbdoclet] Processed 1 types [ojbdoclet] 2006-04-18 18:33:08,493 [main] INFO xdoclet.XDocletMain.start - Running torqueschema/ [ojbdoclet] Generating torque schema (build/database/project-schema.xml) [ojbdoclet] Processed 1 types build: [copy] Copying 7 files to /data/postgres/ojb/ojb-blank/build [mkdir] Created dir: /data/postgres/ojb/ojb-blank/build/lib [copy] Copying 41 files to /data/postgres/ojb/ojb-blank/build/lib build_if_with_mainclass: [copy] Copying 2 files to /data/postgres/ojb/ojb-blank/build BUILD SUCCESSFUL Total time: 3 seconds so I am encouraged , I proceed to the next step: 3) ant enhance-jdori $ ant enhance-jdori Buildfile: build.xml compile: xdoclet: [ojbdoclet] 2006-04-18 18:34:35,546 [main] INFO xdoclet.XDocletMain.start - Running ojbrepository/ [ojbdoclet] 2006-04-18 18:34:36,128 [main] INFO xdoclet.XDocletMain.start - Running torqueschema/ build: build_if_with_mainclass:
Re: newbie problems
Thank you Armin, Please educate me a bit, cause I am a bit perplexed by your mail. You say OJB does not work well w/ JDO, use ODMG or PB OK, I understand that. then you say: If you want to use JDO, please have a look at JPOX or Speedo (or other JPOX is a implementation of JDO, isn't it? So can I use OJB w/ JPOX then? Or should I just use JPOX ? (this indicates my confusion at what exactly OJB does on the top of JDO). Please help me out. On Wed, 19 Apr 2006, Armin Waibel wrote: Hi Dmitry, I don't know what's going wrong when running the tutorial (seems that Product.class was correctly enhanced by the JDO enhancer). But I wouldn't recommend OJB's JDO 1.0-api implementation for production environments. The PB-api and ODMG-api are stable and ready for production use http://db.apache.org/ojb/status.html If you want to use JDO, please have a look at JPOX or Speedo (or other projects) http://www.jpox.org/index.jsp http://speedo.objectweb.org/ regards, Armin Dmitry Litvintsev wrote: Hi, I am developing a java application and I am considering OJB technology to store objects' states seamlessly in the PostgreSQL database. In short I am failing to get tutorial5 up and running. I followed instructions on this link: http://db.apache.org/ojb/docu/tutorials/jdo-tutorial.html -- Dmitri Litvintsev /--\ | Tel: (630) 840 5005| | FAX: (630) 840 2968| |(630) 840 2783| | Pager: 847 536 6450| | office:WH8E 863 | | E-mail:[EMAIL PROTECTED] | \--/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: newbie problems
Dmitry Litvintsev wrote: Thank you Armin, Please educate me a bit, cause I am a bit perplexed by your mail. You say OJB does not work well w/ JDO, use ODMG or PB OK, I understand that. then you say: If you want to use JDO, please have a look at JPOX or Speedo (or other JPOX is a implementation of JDO, isn't it? yep! So can I use OJB w/ JPOX then? Or should I just use JPOX ? (this indicates my confusion at what exactly OJB does on the top of JDO). JPOX instead of OJB (If you fixed to use the JDO-api). OJB is a O/R-mapper with different supported API's (PB-api, ODMG-api, prototype JDO1.0), JPOX only supports the JDO-api. HTH regards, Armin Please help me out. On Wed, 19 Apr 2006, Armin Waibel wrote: Hi Dmitry, I don't know what's going wrong when running the tutorial (seems that Product.class was correctly enhanced by the JDO enhancer). But I wouldn't recommend OJB's JDO 1.0-api implementation for production environments. The PB-api and ODMG-api are stable and ready for production use http://db.apache.org/ojb/status.html If you want to use JDO, please have a look at JPOX or Speedo (or other projects) http://www.jpox.org/index.jsp http://speedo.objectweb.org/ regards, Armin Dmitry Litvintsev wrote: Hi, I am developing a java application and I am considering OJB technology to store objects' states seamlessly in the PostgreSQL database. In short I am failing to get tutorial5 up and running. I followed instructions on this link: http://db.apache.org/ojb/docu/tutorials/jdo-tutorial.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: newbie problems
Dmitry Litvintsev escribió: Thank you Armin, Please educate me a bit, cause I am a bit perplexed by your mail. You say OJB does not work well w/ JDO, use ODMG or PB OK, I understand that. then you say: If you want to use JDO, please have a look at JPOX or Speedo (or other JPOX is a implementation of JDO, isn't it? So can I use OJB w/ JPOX then? Or should I just use JPOX ? (this indicates my confusion at what exactly OJB does on the top of JDO). Please help me out. Hi Dmitry, We cannot use OJB w/ JPOX. Basically, the JDO support in OJB works only with Sun JDO 1.0.1 [1]. If you want to stay in Apache home, you should try Apache JDO wich is working on a final release of a JDO 2 version. Best Regards, Antonio Gallardo. [1] http://java.sun.com/products/jdo/ [2] http://db.apache.org/jdo/ On Wed, 19 Apr 2006, Armin Waibel wrote: Hi Dmitry, I don't know what's going wrong when running the tutorial (seems that Product.class was correctly enhanced by the JDO enhancer). But I wouldn't recommend OJB's JDO 1.0-api implementation for production environments. The PB-api and ODMG-api are stable and ready for production use http://db.apache.org/ojb/status.html If you want to use JDO, please have a look at JPOX or Speedo (or other projects) http://www.jpox.org/index.jsp http://speedo.objectweb.org/ regards, Armin Dmitry Litvintsev wrote: Hi, I am developing a java application and I am considering OJB technology to store objects' states seamlessly in the PostgreSQL database. In short I am failing to get tutorial5 up and running. I followed instructions on this link: http://db.apache.org/ojb/docu/tutorials/jdo-tutorial.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
newbie problems
Hi, I am developing a java application and I am considering OJB technology to store objects' states seamlessly in the PostgreSQL database. In short I am failing to get tutorial5 up and running. I followed instructions on this link: http://db.apache.org/ojb/docu/tutorials/jdo-tutorial.html My actions: 1) downloaded ojb-blank.jar 2) downloaded tutorial5-src.jar 3) downloaded db-ojb-1.0.4.jar 4) downloaded jdo.jar,jdori-enhancer.jar,jdori.jar (jdo 1.0.1 RI) 5) downloaded PostgreSQL drivers pg74.216.jdbc3.jar postgresql-8.1-405.jdbc3.jar my top directory is ojb-blank I put *jar files into lib (ojb-blank/lib) I put tutorial5 sources to (ojb_blank/src/java/org/apache/ojb/tutorial5) I modified buid.properties, so it looks like this: jcdAlias=default databaseName=ojb databaseUser=postgres databasePassword= dbmsName=PostgreSQL jdbcLevel=3.0 jdbcRuntimeDriver=org.postgresql.Driver urlProtocol=jdbc urlSubprotocol=postgresql urlDbalias=//localhost/${databaseName} torque.database=postgresql torque.database.createUrl=${urlProtocol}:${urlSubprotocol}:${urlDbalias} jar.name=my-project.jar source.dir=src source.java.dir=${source.dir}/java source.resource.dir=${source.dir}/resources source.test.dir=${source.dir}/test source.schema.dir=${source.dir}/schema build.dir=build lib.dir=lib target.dir=target I do not recall changing build.xml. 1) DB setup ant build setup-db runs w/ errors, but it creates *.sql files which I run byu hand and next time around ant build setup-db runs w/o errors. So I consider it is a success: $ psql ojb Welcome to psql 8.0.3, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help with psql commands \g or terminate with semicolon to execute query \q to quit ojb=# \d List of relations Schema | Name| Type | Owner +---+---+-- public | ojb_dlist | table | postgres public | ojb_dlist_entries | table | postgres public | ojb_dmap | table | postgres public | ojb_dmap_entries | table | postgres public | ojb_dset | table | postgres public | ojb_dset_entries | table | postgres public | ojb_hl_seq| table | postgres public | ojb_nrm | table | postgres public | product | table | postgres (9 rows) 2) ant build $ ant build Buildfile: build.xml compile: [mkdir] Created dir: /data/postgres/ojb/ojb-blank/build [mkdir] Created dir: /data/postgres/ojb/ojb-blank/build/classes [javac] Compiling 9 source files to /data/postgres/ojb/ojb-blank/build/classes xdoclet: [ojbdoclet] 2006-04-18 18:33:08,102 [main] INFO xdoclet.XDocletMain.start - Running ojbrepository/ [ojbdoclet] Generating ojb repository descriptor (build/repository_user.xml) [ojbdoclet] Type org.apache.ojb.tutorial5.Product [ojbdoclet] Processed 1 types [ojbdoclet] Processed 1 types [ojbdoclet] 2006-04-18 18:33:08,493 [main] INFO xdoclet.XDocletMain.start - Running torqueschema/ [ojbdoclet] Generating torque schema (build/database/project-schema.xml) [ojbdoclet] Processed 1 types build: [copy] Copying 7 files to /data/postgres/ojb/ojb-blank/build [mkdir] Created dir: /data/postgres/ojb/ojb-blank/build/lib [copy] Copying 41 files to /data/postgres/ojb/ojb-blank/build/lib build_if_with_mainclass: [copy] Copying 2 files to /data/postgres/ojb/ojb-blank/build BUILD SUCCESSFUL Total time: 3 seconds so I am encouraged , I proceed to the next step: 3) ant enhance-jdori $ ant enhance-jdori Buildfile: build.xml compile: xdoclet: [ojbdoclet] 2006-04-18 18:34:35,546 [main] INFO xdoclet.XDocletMain.start - Running ojbrepository/ [ojbdoclet] 2006-04-18 18:34:36,128 [main] INFO xdoclet.XDocletMain.start - Running torqueschema/ build: build_if_with_mainclass: enhance-jdori: [java] Enhancer: options: [java] verbose = true [java] quiet = false [java] forceWrite = true [java] noWrite = false [java] sourcePath = null [java] destinationDirectory = build/classes [java] propertiesFileName = null [java] doTiming = false [java] classNames = { [java] } [java] jdoFileNames = { [java] src/java/org/apache/ojb/tutorial5/Product.jdo [java]
newbie can't get started
I'm a newbie trying to get into OJB. I downloaded 1.0.4 src and unzipped it When I run bin\build.bat from command window, it fails with over 100 duplicate class errors, example: duplicate class: org.apache.ojb.broker.Identity I have JAVA_HOME set to a java5 jdk. What is wrong? Can anyone point me to a getting started kind of document? A You've downloaded ojb, now what? kind of thing. I want to run the junit tests on my system, at the least, before trying it in my own project. Thanks in advance, CQ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: newbie can't get started
[EMAIL PROTECTED] wrote: Can anyone point me to a getting started kind of document? Only follow the link: http://db.apache.org/ojb/docu/getting-started.html regards, Thomas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: newbie can't get started
Hi, [EMAIL PROTECTED] wrote: I'm a newbie trying to get into OJB. I downloaded 1.0.4 src and unzipped it When I run bin\build.bat from command window, it fails with over 100 duplicate class errors, example: duplicate class: org.apache.ojb.broker.Identity I have JAVA_HOME set to a java5 jdk. What is wrong? Can anyone point me to a getting started kind of document? A You've downloaded ojb, now what? kind of thing. I want to run the junit tests on my system, at the least, before trying it in my own project. how to run the junit tests have a look at http://db.apache.org/ojb/docu/testing/testsuite.html#How+to+run+the+Test+Suite By default hsql was used (this should always work without any modification in OJB profiles, property files,...). regards, Armin Thanks in advance, CQ - 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: possible newbie Question; Wrong Long id when fetching..
Hi Christian, Christian Vejrich wrote: When inserting a new object, mysql db with autoincrement the database stores the object correct and sets an correct id, but when fetching all the stored objects( ojb does a select *) , the ids in the objects returned from ojb are completly different ones? Any ideas? Could you please post more details. Version of OJB? Code snippet, metadata mapping? Generated sql, expected sql, regards, Armin thanks, -c. - 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: [Fwd: SV: possible newbie Question; Wrong Long id when fetching..]
Hi, Im using, db-obj-1.0.3.jar metadata mapping: class-descriptor class=AdvertisementType table=ADVERTISEMENTTYPE field-descriptor name=id column=ID jdbc-type=BIGINT nullable=false primarykey=true autoincrement=true/ field-descriptor name=name nullable=false column=NAME jdbc-type=VARCHAR/ /class-descriptor In your previous post you said mysql db with autoincrement the database, so does it mean you are using database identity columns (and SequenceManagerNativeImpl) or do you use sequence id's generated by OJB (e.g. SequenceManagerHighLowImpl)? Generated sql SQL:SELECT A0.ID,A0.NAME FROM ADVERTISEMENTTYPE A0 ORDER BY 1 However, noticed now that im using, the deprecated method crit.addOrderBy(orderBy, sortAscending); Could that be the problem? I don't think so. regards, Armin Strange that it works for other objects with exact same fields and metadata mappings, the AdvertisementType used to be named only Type, changed it for possible collitions... thanks, christian vejrich. -Ursprungligt meddelande- Från: Armin Waibel [mailto:[EMAIL PROTECTED] Skickat: den 17 januari 2006 10:57 Till: OJB Users List Ämne: Re: possible newbie Question; Wrong Long id when fetching.. Hi Christian, Christian Vejrich wrote: When inserting a new object, mysql db with autoincrement the database stores the object correct and sets an correct id, but when fetching all the stored objects( ojb does a select *) , the ids in the objects returned from ojb are completly different ones? Any ideas? Could you please post more details. Version of OJB? Code snippet, metadata mapping? Generated sql, expected sql, regards, Armin thanks, -c. - 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]
SV: [Fwd: SV: possible newbie Question; Wrong Long id when fetching..]
Hi, -Ursprungligt meddelande- Från: Armin Waibel [mailto:[EMAIL PROTECTED] Skickat: den 17 januari 2006 12:03 Till: OJB Users List Ämne: Re: [Fwd: SV: possible newbie Question; Wrong Long id when fetching..] Hi, Im using, db-obj-1.0.3.jar metadata mapping: class-descriptor class=AdvertisementType table=ADVERTISEMENTTYPE field-descriptor name=id column=ID jdbc-type=BIGINT nullable=false primarykey=true autoincrement=true/ field-descriptor name=name nullable=false column=NAME jdbc-type=VARCHAR/ /class-descriptor In your previous post you said mysql db with autoincrement the database, so does it mean you are using database identity columns (and SequenceManagerNativeImpl) or do you use sequence id's generated by OJB (e.g. SequenceManagerHighLowImpl)? Seems to me that im using, SequenceManagerHighLowImpl, the strange is that i have exactly the same type of objects with no problems what so ever, the only differecne is the java class name, identical metamappings, and java execution code... below my repository_database.xml. jdbc-connection-descriptor jcd-alias=default default-connection=true platform=MySQL jdbc-level=3.0 driver=org.gjt.mm.mysql.Driver protocol=jdbc subprotocol=mysql dbalias=//localhost:3306/scms?useUnicode=true username=* password=** batch-mode=false useAutoCommit=1 ignoreAutoCommitExceptions=false !-- alternative cache implementations, see docs section Caching -- object-cache class=org.apache.ojb.broker.cache.ObjectCacheTwoLevelImpl !-- meaning of attributes, please see docs section Caching -- !-- common attributes -- attribute attribute-name=cacheExcludes attribute-value=/ !-- ObjectCacheTwoLevelImpl attributes -- attribute attribute-name=applicationCache attribute-value=org.apache.ojb.broker.cache.ObjectCacheDefaultImpl/ attribute attribute-name=copyStrategy attribute-value=org.apache.ojb.broker.cache.ObjectCacheTwoLevelImpl$CopyStrategyImpl/ !-- ObjectCacheDefaultImpl attributes -- attribute attribute-name=timeout attribute-value=900/ attribute attribute-name=autoSync attribute-value=true/ attribute attribute-name=cachingKeyType attribute-value=0/ attribute attribute-name=useSoftReferences attribute-value=true/ /object-cache connection-pool maxActive=30 validationQuery=SELECT 1 testOnBorrow=true testOnReturn=false logAbandoned=true whenExhaustedAction=0 removeAbandoned=true removeAbandonedTimeout=100 / !-- alternative sequence manager implementations, see docs section Sequence Manager -- sequence-manager className=org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl !-- meaning of attributes, please see docs section Sequence Manager -- attribute attribute-name=grabSize attribute-value=20/ attribute attribute-name=autoNaming attribute-value=true/ attribute attribute-name=sequenceStart attribute-value=0/ attribute attribute-name=globalSequenceId attribute-value=false/ /sequence-manager /jdbc-connection-descriptor Generated sql SQL:SELECT A0.ID,A0.NAME FROM ADVERTISEMENTTYPE A0 ORDER BY 1 However, noticed now that im using, the deprecated method crit.addOrderBy(orderBy, sortAscending); Could that be the problem? I don't think so. regards, Armin Strange that it works for other objects with exact same fields and metadata mappings, the AdvertisementType used to be named only Type, changed it for possible collitions... thanks, christian vejrich. -Ursprungligt meddelande- Från: Armin Waibel [mailto:[EMAIL PROTECTED] Skickat: den 17 januari 2006 10:57 Till: OJB Users List Ämne: Re: possible newbie Question; Wrong Long id when fetching.. Hi Christian, Christian Vejrich wrote: When inserting a new object, mysql db with autoincrement the database stores the object correct and sets an correct id, but when fetching all the stored objects( ojb does a select *) , the ids in the objects returned from ojb are completly different ones? Any ideas? Could you please post more details. Version of OJB? Code snippet, metadata mapping? Generated sql, expected sql, regards, Armin thanks, -c. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED
Newbie problem finding a solution retrieving orphaned rows
Hi, First please excuse my english as this is not my native language. I am new to OJB and I am using the PB-API. Given class A with attributes and a foreign key reference to class B (b_ref) class B with b_id and more attributes The reference is n to 1, so one instance of B can be referenced by 0 to n instances of A What I want: Select all instances of B that are not referenced by instances of A. In plain SQL I would write: SELECT * FROM B WHERE B_ID NOT IN (SELECT DISTINCT B_REF FROM A) or SELECT * FROM B LEFT OUTER JOIN A ON (B.b_id = A.b_ref) WHERE A.a_id is null What I must avoid is loading all instances of A into the cache. I have tried using a subquery and a dummy class, that only has the b_ref attribute: ReportQueryByCriteria subquery = new ReportQueryByCriteria(ADummy.class,null); subquery.setAttributes(new String[] { b_ref }); subquery.setDistinct(true); with class ADummy using b_ref as the primary key, but Collection results = broker.getCollectionByQuery(subquery); results in: [org.apache.ojb.broker.core.QueryReferenceBroker] DEBUG: getCollectionByQuery (class org.apache.ojb.broker.util.collections.RemovalAwareCollection, class ADummy, ReportQuery from class ADummy b_ref ) [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeQuery : ReportQuery from class ADummy b_ref [org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$TableAlias] DEBUG: TableAlias(): using hints ? false [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT DISTINCT A0.B_REF FROM A A0 [org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] DEBUG: makeObject called [org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl] DEBUG: Create new connection using DriverManager: [EMAIL PROTECTED] [org.apache.ojb.broker.accesslayer.ConnectionManagerImpl] DEBUG: Request new connection from ConnectionFactory: [EMAIL PROTECTED] [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeQuery: [EMAIL PROTECTED] [org.apache.ojb.broker.accesslayer.RsIterator] DEBUG: RsIterator[org.apache.ojb.broker.accesslayer.RsQueryObject[query: ReportQuery from class ADummy b_ref , class descriptor: ADummy]] initialized [org.apache.ojb.broker.accesslayer.RsIterator] DEBUG: hasNext() - true org.apache.ojb.broker.PersistenceBrokerException: Error reading class type: ADummy from result set, current read field was a_attr at org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.readValuesFrom(RowReaderDefaultImpl.java:208) at org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.readObjectArrayFrom(RowReaderDefaultImpl.java:176) at org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(RsIterator.java:440) at org.apache.ojb.broker.accesslayer.RsIterator.next(RsIterator.java:265) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:122) at [...] Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Invalid column name: A_ATTRIBUTE at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source) [...] If this query would be successful, my next idea was to use something like: Criteria crit = new Criteria(); crit.addNotIn(b_id,subquery); Query query = QueryFactory.newQuery(B.class,crit); Collection results = broker.getCollectionByQuery(query); My concern is that once I have the first step solved, the next will be that the attribute b_id does not match the dummy class... How can I do this with OJB? Any hints are appreciated. With kind regards Bernd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
NewBie: How to specify sql table creation order
Hi, I am a newbie to OJB. I am going thru the documentation and trying to create a couple of simple entities/relations. I am facing a problem : The sql that gets generated uses the wrong table creation first, my primary entities are created last and the dependent table sql gets generated first. How can I specify order of creation of entities in XDoclet ? I am generating repository files thru XDoclet by providing appropriate javadoc custom tags. I guess that option must be provided, but I am just not finding how to do it. Please help. Thanks. __ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: NewBie: How to specify sql table creation order
This sounds more like a problem with Torque which is per default used to generate the tables in the database. You can try to use commons-sql instead (http://jakarta.apache.org/commons/sandbox/sql/), it groks the same table schema but it splits the table generation and the creation of foreignkeys into two separate steps so that all tables are available when the foreignkeys are created. Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: NewBie: How to specify sql table creation order
Hi Tom, Thanks a lot for responding. I'm grappling with the basic concepts. I see, so instead of specifying an entity creation order, we'd rather let another tool (commons-sql) that can decipher primary and dependent entities, split them up, and order them by this distinction, and let it resolve the dependencies. Is my understanding correct ? Is there any documentation/ usage guidelines available for integrating commons-sql with OJB ? That would help me getting kickstarted with the integration ? Thanks a ton again. -ZN --- Thomas Dudziak [EMAIL PROTECTED] wrote: This sounds more like a problem with Torque which is per default used to generate the tables in the database. You can try to use commons-sql instead (http://jakarta.apache.org/commons/sandbox/sql/), it groks the same table schema but it splits the table generation and the creation of foreignkeys into two separate steps so that all tables are available when the foreignkeys are created. Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: NewBie: How to specify sql table creation order
I'm grappling with the basic concepts. I see, so instead of specifying an entity creation order, we'd rather let another tool (commons-sql) that can decipher primary and dependent entities, split them up, and order them by this distinction, and let it resolve the dependencies. Is my understanding correct ? The primary problem with the foreignkeys is that because of circular dependencies between the tables, there may not be a way to order the table that actually works when using inline foreignkeys (i.e. the foreignkeys embedded in the tables). commons-sql circumvents this by splitting this into two steps using alter table statements to add the foreignkeys to the then already existing tables. Is there any documentation/ usage guidelines available for integrating commons-sql with OJB ? That would help me getting kickstarted with the integration ? You only need to use the one Ant task that is described on the commons-sql website, with the schema that the XDoclet module generated. An example usage is in the task itself, in the class comment: http://svn.apache.org/viewcvs.cgi/jakarta/commons/sandbox/sql/trunk/src/java/org/apache/commons/sql/task/DDLTask.java?view=markup Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: NewBie: How to specify sql table creation order
Hi Tom, Awesome. That was very insightful. I'll try it out now that I think I understand it much better. Thanks again. ZN --- Thomas Dudziak [EMAIL PROTECTED] wrote: I'm grappling with the basic concepts. I see, so instead of specifying an entity creation order, we'd rather let another tool (commons-sql) that can decipher primary and dependent entities, split them up, and order them by this distinction, and let it resolve the dependencies. Is my understanding correct ? The primary problem with the foreignkeys is that because of circular dependencies between the tables, there may not be a way to order the table that actually works when using inline foreignkeys (i.e. the foreignkeys embedded in the tables). commons-sql circumvents this by splitting this into two steps using alter table statements to add the foreignkeys to the then already existing tables. Is there any documentation/ usage guidelines available for integrating commons-sql with OJB ? That would help me getting kickstarted with the integration ? You only need to use the one Ant task that is described on the commons-sql website, with the schema that the XDoclet module generated. An example usage is in the task itself, in the class comment: http://svn.apache.org/viewcvs.cgi/jakarta/commons/sandbox/sql/trunk/src/java/org/apache/commons/sql/task/DDLTask.java?view=markup Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
NewBie: How to specify sql table creation order
Hi, I am a newbie to OJB. I am going thru the documentation and trying to create a couple of simple entities/relations. I am facing a problem. I guess that option must be provided, but I am just not finding how to do it : The sql that gets generated uses the wrong table creation first, my primary entities are created last and the dependent table sql gets generated first. How can I specify order of creation of entities in XDoclet ? I am generating repository files thru XDoclet by providing appropriate javadoc custom tags. Please help. Thanks. __ Do you Yahoo!? Make Yahoo! your home page http://www.yahoo.com/r/hs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: newbie
krupa B wrote: Can somebody suggest a good book or tutorials in easy to understand manner. Did you try the Getting Started section? http://db.apache.org/ojb/docu/getting-started.html You can also find useful info in the FAQ: Getting Started: http://db.apache.org/ojb/docu/faq.html#gettingStarted Practical HOWTOs: http://db.apache.org/ojb/docu/faq.html#howto Regards, Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: newbie
Thanks Martin, I looked at the tutorials, I will look at getting started.Thanks for your reply. Martin Kalén [EMAIL PROTECTED] wrote:krupa B wrote: Can somebody suggest a good book or tutorials in easy to understand manner. Did you try the Getting Started section? http://db.apache.org/ojb/docu/getting-started.html You can also find useful info in the FAQ: Getting Started: http://db.apache.org/ojb/docu/faq.html#gettingStarted Practical HOWTOs: http://db.apache.org/ojb/docu/faq.html#howto Regards, Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Make Yahoo! your home page
newbie
Hi I am a newbie to OJB. The OR mappings tutorial is kinda hard for me to understand. Can somebody suggest a good book or tutorials in easy to understand manner. Thanks __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
[newbie] ODMG API : updating an object's primary key.
Hi, I try to use the ODMG API of OJB. I noticed that, if I read an object from the database, then modify a property that is declared as a primary key (in the mapping) and save the object to the database, a new row is created as if it was a new object inserted. Is there a way to modify an object's primary key without having to delete it from the database before ? follows a sample code. --- class-descriptor class=year table=numord field-descriptor name=year column=annee primarykey=true / /class-descriptor public class year { private int year; public int getYear() { return year; } public void setYear(int year) { this.year = year; } } public class test { public static void main(String[] args) { year y = new year(); try { Implementation impl = OdmgSingleton.odmg; //OdmgSingleton is a static class of mine. Transaction t = impl.newTransaction(); t.begin(); org.odmg.OQLQuery query = impl.newOQLQuery(); query.create(select p from year); DList results = (DList)query.execute(); y = (year)results.iterator().next(); t.lock(y,Transaction.WRITE); y.setYear(2004); t.commit(); } catch (Exception e) { e.printStackTrace(); } } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [newbie] ODMG API : updating an object's primary key.
Why would you want to do that ? The primary key identifies the object uniquely, so if you change the value of the corresponding java field(s), then OJB and the database think that you have created a new instance of the class/new row in the table. Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [newbie] ODMG API : updating an object's primary key.
Actually the concept of primary key is not always used in a database. Let's imagine a table person with fields firstname and lastname but no id. As OJB needs a primary key I will use the couple (firstname,lastname) as a primary key for the mapping. But if I change the property firstname in the java object, it is still the same object and not a new one. -Message d'origine- De : Thomas Dudziak [mailto:[EMAIL PROTECTED] Envoyé : mercredi 9 février 2005 13:28 À : OJB Users List Objet : Re: [newbie] ODMG API : updating an object's primary key. Why would you want to do that ? The primary key identifies the object uniquely, so if you change the value of the corresponding java field(s), then OJB and the database think that you have created a new instance of the class/new row in the table. Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [newbie] ODMG API : updating an object's primary key.
But as far as OJB and the database is concerned, it is a new one, because they cannot determine to which 'old' one it corresponds. The problem here is that OJB and the database use object equality (if two objects are equal as determined by equals()/hashCode()) whereas you want to use identity (same java object as determined by ==, i.e. location in memory). So you either got to delete the old object/row and then insert the new one, or introduce a separate primary key. Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [newbie] ODMG API : updating an object's primary key.
ok. Thank you. -Message d'origine- De : Thomas Dudziak [mailto:[EMAIL PROTECTED] Envoyé : mercredi 9 février 2005 13:52 À : OJB Users List Objet : Re: [newbie] ODMG API : updating an object's primary key. But as far as OJB and the database is concerned, it is a new one, because they cannot determine to which 'old' one it corresponds. The problem here is that OJB and the database use object equality (if two objects are equal as determined by equals()/hashCode()) whereas you want to use identity (same java object as determined by ==, i.e. location in memory). So you either got to delete the old object/row and then insert the new one, or introduce a separate primary key. Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Newbie Q] obj-blank xdoclet ant task not generating repository_user
Robert Baruch wrote: I'm using the obj-blank project as is, except that I have added a single file: src/java/genealogy/data/CitationPartType.java: package genealogy.data; /** * @obj.class */ public class CitationPartType { /** * @obj.field */ private String name; /** * @obj.field * attributes=primarykey */ private int id; } I haven't altered anything in build.properties. The problem is that when I run ant xdoclet, I end up with none of this information in the repository_user.xml file: Ant properly builds one file, sticks it in build/classes/genealogy/data, but then the xdoclet task doesn't seem to notice that my class has objdoclet tags in it. Any ideas on how to debug this problem? The OJB XDoclet module does not process the type because you misspelled the xdoclet tags: its @[EMAIL PROTECTED], not @[EMAIL PROTECTED] (this is quite hard to catch ;-) ) Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Newbie Q] obj-blank xdoclet ant task not generating repository_user
Robert Baruch wrote: Hi all, I'm using the obj-blank project as is, except that I have added a single file: src/java/genealogy/data/CitationPartType.java: package genealogy.data; /** * @obj.class */ public class CitationPartType { /** * @obj.field */ private String name; /** * @obj.field * attributes=primarykey */ private int id; } I haven't altered anything in build.properties. The problem is that when I run ant xdoclet, I end up with none of this information in the repository_user.xml file: Buildfile: build.xml compile: [mkdir] Created dir: /Users/ek/jbproject/Genealogy/build [mkdir] Created dir: /Users/ek/jbproject/Genealogy/build/classes [javac] Compiling 1 source file to /Users/ek/jbproject/Genealogy/build/classes build: [copy] Copying 7 files to /Users/ek/jbproject/Genealogy/build/resources compile: xdoclet: [ojbdoclet] (XDocletMain.start 47 ) Running ojbrepository/ [ojbdoclet] Generating ojb repository descriptor (build/resources//repository_user.xml) [ojbdoclet] Processed 0 types [ojbdoclet] Processed 0 types [ojbdoclet] (XDocletMain.start 47 ) Running torqueschema/ [ojbdoclet] Generating torque schema (build/resources//project-schema.xml) [ojbdoclet] Processed 0 types BUILD SUCCESSFUL Total time: 3 seconds Ant properly builds one file, sticks it in build/classes/genealogy/data, but then the xdoclet task doesn't seem to notice that my class has objdoclet tags in it. Resulting repository_user.xml file: !-- file containing the repository descriptions for user-defined types -- !-- Generated by the xdoclet-ojb module -- Any ideas on how to debug this problem? The XDoclet module does not process the type because you misspelled the xdoclet comments: its @[EMAIL PROTECTED], not @[EMAIL PROTECTED] This is quite hard to catch ;-) Tom Thanks, --Rob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Newbie Q] obj-blank xdoclet ant task not generating repository_user
Thomas Dudziak wrote: The OJB XDoclet module does not process the type because you misspelled the xdoclet tags: its @[EMAIL PROTECTED], not @[EMAIL PROTECTED] (this is quite hard to catch ;-) ) sigh I am so embarrassed :) Thanks! --Rob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Newbie Q] obj-blank xdoclet ant task not generating repository_user
Hi all, I'm using the obj-blank project as is, except that I have added a single file: src/java/genealogy/data/CitationPartType.java: package genealogy.data; /** * @obj.class */ public class CitationPartType { /** * @obj.field */ private String name; /** * @obj.field * attributes=primarykey */ private int id; } I haven't altered anything in build.properties. The problem is that when I run ant xdoclet, I end up with none of this information in the repository_user.xml file: Buildfile: build.xml compile: [mkdir] Created dir: /Users/ek/jbproject/Genealogy/build [mkdir] Created dir: /Users/ek/jbproject/Genealogy/build/classes [javac] Compiling 1 source file to /Users/ek/jbproject/Genealogy/build/classes build: [copy] Copying 7 files to /Users/ek/jbproject/Genealogy/build/resources compile: xdoclet: [ojbdoclet] (XDocletMain.start 47 ) Running ojbrepository/ [ojbdoclet] Generating ojb repository descriptor (build/resources//repository_user.xml) [ojbdoclet] Processed 0 types [ojbdoclet] Processed 0 types [ojbdoclet] (XDocletMain.start 47 ) Running torqueschema/ [ojbdoclet] Generating torque schema (build/resources//project-schema.xml) [ojbdoclet] Processed 0 types BUILD SUCCESSFUL Total time: 3 seconds Ant properly builds one file, sticks it in build/classes/genealogy/data, but then the xdoclet task doesn't seem to notice that my class has objdoclet tags in it. Resulting repository_user.xml file: !-- file containing the repository descriptions for user-defined types -- !-- Generated by the xdoclet-ojb module -- Any ideas on how to debug this problem? Thanks, --Rob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FW: Newbie Question : There was no default-PBKey specified
Hi Roman, does OJB find your repository.xml file? Think we need more detailed info to help, so could you please post the whole stack trace and the connection declaration. regards, Armin Stark, Roman wrote: For the past tow days I tried to set up the ojb-blank project. Everything I try ends up with the following message: There was no default-PBKey specified I am using eclips 3 for the project following the instructions from the web site. All I have tried so far is just get a connection and run a very simple QueryByCriteria. I did set up the repository.xml files, of which there are 3 plus repository.xml. The database xml has a simple jdbc-connection-descriptor in it and that's all, and the default-connection=true; I really am at a loss, any suggestions would be great on this. I don't even know where to look anymore for what set up could cause this problem. Thanks Roman - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FW: Newbie Question : There was no default-PBKey specified
Stark, Roman wrote: For the past tow days I tried to set up the ojb-blank project. Everything I try ends up with the following message: There was no default-PBKey specified I am using eclips 3 for the project following the instructions from the web site. All I have tried so far is just get a connection and run a very simple QueryByCriteria. I did set up the repository.xml files, of which there are 3 plus repository.xml. The database xml has a simple jdbc-connection-descriptor in it and that's all, and the default-connection=true; I really am at a loss, any suggestions would be great on this. I don't even know where to look anymore for what set up could cause this problem. The usual reason for this is that the repository.xml was not found and OJB started in the un-configured mode (which btw is intended for when you want to setup OJB programmatically). You should get a warning about this in the log file (if you configured e.g. logging to use Log4j) or console. Also be aware that with standard ojb-blank, you've got to start the application in the build/resources directory, not in the project's root folder (see the Getting Started doc at http://db.apache.org/ojb/docu/getting-started.html for details). Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: FW: Newbie Question : There was no default-PBKey specified
I am assuming so. All the xml files are in src/resources and if I move repository.xml to the root I get an error that it can't find the repository file. So I think it can find it. Stack trace: There was no default-PBKey specified org.apache.ojb.broker.PBFactoryException: There was no default-PBKey specified at org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersi stenceBroker(Unknown Source) at org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker( Unknown Source) at TestDriver.run(TestDriver.java:61) at TestDriver.main(TestDriver.java:35) Connection declaration from repository_datbase.xml (both versions, same result) jdbc-connection-descriptor jcd-alias=HREDB default-connection=true platform=Oracle jdbc-level=3.0 batch-mode=true useAutoCommit=0 ignoreAutoCommitExceptions=false driver=oracle.jdbc.driver.OracleDriver protocol=jdbc subprotocol=oracle dbalias=thin:@(description=(address=(host=es15.uits.indiana.edu)(protoc ol=tcp)(port=1521))(connect_data=(sid=PS2DEV)(SERVER=dedicated))) username=hre password=1234 connection-pool testOnBorrow=true testWhileIdle=true testOnReturn=true validationQuery=select 1 from dual / sequence-manager className=org.apache.ojb.broker.util.sequence.SequenceManagerNextValImp l / /jdbc-connection-descriptor !-- this connection was used as the default one within OJB jdbc-connection-descriptor jcd-alias=default default-connection=true platform=Oracle9i jdbc_level=2.0 driver=oracle.jdbc.OracleDriver protocol=jdbc subprotocol=oracle:thin dbalias=TK2DEV user_name=TK user_password=1234 batch-mode=false useAutoCommit=1 ignoreAutoCommitExceptions=false /jdbc-connection-descriptor -- I hope this is the info you asked for. Roman -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: Friday, November 19, 2004 10:48 To: OJB Users List Subject: Re: FW: Newbie Question : There was no default-PBKey specified Hi Roman, does OJB find your repository.xml file? Think we need more detailed info to help, so could you please post the whole stack trace and the connection declaration. regards, Armin Stark, Roman wrote: For the past tow days I tried to set up the ojb-blank project. Everything I try ends up with the following message: There was no default-PBKey specified I am using eclips 3 for the project following the instructions from the web site. All I have tried so far is just get a connection and run a very simple QueryByCriteria. I did set up the repository.xml files, of which there are 3 plus repository.xml. The database xml has a simple jdbc-connection-descriptor in it and that's all, and the default-connection=true; I really am at a loss, any suggestions would be great on this. I don't even know where to look anymore for what set up could cause this problem. Thanks Roman - 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: FW: Newbie Question : There was no default-PBKey specified
Did you modify the repository.xml file? Are all sub-files included? The xml ENTITY reference + xyz declaration. regards, Armin Stark, Roman wrote: I am assuming so. All the xml files are in src/resources and if I move repository.xml to the root I get an error that it can't find the repository file. So I think it can find it. Stack trace: There was no default-PBKey specified org.apache.ojb.broker.PBFactoryException: There was no default-PBKey specified at org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersi stenceBroker(Unknown Source) at org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker( Unknown Source) at TestDriver.run(TestDriver.java:61) at TestDriver.main(TestDriver.java:35) Connection declaration from repository_datbase.xml (both versions, same result) jdbc-connection-descriptor jcd-alias=HREDB default-connection=true platform=Oracle jdbc-level=3.0 batch-mode=true useAutoCommit=0 ignoreAutoCommitExceptions=false driver=oracle.jdbc.driver.OracleDriver protocol=jdbc subprotocol=oracle dbalias=thin:@(description=(address=(host=es15.uits.indiana.edu)(protoc ol=tcp)(port=1521))(connect_data=(sid=PS2DEV)(SERVER=dedicated))) username=hre password=1234 connection-pool testOnBorrow=true testWhileIdle=true testOnReturn=true validationQuery=select 1 from dual / sequence-manager className=org.apache.ojb.broker.util.sequence.SequenceManagerNextValImp l / /jdbc-connection-descriptor !-- this connection was used as the default one within OJB jdbc-connection-descriptor jcd-alias=default default-connection=true platform=Oracle9i jdbc_level=2.0 driver=oracle.jdbc.OracleDriver protocol=jdbc subprotocol=oracle:thin dbalias=TK2DEV user_name=TK user_password=1234 batch-mode=false useAutoCommit=1 ignoreAutoCommitExceptions=false /jdbc-connection-descriptor -- I hope this is the info you asked for. Roman -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: Friday, November 19, 2004 10:48 To: OJB Users List Subject: Re: FW: Newbie Question : There was no default-PBKey specified Hi Roman, does OJB find your repository.xml file? Think we need more detailed info to help, so could you please post the whole stack trace and the connection declaration. regards, Armin Stark, Roman wrote: For the past tow days I tried to set up the ojb-blank project. Everything I try ends up with the following message: There was no default-PBKey specified I am using eclips 3 for the project following the instructions from the web site. All I have tried so far is just get a connection and run a very simple QueryByCriteria. I did set up the repository.xml files, of which there are 3 plus repository.xml. The database xml has a simple jdbc-connection-descriptor in it and that's all, and the default-connection=true; I really am at a loss, any suggestions would be great on this. I don't even know where to look anymore for what set up could cause this problem. Thanks Roman - 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: FW: Newbie Question : There was no default-PBKey specified
Yep. I didn't touch the repository.xml. !DOCTYPE descriptor-repository PUBLIC -//Apache Software Foundation//DTD OJB Repository//EN repository.dtd [ !ENTITY database SYSTEM repository_database.xml !ENTITY internal SYSTEM repository_internal.xml !ENTITY user SYSTEM repository_user.xml ] descriptor-repository version=1.0 isolation-level=read-uncommitted proxy-prefetching-limit=50 !-- include all used database connections -- database; !-- include ojb internal mappings here; comment this if you don't need them -- internal; !-- include user defined mappings here -- user; /descriptor-repository I think the problem is how I run the application. Thomas Dudziak's post I think made that clear. I just assumed I can use eclps to run it, but this may not be true. I need to figure out how to get this to execute from the corect location. I am not sure if that can be done in eclips or if I have to run from the comand line. Roman Post by Thomas: The usual reason for this is that the repository.xml was not found and OJB started in the un-configured mode (which btw is intended for when you want to setup OJB programmatically). You should get a warning about this in the log file (if you configured e.g. logging to use Log4j) or console. Also be aware that with standard ojb-blank, you've got to start the application in the build/resources directory, not in the project's root folder (see the Getting Started doc at http://db.apache.org/ojb/docu/getting-started.html for details). -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: Friday, November 19, 2004 11:19 To: OJB Users List Subject: Re: FW: Newbie Question : There was no default-PBKey specified Did you modify the repository.xml file? Are all sub-files included? The xml ENTITY reference + xyz declaration. regards, Armin Stark, Roman wrote: I am assuming so. All the xml files are in src/resources and if I move repository.xml to the root I get an error that it can't find the repository file. So I think it can find it. Stack trace: There was no default-PBKey specified org.apache.ojb.broker.PBFactoryException: There was no default-PBKey specified at org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPer si stenceBroker(Unknown Source) at org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroke r( Unknown Source) at TestDriver.run(TestDriver.java:61) at TestDriver.main(TestDriver.java:35) Connection declaration from repository_datbase.xml (both versions, same result) jdbc-connection-descriptor jcd-alias=HREDB default-connection=true platform=Oracle jdbc-level=3.0 batch-mode=true useAutoCommit=0 ignoreAutoCommitExceptions=false driver=oracle.jdbc.driver.OracleDriver protocol=jdbc subprotocol=oracle dbalias=thin:@(description=(address=(host=es15.uits.indiana.edu)(prot oc ol=tcp)(port=1521))(connect_data=(sid=PS2DEV)(SERVER=dedicated))) username=hre password=1234 connection-pool testOnBorrow=true testWhileIdle=true testOnReturn=true validationQuery=select 1 from dual / sequence-manager className=org.apache.ojb.broker.util.sequence.SequenceManagerNextValI mp l / /jdbc-connection-descriptor !-- this connection was used as the default one within OJB jdbc-connection-descriptor jcd-alias=default default-connection=true platform=Oracle9i jdbc_level=2.0 driver=oracle.jdbc.OracleDriver protocol=jdbc subprotocol=oracle:thin dbalias=TK2DEV user_name=TK user_password=1234 batch-mode=false useAutoCommit=1 ignoreAutoCommitExceptions=false /jdbc-connection-descriptor -- I hope this is the info you asked for. Roman -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: Friday, November 19, 2004 10:48 To: OJB Users List Subject: Re: FW: Newbie Question : There was no default-PBKey specified Hi Roman, does OJB find your repository.xml file? Think we need more detailed info to help, so could you please post the whole stack trace and the connection declaration. regards, Armin Stark, Roman wrote: For the past tow days I tried to set up the ojb-blank project. Everything I try ends up with the following message: There was no default-PBKey specified I am using eclips 3 for the project following the instructions from the web site. All I have tried so far is just get a connection and run a very simple
Re: FW: Newbie Question : There was no default-PBKey specified
Can you please modify your mailer so it doesn't request return receipts? Thank you, Pulat Stark, Roman wrote: For the past tow days I tried to set up the ojb-blank project. Everything I try ends up with the following message: There was no default-PBKey specified I am using eclips 3 for the project following the instructions from the web site. All I have tried so far is just get a connection and run a very simple QueryByCriteria. I did set up the repository.xml files, of which there are 3 plus repository.xml. The database xml has a simple jdbc-connection-descriptor in it and that's all, and the default-connection=true; I really am at a loss, any suggestions would be great on this. I don't even know where to look anymore for what set up could cause this problem. Thanks Roman - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FW: Newbie Question : There was no default-PBKey specified
Stark, Roman wrote: I think the problem is how I run the application. Thomas Dudziak's post I think made that clear. I just assumed I can use eclps to run it, but this may not be true. I need to figure out how to get this to execute from the corect location. I am not sure if that can be done in eclips or if I have to run from the comand line. In Eclipse you can specify where Eclipse starts the application: Run or Debug dialog (Create, manage and run configurations), Arguments tab, Working directory. Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: FW: Newbie Question : There was no default-PBKey specified
Return Receipt Your RE: FW: Newbie Question : There was no default-PBKey documen specified t: was Lasse Lambrecht/IS-LF1/Allianz-Leben receive d by: at: 19.11.2004 19:37:55
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]
which tuto to start with ? was (Re: [newbie] ojb build failed on MacOS X.3.5)
Le 16 sept. 04, à 21:14, Thomas Dudziak a écrit : The beginner's tutorial on the OJB website uses this to introduce you to OJB. Is somewhere a specific link to this tuto ? because i've found : A full featured ODMG 3.0 compliant API. (See the ODMG Tutorial for an introduction.) See JDO tutorial for an introduction to the JDO programming model See OTM tutorial for details See the Persistence Broker Tutorial for details because i've used hsqldb, i would start with the last one (?) is-it the right choice for a beginner ? which one make use of ojb-blank.jar which contains a blank OJB project to play around with ? thanks again Yvon PGP.sig Description: =?ISO-8859-1?Q?Ceci_est_une_signature_=E9lectronique_PGP?=
Re: which tuto to start with ? was (Re: [newbie] ojb build failed on MacOS X.3.5)
Yvon Thoraval wrote: Is somewhere a specific link to this tuto ? It's the very first one on the site, called Getting started. You can find it here: http://db.apache.org/ojb/docu/getting-started.html Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: which tuto to start with ? was (Re: [newbie] ojb build failed on MacOS X.3.5)
Le 17 sept. 04, à 09:07, Thomas Dudziak a écrit : It's the very first one on the site, called Getting started. You can find it here: http://db.apache.org/ojb/docu/getting-started.html fine, tanxs °;)) Yvon PGP.sig Description: =?ISO-8859-1?Q?Ceci_est_une_signature_=E9lectronique_PGP?=
[newbie] ojb build failed on MacOS X.3.5
Hey all, new to ojb, i do have some experience with hsqldb and plan to migrate from sql to oql. then i wanted to follow the quickstart at your web site and install db-ojb-1.0.rc2. however i get stuck here about this error message after a : nord-2-81-57-96-20:~/Desktop/db-ojb-1.0.rc2> sh bin/build.sh raising this : preprocess: [echo] using switches: +JDK13, +JDBC30 oql: BUILD FAILED file:/Users/yvon/Desktop/db-ojb-1.0.rc2/build.xml:983: /Users/yvon/Desktop/db-ojb-1.0.rc2/src/java/org/apache/ojb/odmg/oql is not a valid directory the lines around 983 are : !-- == --> !-- build OQL Parser classes from oql-ojb.g grammar--> !-- == --> target name=oql depends=init description=Builds OQL parser sources from ANTLR grammar file.> java fork=yes classname=antlr.Tool dir=${src.java}/org/apache/ojb/odmg/oql taskname=build oql parser failonerror=true > -THIS ONE classpath refid=compilation-classpath/> arg value=oql-ojb.g /> /java> /target> i should say i had to make a mkdir -p src/java/org/apache/ojb/odmg/oql into ojb home from a previous error message. the perms are the following drwxrwxrwx for the whole src and sub dir. in case you could help jumping from this black hole °;)) Yvon PGP.sig Description: =?ISO-8859-1?Q?Ceci_est_une_signature_=E9lectronique_PGP?=
junit: BUILD SUCCESSFUL was (Re: [newbie] ojb build failed on MacOS X.3.5)
Le 16 sept. 04, à 21:14, Thomas Dudziak a écrit : If you're about to quickstart with OJB, it would be best if you start with the newest stable version which is 1.0.1 (rc2 is quite old btw). Also, with this version you should not need to build OJB from source. Simply download the bin version (with dependencies) from the OJB website. Also helpful is the ojb-blank.jar which contains a blank OJB project to play around with. The beginner's tutorial on the OJB website uses this to introduce you to OJB. i'll dl that version asap This might come from a number of things, e.g. problems when unpacking the dist. What Ant version are you using ? You should use a 1.6 version (current is 1.6.2 if I'm not mistaken). i've the probs : mkdir OJB in db-ojb home and then found j2ee.jar from j2sdkee1.3.1 thanks 4 u'r help °;)) Yvon PGP.sig Description: =?ISO-8859-1?Q?Ceci_est_une_signature_=E9lectronique_PGP?=
Using Inner Class Collection types (Newbie asking for help)
Hi, I wonder if anyone can help me with this. I have some code which uses inner class collections because they seem to be an 'easy' way to implement bi-directional links. This means that I can write; theFoo.tobar.set(theBar); // and then Collection foos = theBar.toFoo.CopySet(); // will contain 'theFoo' // or theBar.toFoo.add( theFoo2); // and theBar == theFoo2.toBar.get(); // will now be true I have included the class definitions for foo and bar below. I've omitted the link superclasses for brevity but if anyone wants a look at them just e-mail me. These are just simple example implementation classes and I hope to use these as templates to generate 2 way links from a datamodel xml schema or xmi model. My questions are; 1. Is there an easier way of implementing bi-directional links with OJB. 2. I have seen bi-directional links mentioned in discussions of JDO 2. Will JDO 2 have a standard way of doing this ? 3. (And most important). How can I produce Xdoclet annotations or a repository.xml to enable the fields 'toFoo' or 'ToBar' below to be mapped properly in OJB. I'd be very grateful to anyone who can provide me with some pointers of how to proceed. Many Thanks Martin Easterbrook public class foo extends Element { /* * Create an inner class which can return the reverse 'to many' association * and returns the link data for the association from any object of type 'foo'. */ protected static final class tobarFieldAccessor implements ToOneFieldAccessor { public ToManyFieldAccessor getInverseToManyFieldAccessor() { return bar.tofooAssociation; } public ToOneLinkData getToOneLinkData(Element e) { return ((foo)e).tobar ; } } /* * Create an inner class which 'types' the 'get' and 'set' operations. */ public static final class ToOneBarLinkData extends ToOneLinkData { public ToOneBarLinkData(Element owner, ToOneFieldAccessor p_toOneFieldAccessor ) { super( owner, p_toOneFieldAccessor); } public void set( bar b) { super.setElement( b ); } public bar get() { return ( bar) super.getElement() ;} } /* * create a static instance of the 'to one' association which can be accessed * by the 'to many' at the other end. */ protected static final ToOneFieldAccessor tobarAssociation = new tobarFieldAccessor(); /* * create an instance of the 'to one' association data for each instance of the class */ public final ToOneBarLinkData tobar = new ToOneBarLinkData(this,tobarAssociation); public foo(String p_name) { super(p_name); } } // public class bar extends Element { /* * Create an inner class which can return the reverse 'to one' association * and returns the link data for the association from any object of type 'bar'. */ protected static final class toFooFieldProvider implements ToManyFieldAccessor { public ToOneFieldAccessor getInverseToOneFieldAccessor() { return foo.tobarAssociation; } public ToManyLinkData getToManyLinkData(Element e) { return ((bar)e).toFoo ; } } /* * Create an inner class which 'types' the 'add' and 'remove' operations. */ public static final class ToManyFooLinkData extends ToManyLinkData { public ToManyFooLinkData(Element owner, ToManyFieldAccessor p_toManyFieldAccessor) { super( owner , p_toManyFieldAccessor); } public void add(foo e){ super.addElement( e ) ;} public void remove(foo e) { super.removeElement( e ) ;} } /* * create a static instance of the 'to many' association which can be accessed * by the 'to one' at the other end. */ protected static ToManyFieldAccessor tofooAssociation = new toFooFieldProvider(); /* * create an instance of the 'to many' association data for each instance of the class */ public final ToManyFooLinkData toFoo = new ToManyFooLinkData(this,tofooAssociation); public bar(String p_name) { super(p_name); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
newbie: using timestamp in criteria, compound primary key
I am trying to limit a select from a logtable to the last so many days worth of entries, but I get a class cast exception. Other criteria on same table work OK, so I'm sure most of the setup is good. Am I missing something really obvious? Is there an example available for querying by timestamp? As a second question, the underlying database table has a compound primary key across (log_time, ipm_session, command) .. how should that be mapped in repository.xml? Criteria criteria = new Criteria(); java.sql.Timestamp t = new Timestamp(System.currentTimeMillis() - (nDays * 24 * 60 * 60 * 1000)); log.info(adding criteria greater than log_time + t.toString()); criteria.addGreaterThanField(log_time, t); // criteria.addEqualTo(remote_FQDN, SU6878); // criteria.addOrderByDescending(log_time); Query query = QueryFactory.newQuery(IpmLogDTO.class, criteria); query.setStartAtIndex(1); broker = PersistenceBrokerFactory.defaultPersistenceBroker(); //ServiceLocator.getInstance().findBroker(); log.info(calling getCollectionByQuery); results = (Collection) broker.getCollectionByQuery(query); public class IpmLogDTO extends DataTransferObject { /* ipm_log table is * Name Null?Type - LOG_TIME NOT NULL TIMESTAMP(3) IPM_SESSION NOT NULL NUMBER(10) LOCAL_HOSTNOT NULL VARCHAR2(48) REMOTE_HOST NOT NULL VARCHAR2(48) REMOTE_FQDN NOT NULL VARCHAR2(48) USER_NAME NOT NULL VARCHAR2(48) COMMAND NOT NULL NUMBER(3) PROCESSES NOT NULL NUMBER(4) SUBGROUP_ABREV VARCHAR2(2) SITEID NUMBER(3) RECTYPENUMBER(3) MAXBACKNUMBER(10) LATEST NUMBER(10) SEARCH_TIMEDATE RECORDSNUMBER(7) ELAPSED_SECNUMBER(7,3) RECORDS_SECNUMBER(7,1) KBYTES_SEC NUMBER(7,1) */ public Timestamp logTime; public int ipmSession; public String localHost; public String remoteHost; public String remoteFQDN; ... class-descriptor class=com.vaisala.ice.vmdbReport.view.IpmLogDTO table=ipm_log !--n.b. primary key is actually (log_time, ipm_session, command), not sure how to handle that in repository.xml -- field-descriptor name=logTime column=log_time primarykey=true jdbc-type=TIMESTAMP/ field-descriptor name=ipmSession column=ipm_session jdbc-type=INTEGER/ field-descriptor name=localHost column=local_Host jdbc-type=VARCHAR/ field-descriptor name=remoteHost column=remote_Host jdbc-type=VARCHAR/
Re: newbie: using timestamp in criteria, compound primary key
[EMAIL PROTECTED] wrote: I am trying to limit a select from a logtable to the last so many days worth of entries, but I get a class cast exception. Other criteria on same table work OK, so I'm sure most of the setup is good. Am I missing something really obvious? Is there an example available for querying by timestamp? Can you post the exception ? Also, what version of OJB do you use ? As a second question, the underlying database table has a compound primary key across (log_time, ipm_session, command) .. how should that be mapped in repository.xml? I'm not sure, but I think you can define compound primary keys by using the primarykey attribute for each field that is part of the primary key (and similarily in the database). Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: newbie: using timestamp in criteria, compound primary key
oops, here is the output exception. Using OJB 1.0rc7 stable INFO: adding criteria greater than log_time 2004-07-14 12:26:52.578 16-Jul-2004 12:26:53 com.vaisala.ice.vmdbReport.view.IpmLogDAO getRecentActivity INFO: calling getCollectionByQuery 04/07/16 12:26:53 java.lang.ClassCastException 04/07/16 12:26:53 at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.buildJoinTree(Unknow n Source) 04/07/16 12:26:53 at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.splitCriteria(Unknow n Source) 04/07/16 12:26:53 at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.init(Unknown Source) 04/07/16 12:26:53 at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.init(Unknown Source) 04/07/16 12:26:53 at org.apache.ojb.broker.accesslayer.sql.SqlSelectStatement.init(Unknown Source) 04/07/16 12:26:53 at org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl.getPreparedSel ectStatement(Unknown Source) 04/07/16 12:26:53 at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown Source) 04/07/16 12:26:53 at org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(Unknown Source) 04/07/16 12:26:53 at org.apache.ojb.broker.accesslayer.RsIterator.init(Unknown Source) 04/07/16 12:26:53at org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(Unknown Source) 04/07/16 12:26:53 at org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(Unkn own Source) 04/07/16 12:26:53 at org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Unknow n Source) 04/07/16 12:26:53 at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown Source) 04/07/16 12:26:53 at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown Source) 04/07/16 12:26:53 at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown Source) 04/07/16 12:26:53 at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknow n Source) 04/07/16 12:26:53 at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery( Unknown Source) 04/07/16 12:26:53 at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery( Unknown Source) 04/07/16 12:26:53 at com.vaisala.ice.vmdbReport.view.IpmLogDAO.getRecentActivity(IpmLogDAO.java:1 45) 04/07/16 12:26:53 at com.vaisala.ice.vmdbReport.view.IpmReportAction.execute(IpmReportAction.java :48) 04/07/16 12:26:53 at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProces sor.java:484) 04/07/16 12:26:53 at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) 04/07/16 12:26:53 at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) 04/07/16 12:26:53 at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) 04/07/16 12:26:53 at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) 04/07/16 12:26:53at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) 04/07/16 12:26:53at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.ja va:65) 04/07/16 12:26:53at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source) 04/07/16 12:26:53at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispa tcher.java:604) 04/07/16 12:26:53 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletReq uestDispatcher.java:317) 04/07/16 12:26:53 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandle r.java:790) 04/07/16 12:26:53 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270) 04/07/16 12:26:53 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112) 04/07/16 12:26:53 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableRe sourcePooledExecutor.java:192) 04/07/16 12:26:53at java.lang.Thread.run(Thread.java:536) 04/07/16 12:26:53 Data Access Exception com.vaisala.ice.common.dataAccess.DataAccessException: org.apache.ojb.broker.PersistenceBrokerException -Original Message- From: Thomas Dudziak [mailto:[EMAIL PROTECTED] Sent: 16 July 2004 13:07 To: OJB Users List Subject: Re: newbie: using timestamp in criteria, compound primary key [EMAIL PROTECTED] wrote: I am trying to limit a select from a logtable to the last so many days worth of entries, but I get a class cast exception. Other criteria on same table work OK, so I'm sure most of the setup is good. Am I missing something really obvious? Is there an example available for querying by timestamp? Can you post the exception ? Also, what version of OJB do you use ? As a second question, the underlying database table has a compound primary key across (log_time, ipm_session, command) .. how should that be mapped in repository.xml? I'm not sure, but I think you can
Re: newbie: using timestamp in criteria, compound primary key
[EMAIL PROTECTED] wrote: oops, here is the output exception. Using OJB 1.0rc7 stable INFO: adding criteria greater than log_time 2004-07-14 12:26:52.578 16-Jul-2004 12:26:53 com.vaisala.ice.vmdbReport.view.IpmLogDAO getRecentActivity INFO: calling getCollectionByQuery 04/07/16 12:26:53 java.lang.ClassCastException 04/07/16 12:26:53 at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.buildJoinTree(Unknow n Source) 04/07/16 12:26:53 at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.splitCriteria(Unknow n Source) 04/07/16 12:26:53 at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.init(Unknown Source) 04/07/16 12:26:53 at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.init(Unknown Source) 04/07/16 12:26:53 at org.apache.ojb.broker.accesslayer.sql.SqlSelectStatement.init(Unknown Source) 04/07/16 12:26:53 at org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl.getPreparedSel ectStatement(Unknown Source) 04/07/16 12:26:53 at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown Source) 04/07/16 12:26:53 at org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(Unknown Source) 04/07/16 12:26:53 at org.apache.ojb.broker.accesslayer.RsIterator.init(Unknown Source) 04/07/16 12:26:53 at org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(Unknown Source) 04/07/16 12:26:53 at org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(Unkn own Source) 04/07/16 12:26:53 at org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Unknow n Source) 04/07/16 12:26:53 at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown Source) 04/07/16 12:26:53 at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown Source) 04/07/16 12:26:53 at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown Source) 04/07/16 12:26:53 at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknow n Source) 04/07/16 12:26:53 at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery( Unknown Source) 04/07/16 12:26:53 at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery( Unknown Source) 04/07/16 12:26:53 at com.vaisala.ice.vmdbReport.view.IpmLogDAO.getRecentActivity(IpmLogDAO.java:1 45) 04/07/16 12:26:53 at com.vaisala.ice.vmdbReport.view.IpmReportAction.execute(IpmReportAction.java :48) 04/07/16 12:26:53 at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProces sor.java:484) 04/07/16 12:26:53 at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) 04/07/16 12:26:53 at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) 04/07/16 12:26:53 at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) 04/07/16 12:26:53 at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) 04/07/16 12:26:53 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) 04/07/16 12:26:53 at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.ja va:65) 04/07/16 12:26:53 at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source) 04/07/16 12:26:53 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispa tcher.java:604) 04/07/16 12:26:53 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletReq uestDispatcher.java:317) 04/07/16 12:26:53 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandle r.java:790) 04/07/16 12:26:53 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270) 04/07/16 12:26:53 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112) 04/07/16 12:26:53 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableRe sourcePooledExecutor.java:192) 04/07/16 12:26:53 at java.lang.Thread.run(Thread.java:536) 04/07/16 12:26:53 Data Access Exception com.vaisala.ice.common.dataAccess.DataAccessException: org.apache.ojb.broker.PersistenceBrokerException Hmm, I'm no expert on the query building but it looks like your timestamp object is expected to be something different somewhere in the query building. Could you try the 1.0 final ? If its not working there either, then you should report a bug (via Scarab on OJB's website) to get it fixed quickly. Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: newbie: using timestamp in criteria, compound primary key
[EMAIL PROTECTED] wrote: very similar results using 1.0.0 final: (I really should read mails more thouroughly :-) ) The problem seems to be that you used the wrong method on the criteria object: criteria.addGreaterThanField(log_time, t); This method is intended to be used when comparing *with* a field, thus the query building will assume that the second argument denotes a field (i.e. its a string containing the field name). Instead use criteria.addGreaterThan(log_time, t); and you should be fine. Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: newbie: using timestamp in criteria, compound primary key
excellent, works a treat now, many thanks ! -Original Message- From: Thomas Dudziak [mailto:[EMAIL PROTECTED] Sent: 16 July 2004 14:33 To: OJB Users List Subject: Re: newbie: using timestamp in criteria, compound primary key [EMAIL PROTECTED] wrote: very similar results using 1.0.0 final: (I really should read mails more thouroughly :-) ) The problem seems to be that you used the wrong method on the criteria object: criteria.addGreaterThanField(log_time, t); This method is intended to be used when comparing *with* a field, thus the query building will assume that the second argument denotes a field (i.e. its a string containing the field name). Instead use criteria.addGreaterThan(log_time, t); and you should be fine. Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
updating collections (newbie)
Hello, I just started using OJB and following question arised. Is there a way of updating referenced Collection without querying item objects from database? Example: User object hava Collection of Role objects attribute. All aplicable Role objects are already stored in database. Some view returns index values pointing to Role objects. What to do before storing User object: -Does broker have to retrieve appropriate Collection corresponding to index values and then set user.roles attribute with this collection? -Or can I just create collection of blank Role objects, setting each of them with appropriate index and setting Roles attribute of User object with this collection? Or perhaps there is another (better) possibility which I haven't noticed yet? Best regards, BJ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie needs help with OJB in Eclipse
Hi Doug, This seems like a problem with your build classpath settings in eclipse. Try to load OJB from CVS HEAD with eclipse. In CVS we have the eclipse .project and .claspath files that eclipse needs to build OJB. Thomas Doug Poland wrote: Hello, I'm trying to learn OJB but am struggling getting a simple project to run in Eclipse 2.1.3. I found what appears to be a good tutorial entitled... Object-Relational Mapping with Apache Jakarta OJB by Charles Chan (http://www.onjava.com/lpt/a/2946) dated: 01/08/2003 I've built the clases and the project compiles. The error I cannot get past is... Property for key 'PersistenceBrokerFactoryClass' can not be found in properties file. As an FYI, I've successfully built the OJB rc6 from source. I can also run the tuturial shell scripts in bin. Here's how my Eclipse project is layed out... ./.classpath ./.project ./OJB.properties ./build.properties ./repository.dtd ./repository.xml ./repository_internal.xml ./repository_user.xml ./com/omni/doug/ojb/lib/ant.jar ./com/omni/doug/ojb/lib/antlr.debug.jar ./com/omni/doug/ojb/lib/antlr.jar ./com/omni/doug/ojb/lib/antlr_compiletime.jar ./com/omni/doug/ojb/lib/commons-beanutils.jar ./com/omni/doug/ojb/lib/commons-collections.jar ./com/omni/doug/ojb/lib/commons-dbcp-1.1.jar ./com/omni/doug/ojb/lib/commons-lang-2.0.jar ./com/omni/doug/ojb/lib/commons-logging.jar ./com/omni/doug/ojb/lib/commons-pool-1.1.jar ./com/omni/doug/ojb/lib/db-ojb-1.0.rc6.jar ./com/omni/doug/ojb/lib/hsqldb.jar ./com/omni/doug/ojb/lib/j2ee.jar ./com/omni/doug/ojb/lib/jakarta-regexp-1.3.jar ./com/omni/doug/ojb/lib/jcs.jar ./com/omni/doug/ojb/lib/jdo.jar ./com/omni/doug/ojb/lib/junit.jar ./com/omni/doug/ojb/lib/log4j-1.2.8.jar ./com/omni/doug/ojb/lib/mysql-connector-java-3.0.7-stable-bin.jar ./com/omni/doug/ojb/lib/optional.jar ./com/omni/doug/ojb/lib/p6spy.jar ./com/omni/doug/ojb/lib/prevayler.jar ./com/omni/doug/ojb/lib/torque-3.0.2.jar ./com/omni/doug/ojb/lib/velocity-1.3.1.jar ./com/omni/doug/ojb/lib/xalan.jar ./com/omni/doug/ojb/lib/xdoclet-1.2b3-dev.jar ./com/omni/doug/ojb/lib/xdoclet-ojb-module-1.2b3-dev.jar ./com/omni/doug/ojb/lib/xercesImpl.jar ./com/omni/doug/ojb/lib/xjavadoc-1.0.jar ./com/omni/doug/ojb/lib/xml-apis.jar ./com/omni/doug/ojb/onlamp/BasePersistenceObjectImpl.class ./com/omni/doug/ojb/onlamp/BasePersistenceObjectImpl.java ./com/omni/doug/ojb/onlamp/Employee.class ./com/omni/doug/ojb/onlamp/Employee.java ./com/omni/doug/ojb/onlamp/EmployeeImpl.class ./com/omni/doug/ojb/onlamp/EmployeeImpl.java ./com/omni/doug/ojb/onlamp/EmployeeTest.class ./com/omni/doug/ojb/onlamp/EmployeeTest.java ./com/omni/doug/ojb/onlamp/Manager.class ./com/omni/doug/ojb/onlamp/Manager.java ./com/omni/doug/ojb/onlamp/ManagerImpl.class ./com/omni/doug/ojb/onlamp/ManagerImpl.java ./com/omni/doug/ojb/onlamp/OJBPersistenceManager.class ./com/omni/doug/ojb/onlamp/OJBPersistenceManager.java ./com/omni/doug/ojb/onlamp/OJBTransaction.class ./com/omni/doug/ojb/onlamp/OJBTransaction.java ./com/omni/doug/ojb/onlamp/PersistenceManager.class ./com/omni/doug/ojb/onlamp/PersistenceManager.java ./com/omni/doug/ojb/onlamp/Transaction.class ./com/omni/doug/ojb/onlamp/Transaction.java If it helps, here's the console output from a debug session... [BOOT] WARN: Value ojb.broker.cache.ObjectCacheDefaultImpl is illegal for key ObjectCacheClass (should be a class, using default value class org.apache.ojb.broker.cache.ObjectCacheDefaultImpl) [BOOT] WARN: Value ojb.broker.accesslayer.ConnectionFactoryDefaultImpl is illegal for key ConnectionFactoryClass (should be a class, using default value class org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl) [BOOT] WARN: Value ojb.odmg.locking.LockManagerDefaultImpl is illegal for key LockManagerClass (should be a class, using default value class org.apache.ojb.odmg.locking.LockManagerDefaultImpl) [BOOT] WARN: Value ojb.odmg.locking.InMemoryLockMapImpl is illegal for key LockMapClass (should be a class, using default value class org.apache.ojb.odmg.locking.InMemoryLockMapImpl) [BOOT] WARN: Value ojb.broker.util.logging.PoorMansLoggerImpl is illegal for key LoggerClass (should be a class, using default value class org.apache.ojb.broker.util.logging.PoorMansLoggerImpl) [BOOT] WARN: Value ojb.broker.metadata.PersistentFieldPropertyImpl is illegal for key PersistentFieldClass (should be a class, using default value class org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectAccessImpl) [BOOT] WARN: Value ojb.broker.singlevm.PersistenceBrokerImpl is illegal for key PersistenceBrokerClass (should be a class, using default value class org.apache.ojb.broker.core.PersistenceBrokerImpl) [BOOT] WARN: Value ojb.odmg.collections.DListImpl is illegal for key OqlCollectionClass (should be a class, using default value class org.apache.ojb.odmg.collections.DListImpl) [BOOT] WARN: Value ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl is illegal for key PersistenceBrokerFactoryClass (should be a class,
Re: JDO and OJB newbie Question
Use ANT. Using ANT to build OJB should work without problems on any platform. Thomas Charles N. Harvey III wrote: I'm having a lot of trouble building from HEAD. Do I use maven or ant? I get the STRANGEST error when I try to use ant. Its probably something with my maven/ant installation though. Ok, so, I'm getting there. I'm starting to understand JDO a bit. I hadn't actually looked at it before today. I have some questions: 1) TransactionImpl Where should I use it? Should I use TransactionImpl over jdo's Transaction? More importantly, when I do use it, where do I get these two classes to pass to the TransactionImpl's constructor: org.apache.ojb.otm.OTMKit org.apache.ojb.otm.OTMConnection I see where they are, sure, but what are they for? 2) Should I be trying to do all of my coding based off of otm instead of jdo or previously, broker? 3) PersistenceManagerFactoryImpl I can create a properties file, possibly, jdo.properties and set all those properties and then use that. That gets around the cheat that is used in all the test cases correct? A lot of these properties (username, password, url) are in the repository.xml so should I be re-setting them in jdo.properties or no? 4) What is swizzle? Thanks a lot. Charlie Brian McCallister wrote: You will need CVS HEAD, correct -- also make sure you are comfy looking around the sources to see what is implemented and not. I have tried to throw OperationUnsupportedException(Not yet imeplemented!) when a feature isn't actually implemented yet =) This code is being actively written so it may be in states of flux at times as well, but I make sure all the unit tests pass before checking anything in. Also, you will need to either figure out the properties used to get ahold of the correct PersistenceManagerFactory, or just use the org.apache.ojb.jdo.PersistenceManagerFactoryImpl directly. I haven't spent any time making the discovery element work, nor testing the code Matt wrote -- it may or may not work. Let me know anything odd/etc you find, please! -Brian On Apr 14, 2004, at 9:51 AM, Charles N. Harvey III wrote: Brian, I _don't_ want to filter my queries. Can I give the native implementation a try? Would that be the CVS Head or would it be a different branch? Thanks. Charlie Brian McCallister wrote: You need both if you are using the JDORI plugin. It is annoying =( The native JDO impl I am working on for OJB will allow you to just use the OJB mappings as the .jdo files will only be used for (optional in OJB but not for spec-compliant JDO) bytecode enhancement process. This JDO impl is *far* from ready for use yet (well, actually it works great as long as you don't want to filter your queries as JDOQL isn't implemented yet). -Brian On Apr 14, 2004, at 8:06 AM, Nicolas Arni-Bloch wrote: Hi all, I want to try JDO with OJB but I have some misunderstood. I am not very clear about where to put the MetaData for the mapping ? In the repository.xml or in the XXX.jdo ? I look in the tutorial5 and I see that information for the mapping are stored in the Product.jdo. So should we put this information in the .jdo and in the repository.xml ? My second question is : with the JDO should we use the ManageableCollection interface for the collection or not. I have try the jdo implementation with a single class and its work. But I try with 1..n relation and it doesn't ? Is some body as code example for using JDO with OJB ? Nicolas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JDO and OJB newbie Question
I'm having a lot of trouble building from HEAD. Do I use maven or ant? I get the STRANGEST error when I try to use ant. Its probably something with my maven/ant installation though. Ok, so, I'm getting there. I'm starting to understand JDO a bit. I hadn't actually looked at it before today. I have some questions: 1) TransactionImpl Where should I use it? Should I use TransactionImpl over jdo's Transaction? More importantly, when I do use it, where do I get these two classes to pass to the TransactionImpl's constructor: org.apache.ojb.otm.OTMKit org.apache.ojb.otm.OTMConnection I see where they are, sure, but what are they for? 2) Should I be trying to do all of my coding based off of otm instead of jdo or previously, broker? 3) PersistenceManagerFactoryImpl I can create a properties file, possibly, jdo.properties and set all those properties and then use that. That gets around the cheat that is used in all the test cases correct? A lot of these properties (username, password, url) are in the repository.xml so should I be re-setting them in jdo.properties or no? 4) What is swizzle? Thanks a lot. Charlie Brian McCallister wrote: You will need CVS HEAD, correct -- also make sure you are comfy looking around the sources to see what is implemented and not. I have tried to throw OperationUnsupportedException(Not yet imeplemented!) when a feature isn't actually implemented yet =) This code is being actively written so it may be in states of flux at times as well, but I make sure all the unit tests pass before checking anything in. Also, you will need to either figure out the properties used to get ahold of the correct PersistenceManagerFactory, or just use the org.apache.ojb.jdo.PersistenceManagerFactoryImpl directly. I haven't spent any time making the discovery element work, nor testing the code Matt wrote -- it may or may not work. Let me know anything odd/etc you find, please! -Brian On Apr 14, 2004, at 9:51 AM, Charles N. Harvey III wrote: Brian, I _don't_ want to filter my queries. Can I give the native implementation a try? Would that be the CVS Head or would it be a different branch? Thanks. Charlie Brian McCallister wrote: You need both if you are using the JDORI plugin. It is annoying =( The native JDO impl I am working on for OJB will allow you to just use the OJB mappings as the .jdo files will only be used for (optional in OJB but not for spec-compliant JDO) bytecode enhancement process. This JDO impl is *far* from ready for use yet (well, actually it works great as long as you don't want to filter your queries as JDOQL isn't implemented yet). -Brian On Apr 14, 2004, at 8:06 AM, Nicolas Arni-Bloch wrote: Hi all, I want to try JDO with OJB but I have some misunderstood. I am not very clear about where to put the MetaData for the mapping ? In the repository.xml or in the XXX.jdo ? I look in the tutorial5 and I see that information for the mapping are stored in the Product.jdo. So should we put this information in the .jdo and in the repository.xml ? My second question is : with the JDO should we use the ManageableCollection interface for the collection or not. I have try the jdo implementation with a single class and its work. But I try with 1..n relation and it doesn't ? Is some body as code example for using JDO with OJB ? Nicolas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie needs help with OJB in Eclipse
Hi Doug, seems like a classloader problem. Do you have different ojb-jar files (or source/classes + ojb-jar) in classpath? regards, Armin Doug Poland wrote: Hello, I'm trying to learn OJB but am struggling getting a simple project to run in Eclipse 2.1.3. I found what appears to be a good tutorial entitled... Object-Relational Mapping with Apache Jakarta OJB by Charles Chan (http://www.onjava.com/lpt/a/2946) dated: 01/08/2003 I've built the clases and the project compiles. The error I cannot get past is... Property for key 'PersistenceBrokerFactoryClass' can not be found in properties file. As an FYI, I've successfully built the OJB rc6 from source. I can also run the tuturial shell scripts in bin. Here's how my Eclipse project is layed out... ./.classpath ./.project ./OJB.properties ./build.properties ./repository.dtd ./repository.xml ./repository_internal.xml ./repository_user.xml ./com/omni/doug/ojb/lib/ant.jar ./com/omni/doug/ojb/lib/antlr.debug.jar ./com/omni/doug/ojb/lib/antlr.jar ./com/omni/doug/ojb/lib/antlr_compiletime.jar ./com/omni/doug/ojb/lib/commons-beanutils.jar ./com/omni/doug/ojb/lib/commons-collections.jar ./com/omni/doug/ojb/lib/commons-dbcp-1.1.jar ./com/omni/doug/ojb/lib/commons-lang-2.0.jar ./com/omni/doug/ojb/lib/commons-logging.jar ./com/omni/doug/ojb/lib/commons-pool-1.1.jar ./com/omni/doug/ojb/lib/db-ojb-1.0.rc6.jar ./com/omni/doug/ojb/lib/hsqldb.jar ./com/omni/doug/ojb/lib/j2ee.jar ./com/omni/doug/ojb/lib/jakarta-regexp-1.3.jar ./com/omni/doug/ojb/lib/jcs.jar ./com/omni/doug/ojb/lib/jdo.jar ./com/omni/doug/ojb/lib/junit.jar ./com/omni/doug/ojb/lib/log4j-1.2.8.jar ./com/omni/doug/ojb/lib/mysql-connector-java-3.0.7-stable-bin.jar ./com/omni/doug/ojb/lib/optional.jar ./com/omni/doug/ojb/lib/p6spy.jar ./com/omni/doug/ojb/lib/prevayler.jar ./com/omni/doug/ojb/lib/torque-3.0.2.jar ./com/omni/doug/ojb/lib/velocity-1.3.1.jar ./com/omni/doug/ojb/lib/xalan.jar ./com/omni/doug/ojb/lib/xdoclet-1.2b3-dev.jar ./com/omni/doug/ojb/lib/xdoclet-ojb-module-1.2b3-dev.jar ./com/omni/doug/ojb/lib/xercesImpl.jar ./com/omni/doug/ojb/lib/xjavadoc-1.0.jar ./com/omni/doug/ojb/lib/xml-apis.jar ./com/omni/doug/ojb/onlamp/BasePersistenceObjectImpl.class ./com/omni/doug/ojb/onlamp/BasePersistenceObjectImpl.java ./com/omni/doug/ojb/onlamp/Employee.class ./com/omni/doug/ojb/onlamp/Employee.java ./com/omni/doug/ojb/onlamp/EmployeeImpl.class ./com/omni/doug/ojb/onlamp/EmployeeImpl.java ./com/omni/doug/ojb/onlamp/EmployeeTest.class ./com/omni/doug/ojb/onlamp/EmployeeTest.java ./com/omni/doug/ojb/onlamp/Manager.class ./com/omni/doug/ojb/onlamp/Manager.java ./com/omni/doug/ojb/onlamp/ManagerImpl.class ./com/omni/doug/ojb/onlamp/ManagerImpl.java ./com/omni/doug/ojb/onlamp/OJBPersistenceManager.class ./com/omni/doug/ojb/onlamp/OJBPersistenceManager.java ./com/omni/doug/ojb/onlamp/OJBTransaction.class ./com/omni/doug/ojb/onlamp/OJBTransaction.java ./com/omni/doug/ojb/onlamp/PersistenceManager.class ./com/omni/doug/ojb/onlamp/PersistenceManager.java ./com/omni/doug/ojb/onlamp/Transaction.class ./com/omni/doug/ojb/onlamp/Transaction.java If it helps, here's the console output from a debug session... [BOOT] WARN: Value ojb.broker.cache.ObjectCacheDefaultImpl is illegal for key ObjectCacheClass (should be a class, using default value class org.apache.ojb.broker.cache.ObjectCacheDefaultImpl) [BOOT] WARN: Value ojb.broker.accesslayer.ConnectionFactoryDefaultImpl is illegal for key ConnectionFactoryClass (should be a class, using default value class org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl) [BOOT] WARN: Value ojb.odmg.locking.LockManagerDefaultImpl is illegal for key LockManagerClass (should be a class, using default value class org.apache.ojb.odmg.locking.LockManagerDefaultImpl) [BOOT] WARN: Value ojb.odmg.locking.InMemoryLockMapImpl is illegal for key LockMapClass (should be a class, using default value class org.apache.ojb.odmg.locking.InMemoryLockMapImpl) [BOOT] WARN: Value ojb.broker.util.logging.PoorMansLoggerImpl is illegal for key LoggerClass (should be a class, using default value class org.apache.ojb.broker.util.logging.PoorMansLoggerImpl) [BOOT] WARN: Value ojb.broker.metadata.PersistentFieldPropertyImpl is illegal for key PersistentFieldClass (should be a class, using default value class org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectAccessImpl) [BOOT] WARN: Value ojb.broker.singlevm.PersistenceBrokerImpl is illegal for key PersistenceBrokerClass (should be a class, using default value class org.apache.ojb.broker.core.PersistenceBrokerImpl) [BOOT] WARN: Value ojb.odmg.collections.DListImpl is illegal for key OqlCollectionClass (should be a class, using default value class org.apache.ojb.odmg.collections.DListImpl) [BOOT] WARN: Value ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl is illegal for key PersistenceBrokerFactoryClass (should be a class, using default value null) [BOOT] ERROR: Creation of PersistenceBrokerFactory (PBF)
JDO and OJB newbie Question
Hi all, I want to try JDO with OJB but I have some misunderstood. I am not very clear about where to put the MetaData for the mapping ? In the repository.xml or in the XXX.jdo ? I look in the tutorial5 and I see that information for the mapping are stored in the Product.jdo. So should we put this information in the .jdo and in the repository.xml ? My second question is : with the JDO should we use the ManageableCollection interface for the collection or not. I have try the jdo implementation with a single class and its work. But I try with 1..n relation and it doesn't ? Is some body as code example for using JDO with OJB ? Nicolas - 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: JDO and OJB newbie Question
You need both if you are using the JDORI plugin. It is annoying =( The native JDO impl I am working on for OJB will allow you to just use the OJB mappings as the .jdo files will only be used for (optional in OJB but not for spec-compliant JDO) bytecode enhancement process. This JDO impl is *far* from ready for use yet (well, actually it works great as long as you don't want to filter your queries as JDOQL isn't implemented yet). -Brian On Apr 14, 2004, at 8:06 AM, Nicolas Arni-Bloch wrote: Hi all, I want to try JDO with OJB but I have some misunderstood. I am not very clear about where to put the MetaData for the mapping ? In the repository.xml or in the XXX.jdo ? I look in the tutorial5 and I see that information for the mapping are stored in the Product.jdo. So should we put this information in the .jdo and in the repository.xml ? My second question is : with the JDO should we use the ManageableCollection interface for the collection or not. I have try the jdo implementation with a single class and its work. But I try with 1..n relation and it doesn't ? Is some body as code example for using JDO with OJB ? Nicolas - 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: JDO and OJB newbie Question
Brian, I _don't_ want to filter my queries. Can I give the native implementation a try? Would that be the CVS Head or would it be a different branch? Thanks. Charlie Brian McCallister wrote: You need both if you are using the JDORI plugin. It is annoying =( The native JDO impl I am working on for OJB will allow you to just use the OJB mappings as the .jdo files will only be used for (optional in OJB but not for spec-compliant JDO) bytecode enhancement process. This JDO impl is *far* from ready for use yet (well, actually it works great as long as you don't want to filter your queries as JDOQL isn't implemented yet). -Brian On Apr 14, 2004, at 8:06 AM, Nicolas Arni-Bloch wrote: Hi all, I want to try JDO with OJB but I have some misunderstood. I am not very clear about where to put the MetaData for the mapping ? In the repository.xml or in the XXX.jdo ? I look in the tutorial5 and I see that information for the mapping are stored in the Product.jdo. So should we put this information in the .jdo and in the repository.xml ? My second question is : with the JDO should we use the ManageableCollection interface for the collection or not. I have try the jdo implementation with a single class and its work. But I try with 1..n relation and it doesn't ? Is some body as code example for using JDO with OJB ? Nicolas - 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: JDO and OJB newbie Question
You will need CVS HEAD, correct -- also make sure you are comfy looking around the sources to see what is implemented and not. I have tried to throw OperationUnsupportedException(Not yet imeplemented!) when a feature isn't actually implemented yet =) This code is being actively written so it may be in states of flux at times as well, but I make sure all the unit tests pass before checking anything in. Also, you will need to either figure out the properties used to get ahold of the correct PersistenceManagerFactory, or just use the org.apache.ojb.jdo.PersistenceManagerFactoryImpl directly. I haven't spent any time making the discovery element work, nor testing the code Matt wrote -- it may or may not work. Let me know anything odd/etc you find, please! -Brian On Apr 14, 2004, at 9:51 AM, Charles N. Harvey III wrote: Brian, I _don't_ want to filter my queries. Can I give the native implementation a try? Would that be the CVS Head or would it be a different branch? Thanks. Charlie Brian McCallister wrote: You need both if you are using the JDORI plugin. It is annoying =( The native JDO impl I am working on for OJB will allow you to just use the OJB mappings as the .jdo files will only be used for (optional in OJB but not for spec-compliant JDO) bytecode enhancement process. This JDO impl is *far* from ready for use yet (well, actually it works great as long as you don't want to filter your queries as JDOQL isn't implemented yet). -Brian On Apr 14, 2004, at 8:06 AM, Nicolas Arni-Bloch wrote: Hi all, I want to try JDO with OJB but I have some misunderstood. I am not very clear about where to put the MetaData for the mapping ? In the repository.xml or in the XXX.jdo ? I look in the tutorial5 and I see that information for the mapping are stored in the Product.jdo. So should we put this information in the .jdo and in the repository.xml ? My second question is : with the JDO should we use the ManageableCollection interface for the collection or not. I have try the jdo implementation with a single class and its work. But I try with 1..n relation and it doesn't ? Is some body as code example for using JDO with OJB ? Nicolas - 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
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
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
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 : 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
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
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]
Newbie needs help with OJB in Eclipse
Hello, I'm trying to learn OJB but am struggling getting a simple project to run in Eclipse 2.1.3. I found what appears to be a good tutorial entitled... Object-Relational Mapping with Apache Jakarta OJB by Charles Chan (http://www.onjava.com/lpt/a/2946) dated: 01/08/2003 I've built the clases and the project compiles. The error I cannot get past is... Property for key 'PersistenceBrokerFactoryClass' can not be found in properties file. As an FYI, I've successfully built the OJB rc6 from source. I can also run the tuturial shell scripts in bin. Here's how my Eclipse project is layed out... ./.classpath ./.project ./OJB.properties ./build.properties ./repository.dtd ./repository.xml ./repository_internal.xml ./repository_user.xml ./com/omni/doug/ojb/lib/ant.jar ./com/omni/doug/ojb/lib/antlr.debug.jar ./com/omni/doug/ojb/lib/antlr.jar ./com/omni/doug/ojb/lib/antlr_compiletime.jar ./com/omni/doug/ojb/lib/commons-beanutils.jar ./com/omni/doug/ojb/lib/commons-collections.jar ./com/omni/doug/ojb/lib/commons-dbcp-1.1.jar ./com/omni/doug/ojb/lib/commons-lang-2.0.jar ./com/omni/doug/ojb/lib/commons-logging.jar ./com/omni/doug/ojb/lib/commons-pool-1.1.jar ./com/omni/doug/ojb/lib/db-ojb-1.0.rc6.jar ./com/omni/doug/ojb/lib/hsqldb.jar ./com/omni/doug/ojb/lib/j2ee.jar ./com/omni/doug/ojb/lib/jakarta-regexp-1.3.jar ./com/omni/doug/ojb/lib/jcs.jar ./com/omni/doug/ojb/lib/jdo.jar ./com/omni/doug/ojb/lib/junit.jar ./com/omni/doug/ojb/lib/log4j-1.2.8.jar ./com/omni/doug/ojb/lib/mysql-connector-java-3.0.7-stable-bin.jar ./com/omni/doug/ojb/lib/optional.jar ./com/omni/doug/ojb/lib/p6spy.jar ./com/omni/doug/ojb/lib/prevayler.jar ./com/omni/doug/ojb/lib/torque-3.0.2.jar ./com/omni/doug/ojb/lib/velocity-1.3.1.jar ./com/omni/doug/ojb/lib/xalan.jar ./com/omni/doug/ojb/lib/xdoclet-1.2b3-dev.jar ./com/omni/doug/ojb/lib/xdoclet-ojb-module-1.2b3-dev.jar ./com/omni/doug/ojb/lib/xercesImpl.jar ./com/omni/doug/ojb/lib/xjavadoc-1.0.jar ./com/omni/doug/ojb/lib/xml-apis.jar ./com/omni/doug/ojb/onlamp/BasePersistenceObjectImpl.class ./com/omni/doug/ojb/onlamp/BasePersistenceObjectImpl.java ./com/omni/doug/ojb/onlamp/Employee.class ./com/omni/doug/ojb/onlamp/Employee.java ./com/omni/doug/ojb/onlamp/EmployeeImpl.class ./com/omni/doug/ojb/onlamp/EmployeeImpl.java ./com/omni/doug/ojb/onlamp/EmployeeTest.class ./com/omni/doug/ojb/onlamp/EmployeeTest.java ./com/omni/doug/ojb/onlamp/Manager.class ./com/omni/doug/ojb/onlamp/Manager.java ./com/omni/doug/ojb/onlamp/ManagerImpl.class ./com/omni/doug/ojb/onlamp/ManagerImpl.java ./com/omni/doug/ojb/onlamp/OJBPersistenceManager.class ./com/omni/doug/ojb/onlamp/OJBPersistenceManager.java ./com/omni/doug/ojb/onlamp/OJBTransaction.class ./com/omni/doug/ojb/onlamp/OJBTransaction.java ./com/omni/doug/ojb/onlamp/PersistenceManager.class ./com/omni/doug/ojb/onlamp/PersistenceManager.java ./com/omni/doug/ojb/onlamp/Transaction.class ./com/omni/doug/ojb/onlamp/Transaction.java If it helps, here's the console output from a debug session... [BOOT] WARN: Value ojb.broker.cache.ObjectCacheDefaultImpl is illegal for key ObjectCacheClass (should be a class, using default value class org.apache.ojb.broker.cache.ObjectCacheDefaultImpl) [BOOT] WARN: Value ojb.broker.accesslayer.ConnectionFactoryDefaultImpl is illegal for key ConnectionFactoryClass (should be a class, using default value class org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl) [BOOT] WARN: Value ojb.odmg.locking.LockManagerDefaultImpl is illegal for key LockManagerClass (should be a class, using default value class org.apache.ojb.odmg.locking.LockManagerDefaultImpl) [BOOT] WARN: Value ojb.odmg.locking.InMemoryLockMapImpl is illegal for key LockMapClass (should be a class, using default value class org.apache.ojb.odmg.locking.InMemoryLockMapImpl) [BOOT] WARN: Value ojb.broker.util.logging.PoorMansLoggerImpl is illegal for key LoggerClass (should be a class, using default value class org.apache.ojb.broker.util.logging.PoorMansLoggerImpl) [BOOT] WARN: Value ojb.broker.metadata.PersistentFieldPropertyImpl is illegal for key PersistentFieldClass (should be a class, using default value class org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectAccessImpl) [BOOT] WARN: Value ojb.broker.singlevm.PersistenceBrokerImpl is illegal for key PersistenceBrokerClass (should be a class, using default value class org.apache.ojb.broker.core.PersistenceBrokerImpl) [BOOT] WARN: Value ojb.odmg.collections.DListImpl is illegal for key OqlCollectionClass (should be a class, using default value class org.apache.ojb.odmg.collections.DListImpl) [BOOT] WARN: Value ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl is illegal for key PersistenceBrokerFactoryClass (should be a class, using default value null) [BOOT] ERROR: Creation of PersistenceBrokerFactory (PBF) instance failed, can't get PBF class object Exception in thread main java.lang.ExceptionInInitializerError at
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]
Re: Newbie (almost) at a standstill
: | | Subject: Re: Newbie at a standstill | -| Hi Raphael, from your stack trace I can see you manipulate many of the default jdbc settings: Caused by: org.apache.ojb.broker.accesslayer.LookupException: Could not borrow connection from pool - org.apache.ojb.broker.metadata.JdbcConnectionDescriptor: [EMAIL PROTECTED] jcd-alias=BETConnection default-connection=true dbms=oracle jdbc-level=2.0 driver=oracle.jdbc.driver.OracleDriver protocol=jdbc sub-protocol=oracle:thin [EMAIL PROTECTED]:1521:TOOLS user=bet password=* eager-release=true only set true in JBoss 3.2.2 (but recommended to use 3.2.2 or higher) ConnectionPoolDescriptor={whenExhaustedAction=2, validationQuery=a query, OJB try to perform a validation query a query, this will fail (not SQL compatible ;-)). Maybe this is the problem you have. maxIdle=2, maxActive=1, maxWait=3, removeAbandoned=true, numTestsPerEvictionRun=5, testWhileIdle=true, minEvictableIdleTimeMillis=4, testOnReturn=true, logAbandoned=true, removeAbandonedTimeout=8, timeBetweenEvictionRunsMillis=6, testOnBorrow=true} again, I recommend to use default settings first and only change settings step by step. batchMode=true I recommend to set batch-mode false to avoid side-effects. You can try to enable it when all stuff is working fine. useAutoCommit=AUTO_COMMIT_IGNORE_STATE Again default is '1', you set '0'. But in managed enviroments you need to set '0'. Do you try to run OJB in a managed environment? This wouldn't be a good starting point for a newbie ;-) ahh, now I see in your repository_database.xml what you have done. You picked up a jdbc-connection-descriptor used for junit testing and set you DB properties. This will not work, because the used properties don't be valid. Did you see http://db.apache.org/ojb/getting-started.html http://db.apache.org/ojb/platforms.html As Brian said before, recommended to use this way first to setup your environment. In build.properties you can set your DB. In the profiles directory you can find templates for all supported databases. Pick the oracle file and set your properties. regards, Armin ignoreAutoCommitExceptions=true [EMAIL PROTECTED] wrote: I have done the 'ant build' and it makes no difference. If in the db.open () I change to the default db alias the system appears not to see my parameters at all. It has username and password set to null. There is clearly something terribly obvious that I am just not understanding about setting up OJB. [org.apache.ojb.odmg.DatabaseImpl] ERROR: Open database failed: Borrow broker from pool failed, using PBKey org.apache.ojb.broker.PBKey: jcdAlias=default, user=null, password=null Borrow broker from pool failed, using PBKey org.apache.ojb.broker.PBKey: jcdAlias=default, user=null, password=null org.apache.ojb.broker.PBFactoryException: Borrow broker from pool failed, using PBKey org.apache.ojb.broker.PBKey: jcdAlias=default, user=null, password=null at org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.createPersistenceBroker(Unknown Source) at org.apache.ojb.broker.PersistenceBrokerFactory.createPersistenceBroker(Unknown Source) at org.apache.ojb.odmg.DatabaseImpl.open(Unknown Source) at com.gsk.bet.ConnectionTest.setUp(ConnectionTest.java:33) As a background, I should explain that I am reasonably familiar with Torque. I am in the process of evaluating whether to go with OJB, which seems on paper to have some advantages over Torque, or whether to use Torque also for this project. I really want database independence, so I would prefer to use OJB. |-+- | | Brian McCallister | | | [EMAIL PROTECTED]| | | ompany.com | | | | | | | | | 29-Mar-2004 17:34 | | | Please respond to OJB| | | Users List | | | [EMAIL PROTECTED]| | | g| | | | |-+- -| | | | | | | | To: OJB Users List [EMAIL PROTECTED] | | | | cc: | | Subject: Re: Newbie at a standstill | -| Are you using the ant build? The ojb-blank project template does a property replace
Re: Newbie (almost) at a standstill
| | || |-+ -- ---| | | | | | | | To: OJB Users List [EMAIL PROTECTED] | | | | cc: | | Subject: Re: Newbie at a standstill | -- ---| Hi Raphael, from your stack trace I can see you manipulate many of the default jdbc settings: Caused by: org.apache.ojb.broker.accesslayer.LookupException: Could not borrow connection from pool - org.apache.ojb.broker.metadata.JdbcConnectionDescriptor: [EMAIL PROTECTED] jcd-alias=BETConnection default-connection=true dbms=oracle jdbc-level=2.0 driver=oracle.jdbc.driver.OracleDriver protocol=jdbc sub-protocol=oracle:thin [EMAIL PROTECTED]:1521:TOOLS user=bet password=* eager-release=true only set true in JBoss 3.2.2 (but recommended to use 3.2.2 or higher) ConnectionPoolDescriptor={whenExhaustedAction=2, validationQuery=a query, OJB try to perform a validation query a query, this will fail (not SQL compatible ;-)). Maybe this is the problem you have. maxIdle=2, maxActive=1, maxWait=3, removeAbandoned=true, numTestsPerEvictionRun=5, testWhileIdle=true, minEvictableIdleTimeMillis=4, testOnReturn=true, logAbandoned=true, removeAbandonedTimeout=8, timeBetweenEvictionRunsMillis=6, testOnBorrow=true} again, I recommend to use default settings first and only change settings step by step. batchMode=true I recommend to set batch-mode false to avoid side-effects. You can try to enable it when all stuff is working fine. useAutoCommit=AUTO_COMMIT_IGNORE_STATE Again default is '1', you set '0'. But in managed enviroments you need to set '0'. Do you try to run OJB in a managed environment? This wouldn't be a good starting point for a newbie ;-) ahh, now I see in your repository_database.xml what you have done. You picked up a jdbc-connection-descriptor used for junit testing and set you DB properties. This will not work, because the used properties don't be valid. Did you see http://db.apache.org/ojb/getting-started.html http://db.apache.org/ojb/platforms.html As Brian said before, recommended to use this way first to setup your environment. In build.properties you can set your DB. In the profiles directory you can find templates for all supported databases. Pick the oracle file and set your properties. regards, Armin ignoreAutoCommitExceptions=true [EMAIL PROTECTED] wrote: I have done the 'ant build' and it makes no difference. If in the db.open () I change to the default db alias the system appears not to see my parameters at all. It has username and password set to null. There is clearly something terribly obvious that I am just not understanding about setting up OJB. [org.apache.ojb.odmg.DatabaseImpl] ERROR: Open database failed: Borrow broker from pool failed, using PBKey org.apache.ojb.broker.PBKey: jcdAlias=default, user=null, password=null Borrow broker from pool failed, using PBKey org.apache.ojb.broker.PBKey: jcdAlias=default, user=null, password=null org.apache.ojb.broker.PBFactoryException: Borrow broker from pool failed, using PBKey org.apache.ojb.broker.PBKey: jcdAlias=default, user=null, password=null at org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.createPe rsistenceBroker(Unknown Source) at org.apache.ojb.broker.PersistenceBrokerFactory.createPersistenceBroker( Unknown Source) at org.apache.ojb.odmg.DatabaseImpl.open(Unknown Source) at com.gsk.bet.ConnectionTest.setUp(ConnectionTest.java:33) As a background, I should explain that I am reasonably familiar with Torque. I am in the process of evaluating whether to go with OJB, which seems on paper to have some advantages over Torque, or whether to use Torque also for this project. I really want database independence, so I would prefer to use OJB. |-+- | | Brian McCallister | | | [EMAIL PROTECTED]| | | ompany.com
Re: Newbie (almost) at a standstill
So, apart from one glitch I think that the other points are matters of clearer documentation. It is not clear from the Getting Started doc just what one has to do and in what order. There are also inconsistencies betwen the default build.properties and *.profiles as towhich variables are required. Some tidying up is what it comes down to. I am just left with my ODMG problem. BTW for those who are a bit irritated by my not snipping out the older, and now irrelvant, parts of this message stream, I am working with Lotus Notes, and if I try to edit the message it just deletes the whole lot. |-+- | | Brian McCallister | | | [EMAIL PROTECTED]| | | ompany.com | | | | | | | | | 02-Apr-2004 13:10 | | | Please respond to OJB| | | Users List | | | [EMAIL PROTECTED]| | | g| | | | |-+- -| | | | | | | | To: OJB Users List [EMAIL PROTECTED] | | | | cc: | | Subject: Re: Newbie (almost) at a standstill | -| repository.xml wasn't copied in rc5, was a problem, has been fixed in rc6. If you want to patch manually, change the ant copy in build.xml to copy respositor*.xml instead of repository_*.xml =) DB profiles are not copied on purpose, you need to copy the relevant settings into build.properties yourself. The build.properties contains all of the variables -- including jcdAlias and jdbcRuntimeDriver (in build.properties they are default and org.hsqldb.jdbcDriver respectively). You can CP the properties out of profiles if you want to. I deemed that copying all the profiles over was overkill as ojb-blank is supposed to try to be minimal to help people get started. The setting of the variables in repositor*.xml is done via ant property substitution from the values in build.properties. -Brian On Apr 2, 2004, at 6:19 AM, [EMAIL PROTECTED] wrote: A status report on my problems. I went back to square one and managed to get things to work. However, in the process I found some glitches. Maybe they are finger trouble on my part, maybe they are omissions in the code or the documentation. 1.The variable ${jcdAlias} is used in repository_database.xml, but nothing sets it. I also cannot find where it is picked up from. 2.Repository.xml is not included in obj-blank.jar 3.The various DB profiles are not included in ojb-blank.jar 4.JdbcRuntimeDriver has to be added to build.properties before doing the ant build step. I now have PB working, but I cannot get ODMG to work. I am using rc5 and keep getting NPEs from query.create(), sometimes with associated syntax 'errors'. My table already exists and contains about 6M rows. The code, which is intended merely to verify basic connectivity, is below select betid from Entity = NPE with no other diagnostic select count(*) from Entity = NPE with 'unxexpected token ( found, expected from' select betid as b from entity = NPE with 'unexpected token as ...' select betid b from Entity = NPE with 'unexpected token b ...' /* * Created on 31-Mar-04 * CVS version $Header:$ */ package com.gsk; import junit.framework.TestCase; import org.apache.ojb.broker.PersistenceBroker; import org.apache.ojb.broker.PersistenceBrokerFactory; import org.apache.ojb.broker.query.Criteria; import org.apache.ojb.broker.query.Query; import org.apache.ojb.broker.query.QueryByCriteria; import org.apache.ojb.odmg.OJB; import org.odmg.Database; import org.odmg.Implementation; import org.odmg.OQLQuery; /** * @author rxm1676 * @company GSK */ public class EntityTest extends TestCase { PersistenceBroker broker = null; Implementation
Re: Newbie (almost) at a standstill
Thank you all for your pointers. I am well aware of the difficulty of writing good documentatioin when you are an expert in the field; sometimes ignorance is a blessing. I shall continue to report omissions or ambiguities as I find them. More documentation updates then I think that the docs always show things within a transaction, but don't mention that you MUST be in a transaction. I will change table name to class name and see how I get on. Again, this distinction is not clear from the docs. However, what I do not understand is why I need to be in a transaction when I call query.create(). Surely I should not need a transaction until I actually execute the query? Both count(*) and 'as' are in the OQL grammar I downloaded from ODMG.org yesterday. The one is in 'aggregateExpr', the other in 'projection'. If, as you say, the selection list (projectionAttributes in the grammar) is merely a placeholder, then the aggregate functions of the grammar can never be evaluated. Surely this was not the intention of the ODMG? I have now run the tests. The transaction wrapping is not necesary; the full class name is necessary; count(*) gives a syntax error. |-+- | | Brian McCallister | | | [EMAIL PROTECTED]| | | ompany.com | | | | | | | | | 02-Apr-2004 14:27 | | | Please respond to OJB| | | Users List | | | [EMAIL PROTECTED]| | | g| | | | |-+- -| | | | | | | | To: OJB Users List [EMAIL PROTECTED] | | | | cc: | | Subject: Re: Newbie (almost) at a standstill | -| Any chance you could sum up what needs improvement in the docs? As Thomas put it when I first got involved with OJB, once you get really close to it, it can be hard to see it from a newcomers perspective =( There is a *lot* to it. I am personally invested in trying to make it easy for people to get started with OJB (I did the getting started, ojb-blank, and the new tutorials -- if they are deficient it is my fault, so I appreciate any help in fixing em up =) On ODMG: I don't think count(*) is supported (anyone know about this? I don't use ODMG much)). Last I used ODMG count, upper, etc weren't in it (using the ODMG published grammar for OQL). as isn't an OQL keyword. The foo in select foo from bar is pretty much a placeholder that doesn't do anything, to my (limited) knowledge of the ODMG OQL spec. In this case foo is just a label. What is returned is specificed by the from classname section. Looking at your test case, the NPE's are likely being caused by the fact that you don't have a transaction in progress. The ODMG api requires all queries etc be executed within the context of a transaction: To take some code from the ODMG tutorial: public static Product findProductByName(String name) throws Exception { Implementation impl = OJB.getInstance(); Transaction tx = impl.newTransaction(); tx.begin(); OQLQuery query = impl.newOQLQuery(); query.create(select products from + Product.class.getName() + where name = $1); query.bind(name); DList results = (DList) query.execute(); Product product = (Product) results.iterator().next(); tx.commit(); return product; } Additionally, you need to include the full classname, including package, in the OQL string. I don't know if your Entity class is in the top level namespace, or in the same as the unit test, so I don't know if this is part of what is happening or not. -Brian On Apr 2, 2004, at 8:02 AM, [EMAIL PROTECTED] wrote: So, apart from one glitch I think that the other
Re: Newbie (almost) at a standstill
On Apr 2, 2004, at 9:23 AM, [EMAIL PROTECTED] wrote: Thank you all for your pointers. I am well aware of the difficulty of writing good documentatioin when you are an expert in the field; sometimes ignorance is a blessing. I shall continue to report omissions or ambiguities as I find them. Much appreciated! Surely I should not need a transaction until I actually execute the query? Correct, must have been looking at your code too early in the morning =) Both count(*) and 'as' are in the OQL grammar I downloaded from ODMG.org yesterday. The one is in 'aggregateExpr', the other in 'projection'. If, as you say, the selection list (projectionAttributes in the grammar) is merely a placeholder, then the aggregate functions of the grammar can never be evaluated. Surely this was not the intention of the ODMG? Hmm I don't know about this -- I am far from an ODMG expert, I don't use that API often, and have never delved into that part of the code =( (nudge Thomas) -Brian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie (almost) at a standstill
On Fri, 2 Apr 2004, Brian McCallister wrote: Both count(*) and 'as' are in the OQL grammar I downloaded from ODMG.org yesterday. The one is in 'aggregateExpr', the other in 'projection'. If, as you say, the selection list (projectionAttributes in the grammar) is merely a placeholder, then the aggregate functions of the grammar can never be evaluated. Surely this was not the intention of the ODMG? Hmm I don't know about this -- I am far from an ODMG expert, I don't use that API often, and have never delved into that part of the code =( (nudge Thomas) From what I can see in the OQL grammar in OJB (which originally dates 1999 btw), OJB does not support any functions in the column part of the select statement, only fields (identifiers in the grammar). Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie at a standstill
I have done the 'ant build' and it makes no difference. If in the db.open() I change to the default db alias the system appears not to see my parameters at all. It has username and password set to null. There is clearly something terribly obvious that I am just not understanding about setting up OJB. [org.apache.ojb.odmg.DatabaseImpl] ERROR: Open database failed: Borrow broker from pool failed, using PBKey org.apache.ojb.broker.PBKey: jcdAlias=default, user=null, password=null Borrow broker from pool failed, using PBKey org.apache.ojb.broker.PBKey: jcdAlias=default, user=null, password=null org.apache.ojb.broker.PBFactoryException: Borrow broker from pool failed, using PBKey org.apache.ojb.broker.PBKey: jcdAlias=default, user=null, password=null at org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.createPersistenceBroker(Unknown Source) at org.apache.ojb.broker.PersistenceBrokerFactory.createPersistenceBroker(Unknown Source) at org.apache.ojb.odmg.DatabaseImpl.open(Unknown Source) at com.gsk.bet.ConnectionTest.setUp(ConnectionTest.java:33) As a background, I should explain that I am reasonably familiar with Torque. I am in the process of evaluating whether to go with OJB, which seems on paper to have some advantages over Torque, or whether to use Torque also for this project. I really want database independence, so I would prefer to use OJB. |-+- | | Brian McCallister | | | [EMAIL PROTECTED]| | | ompany.com | | | | | | | | | 29-Mar-2004 17:34 | | | Please respond to OJB| | | Users List | | | [EMAIL PROTECTED]| | | g| | | | |-+- -| | | | | | | | To: OJB Users List [EMAIL PROTECTED] | | | | cc: | | Subject: Re: Newbie at a standstill | -| Are you using the ant build? The ojb-blank project template does a property replace in the build -- the required database information is in the build.properties and is copied into the generated repository_database.xml that goes in build/ when compilation is run. -Brian On Mar 29, 2004, at 11:24 AM, [EMAIL PROTECTED] wrote: I am trying to get OJB working and am getting absolutely nowhere, so I appeal to the list for some help. The environment is OJB rc5, Eclipse IDE, Sun JDK1.4.2, Oracle 9, NT4.0. The running of the code is controlled by JUnit. I can connect to the DB both with sqlplus and jdbc. I cannot actually get OJB to connect. Clearly I am missing something, but I cannot discover what. By fiddling around with the XML I can generate various sorts of errors. In all cases the url that the system is using appears to be entirely palusible. Here are the code, the repository_database.xml and the output: Code: /* * Created on 26-Mar-2004 * CVS version $Header:$ */ package com.gsk.bet; import java.util.*; import java.sql.*; import junit.framework.*; import org.apache.ojb.broker.*; import org.apache.ojb.broker.query.*; import org.odmg.*; import org.apache.ojb.odmg.*; import com.gsk.bet.Entity; /** * @author rxm1676 * @company GSK */ public class ConnectionTest extends TestCase { PersistenceBroker broker; Database db = null; Implementation odmg = null; public void setUp() { try { Class c = Class.forName(oracle.jdbc.driver.OracleDriver ); broker = PersistenceBrokerFactory.defaultPersistenceBroker(); odmg = OJB.getInstance(); db = odmg.newDatabase(); db.open(BETConnection, Database.OPEN_READ_WRITE); } catch (Exception ex
Re: Newbie at a standstill
Hi Raphael, from your stack trace I can see you manipulate many of the default jdbc settings: Caused by: org.apache.ojb.broker.accesslayer.LookupException: Could not borrow connection from pool - org.apache.ojb.broker.metadata.JdbcConnectionDescriptor: [EMAIL PROTECTED] jcd-alias=BETConnection default-connection=true dbms=oracle jdbc-level=2.0 driver=oracle.jdbc.driver.OracleDriver protocol=jdbc sub-protocol=oracle:thin [EMAIL PROTECTED]:1521:TOOLS user=bet password=* eager-release=true only set true in JBoss 3.2.2 (but recommended to use 3.2.2 or higher) ConnectionPoolDescriptor={whenExhaustedAction=2, validationQuery=a query, OJB try to perform a validation query a query, this will fail (not SQL compatible ;-)). Maybe this is the problem you have. maxIdle=2, maxActive=1, maxWait=3, removeAbandoned=true, numTestsPerEvictionRun=5, testWhileIdle=true, minEvictableIdleTimeMillis=4, testOnReturn=true, logAbandoned=true, removeAbandonedTimeout=8, timeBetweenEvictionRunsMillis=6, testOnBorrow=true} again, I recommend to use default settings first and only change settings step by step. batchMode=true I recommend to set batch-mode false to avoid side-effects. You can try to enable it when all stuff is working fine. useAutoCommit=AUTO_COMMIT_IGNORE_STATE Again default is '1', you set '0'. But in managed enviroments you need to set '0'. Do you try to run OJB in a managed environment? This wouldn't be a good starting point for a newbie ;-) ahh, now I see in your repository_database.xml what you have done. You picked up a jdbc-connection-descriptor used for junit testing and set you DB properties. This will not work, because the used properties don't be valid. Did you see http://db.apache.org/ojb/getting-started.html http://db.apache.org/ojb/platforms.html As Brian said before, recommended to use this way first to setup your environment. In build.properties you can set your DB. In the profiles directory you can find templates for all supported databases. Pick the oracle file and set your properties. regards, Armin ignoreAutoCommitExceptions=true [EMAIL PROTECTED] wrote: I have done the 'ant build' and it makes no difference. If in the db.open() I change to the default db alias the system appears not to see my parameters at all. It has username and password set to null. There is clearly something terribly obvious that I am just not understanding about setting up OJB. [org.apache.ojb.odmg.DatabaseImpl] ERROR: Open database failed: Borrow broker from pool failed, using PBKey org.apache.ojb.broker.PBKey: jcdAlias=default, user=null, password=null Borrow broker from pool failed, using PBKey org.apache.ojb.broker.PBKey: jcdAlias=default, user=null, password=null org.apache.ojb.broker.PBFactoryException: Borrow broker from pool failed, using PBKey org.apache.ojb.broker.PBKey: jcdAlias=default, user=null, password=null at org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.createPersistenceBroker(Unknown Source) at org.apache.ojb.broker.PersistenceBrokerFactory.createPersistenceBroker(Unknown Source) at org.apache.ojb.odmg.DatabaseImpl.open(Unknown Source) at com.gsk.bet.ConnectionTest.setUp(ConnectionTest.java:33) As a background, I should explain that I am reasonably familiar with Torque. I am in the process of evaluating whether to go with OJB, which seems on paper to have some advantages over Torque, or whether to use Torque also for this project. I really want database independence, so I would prefer to use OJB. |-+- | | Brian McCallister | | | [EMAIL PROTECTED]| | | ompany.com | | | | | | | | | 29-Mar-2004 17:34 | | | Please respond to OJB| | | Users List | | | [EMAIL PROTECTED]| | | g| | | | |-+- -| | | | | | | | To: OJB Users List [EMAIL PROTECTED] | | | | cc
Re: Newbie at a standstill
Thank you for your help. I will try your suggestions. I did read all the docs I could find, but did not find them terribly clear. My life is made more difficult by doing this job under Windows and not Unix - it is a matter of where I have Oracle client libraries installed and also have GUI-based access. Also, Eclipse likes to have things in different places from where the ant/build*.xml expects them. |-+ | | Armin Waibel | | | [EMAIL PROTECTED]| | | g | | || | || | | 30-Mar-2004 11:18| | | Please respond to| | | OJB Users List | | | [EMAIL PROTECTED]| | | he.org | | || |-+ -| | | | | | | | To: OJB Users List [EMAIL PROTECTED] | | | | cc: | | Subject: Re: Newbie at a standstill | -| Hi Raphael, from your stack trace I can see you manipulate many of the default jdbc settings: Caused by: org.apache.ojb.broker.accesslayer.LookupException: Could not borrow connection from pool - org.apache.ojb.broker.metadata.JdbcConnectionDescriptor: [EMAIL PROTECTED] jcd-alias=BETConnection default-connection=true dbms=oracle jdbc-level=2.0 driver=oracle.jdbc.driver.OracleDriver protocol=jdbc sub-protocol=oracle:thin [EMAIL PROTECTED]:1521:TOOLS user=bet password=* eager-release=true only set true in JBoss 3.2.2 (but recommended to use 3.2.2 or higher) ConnectionPoolDescriptor={whenExhaustedAction=2, validationQuery=a query, OJB try to perform a validation query a query, this will fail (not SQL compatible ;-)). Maybe this is the problem you have. maxIdle=2, maxActive=1, maxWait=3, removeAbandoned=true, numTestsPerEvictionRun=5, testWhileIdle=true, minEvictableIdleTimeMillis=4, testOnReturn=true, logAbandoned=true, removeAbandonedTimeout=8, timeBetweenEvictionRunsMillis=6, testOnBorrow=true} again, I recommend to use default settings first and only change settings step by step. batchMode=true I recommend to set batch-mode false to avoid side-effects. You can try to enable it when all stuff is working fine. useAutoCommit=AUTO_COMMIT_IGNORE_STATE Again default is '1', you set '0'. But in managed enviroments you need to set '0'. Do you try to run OJB in a managed environment? This wouldn't be a good starting point for a newbie ;-) ahh, now I see in your repository_database.xml what you have done. You picked up a jdbc-connection-descriptor used for junit testing and set you DB properties. This will not work, because the used properties don't be valid. Did you see http://db.apache.org/ojb/getting-started.html http://db.apache.org/ojb/platforms.html As Brian said before, recommended to use this way first to setup your environment. In build.properties you can set your DB. In the profiles directory you can find templates for all supported databases. Pick the oracle file and set your properties. regards, Armin ignoreAutoCommitExceptions=true [EMAIL PROTECTED] wrote: I have done the 'ant build' and it makes no difference. If in the db.open () I change to the default db alias the system appears not to see my parameters at all. It has username and password set to null. There is clearly something terribly obvious that I am just not understanding about setting up OJB. [org.apache.ojb.odmg.DatabaseImpl] ERROR: Open database failed: Borrow broker from pool failed, using PBKey org.apache.ojb.broker.PBKey: jcdAlias=default, user=null, password=null Borrow broker from pool failed, using PBKey org.apache.ojb.broker.PBKey: jcdAlias=default, user=null, password=null org.apache.ojb.broker.PBFactoryException: Borrow broker from pool failed, using PBKey org.apache.ojb.broker.PBKey
Newbie at a standstill
I am trying to get OJB working and am getting absolutely nowhere, so I appeal to the list for some help. The environment is OJB rc5, Eclipse IDE, Sun JDK1.4.2, Oracle 9, NT4.0. The running of the code is controlled by JUnit. I can connect to the DB both with sqlplus and jdbc. I cannot actually get OJB to connect. Clearly I am missing something, but I cannot discover what. By fiddling around with the XML I can generate various sorts of errors. In all cases the url that the system is using appears to be entirely palusible. Here are the code, the repository_database.xml and the output: Code: /* * Created on 26-Mar-2004 * CVS version $Header:$ */ package com.gsk.bet; import java.util.*; import java.sql.*; import junit.framework.*; import org.apache.ojb.broker.*; import org.apache.ojb.broker.query.*; import org.odmg.*; import org.apache.ojb.odmg.*; import com.gsk.bet.Entity; /** * @author rxm1676 * @company GSK */ public class ConnectionTest extends TestCase { PersistenceBroker broker; Database db = null; Implementation odmg = null; public void setUp() { try { Class c = Class.forName(oracle.jdbc.driver.OracleDriver ); broker = PersistenceBrokerFactory.defaultPersistenceBroker(); odmg = OJB.getInstance(); db = odmg.newDatabase(); db.open(BETConnection, Database.OPEN_READ_WRITE); } catch (Exception ex) { System.out.println(ex); } } public void tearDown() { if (broker != null) { broker.close(); } if (db != null) { try { db.close(); } catch (ODMGException ex2) { } } } /** * Null test. Just checks that OJB is properly installed, that it can see both the * XML and the bean classes, and that we can get a Broker and an ODMG instance. * */ public void testConnection() { } /** * Ensure that we can actually talk to the DB from this machine * */ public void testRawJDBC() { try { Connection con = DriverManager.getConnection (jdbc:oracle:thin:@ukt01368.ggr.co.uk:1521:TOOLS, bet, ); PreparedStatement sth = con.prepareStatement(select * from entity where betid10); ResultSet res = sth.executeQuery(); System.out.println(Excuted raw query); while (res.next()) { Entity ent = new Entity(); ent.setBetid(res.getInt(BETID)); ent.setEntityType(res.getString(ENTITYTYPE)); ent.setDescriptor(res.getString(DESCRIPTOR)); System.out.println(raw retrieval of +ent); } res.close(); con.close(); } catch (Exception e) { System.out.println(Caught raw exception + e); } } /** * * @author rxm1676 * @company GSK */ public void testODMGFetchSingle() { Transaction tx = odmg.newTransaction(); try { OQLQuery query = odmg.newOQLQuery(); query.create( select betid, entityType, descriptor from + Entity.class.getName() + where betid = 1); DList results = (DList)query.execute(); for (Iterator iter = results.iterator(); iter.hasNext();) { tx.begin(); Entity res = (Entity)iter.next(); System.out.println(Retrieved + res); tx.commit(); } } catch (QueryInvalidException qie) { System.out.println(qie); tx.abort(); } catch (QueryException qe) { System.out.println(qe); tx.abort(); } } /** * Retrieve a single object using the PersistenceBroker * @author rxm1676 * @company GSK */ public void testPBFetchSingle() { Entity example = new Entity(); example.setBetid(1); Query q = QueryFactory.newQueryByExample(example); Entity res = (Entity)broker.getObjectByQuery(q); System.out.println(PB fetched +res); } } Database_repopsitory.xml !-- @version $Id: repository_database.xml,v 1.17 2003/11/27 16:42:12 arminw Exp $ -- !-- Define here all used connections. One defined connection should be defined as the default one, by set default-connection=true - this could be done at runtime too. It is possible to set user/password at runtime or let login different users at runtime using the same database. Use different PBKey with same jcdAlias name but different user/password. Ditto it is possible to add jdbc-connection-descriptor at runtime using the MetadataManager. -- !-- this connection was used as the default one within OJB --
Re: Newbie at a standstill
Are you using the ant build? The ojb-blank project template does a property replace in the build -- the required database information is in the build.properties and is copied into the generated repository_database.xml that goes in build/ when compilation is run. -Brian On Mar 29, 2004, at 11:24 AM, [EMAIL PROTECTED] wrote: I am trying to get OJB working and am getting absolutely nowhere, so I appeal to the list for some help. The environment is OJB rc5, Eclipse IDE, Sun JDK1.4.2, Oracle 9, NT4.0. The running of the code is controlled by JUnit. I can connect to the DB both with sqlplus and jdbc. I cannot actually get OJB to connect. Clearly I am missing something, but I cannot discover what. By fiddling around with the XML I can generate various sorts of errors. In all cases the url that the system is using appears to be entirely palusible. Here are the code, the repository_database.xml and the output: Code: /* * Created on 26-Mar-2004 * CVS version $Header:$ */ package com.gsk.bet; import java.util.*; import java.sql.*; import junit.framework.*; import org.apache.ojb.broker.*; import org.apache.ojb.broker.query.*; import org.odmg.*; import org.apache.ojb.odmg.*; import com.gsk.bet.Entity; /** * @author rxm1676 * @company GSK */ public class ConnectionTest extends TestCase { PersistenceBroker broker; Database db = null; Implementation odmg = null; public void setUp() { try { Class c = Class.forName(oracle.jdbc.driver.OracleDriver ); broker = PersistenceBrokerFactory.defaultPersistenceBroker(); odmg = OJB.getInstance(); db = odmg.newDatabase(); db.open(BETConnection, Database.OPEN_READ_WRITE); } catch (Exception ex) { System.out.println(ex); } } public void tearDown() { if (broker != null) { broker.close(); } if (db != null) { try { db.close(); } catch (ODMGException ex2) { } } } /** * Null test. Just checks that OJB is properly installed, that it can see both the * XML and the bean classes, and that we can get a Broker and an ODMG instance. * */ public void testConnection() { } /** * Ensure that we can actually talk to the DB from this machine * */ public void testRawJDBC() { try { Connection con = DriverManager.getConnection (jdbc:oracle:thin:@ukt01368.ggr.co.uk:1521:TOOLS, bet, ); PreparedStatement sth = con.prepareStatement(select * from entity where betid10); ResultSet res = sth.executeQuery(); System.out.println(Excuted raw query); while (res.next()) { Entity ent = new Entity(); ent.setBetid(res.getInt(BETID)); ent.setEntityType(res.getString(ENTITYTYPE)); ent.setDescriptor(res.getString(DESCRIPTOR)); System.out.println(raw retrieval of +ent); } res.close(); con.close(); } catch (Exception e) { System.out.println(Caught raw exception + e); } } /** * * @author rxm1676 * @company GSK */ public void testODMGFetchSingle() { Transaction tx = odmg.newTransaction(); try { OQLQuery query = odmg.newOQLQuery(); query.create( select betid, entityType, descriptor from + Entity.class.getName() + where betid = 1); DList results = (DList)query.execute(); for (Iterator iter = results.iterator(); iter.hasNext();) { tx.begin(); Entity res = (Entity)iter.next(); System.out.println(Retrieved + res); tx.commit(); } } catch (QueryInvalidException qie) { System.out.println(qie); tx.abort(); } catch (QueryException qe) { System.out.println(qe); tx.abort(); } } /** * Retrieve a single object using the PersistenceBroker * @author rxm1676 * @company GSK */ public void testPBFetchSingle() { Entity example = new Entity(); example.setBetid(1); Query q = QueryFactory.newQueryByExample(example); Entity res = (Entity)broker.getObjectByQuery(q); System.out.println(PB fetched +res); } } Database_repopsitory.xml !-- @version $Id: repository_database.xml,v 1.17 2003/11/27 16:42:12 arminw Exp $ -- !-- Define here all used connections. One defined connection should be defined as the default one, by set default-connection=true - this could be done at runtime too. It is
Re: Newbie Proxy problem
Nop, it did not work, have you any example Edson Carlos Ericksson Richter wrote: As far as you have explained, you should not get ClassCastException. First let's go analize your code: 1) Product implements InterfaceProduct. 2) ProductGroup have a products list. Ok, have you set the collection-class in the collection-descriptor to ManageableArrayList? If you have not, do it, because default is RemovalAwareCollection (you can't make cast from Collection to List, or you will get ClassCastException). Without more details is hard to give you better ideais about what's can be going wrong. Best regards, Edson Richter - Original Message - From: Mauricio Montblanch To: OJB Users List Sent: Friday, March 19, 2004 11:54 AM Subject: Newbie Proxy problem Hi I am trying to use a dynamic proxy in a 1:n relation (loading a list) but a I can 't figure out how make it work (I get a java.lang.ClassCastException when I try to get the any object), can anyone give me a simple example of how to use a dynamic proxy. Detail Clases: Product InterfaceProduct (Interface) ProductGroup (contains List products) XML: class-descriptor class=Product proxy=dynamic table=PRODUCT .. class-descriptor class=ProductGroup table=PRODUCTGROUP . . collection-descriptor name=products element-class-ref=Product inverse-foreignkey field-ref=idProductGroup/ /collection-descriptor so, when y get a product Group y get a list of products filled with objects of the type (InterfaceProduct) and I can say InterfaceProduct i=(InterfaceProduct) ptoducts.get(0); without errors but how I can materialize the Product Object - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.624 / Virus Database: 401 - Release Date: 15/3/2004 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie Proxy problem
I'll try to do show in a sample: public class TestA { public int idA; public java.util.List allB; } public class TestB { public int idB; public int idReferenceToA; public TestA referenceToA; } in XML: class-descriptor class=TestA proxy=dynamic table=TB_A field-descriptor name=idA column=ID_A primarykey=true jdbc-type=Integer/ collection-descriptor name=allB collection-class=org.apache.ojb.broker.util.collections.ManageableArrayList element-class-ref=TestB proxy=true auto-update=false auto-delete=false/ inverse-foreignkey field-ref=idReferenceToA/ /collection-descriptor /class-descriptor class-descriptor class=TestB proxy=dynamic table=TB_B field-descriptor name=idB column=ID_B primarykey=true jdbc-type=Integer/ field-descriptor name=idReferenceToA column=ID_A primarykey=true jdbc-type=Integer/ reference-descriptor name=referenceToA proxy=true class-ref=TestA foreignkey field-ref=idReferenceToA/ /reference-descriptor /class-descriptor I get this sample from my projects (just changed the field/table/bean names, and simplified the beans). This works fine (may be I made some typo when changing names, so this sample could/couldn't run as is). But the main ideia is there. If you are using JavaBeans like acessors (like I do), don't forget to implement getter/setters for your objects. Best regards, Edson Richter - Original Message - From: Mauricio Montblanch To: OJB Users List Sent: Tuesday, March 23, 2004 3:16 PM Subject: Re: Newbie Proxy problem Nop, it did not work, have you any example Edson Carlos Ericksson Richter wrote: As far as you have explained, you should not get ClassCastException. First let's go analize your code: 1) Product implements InterfaceProduct. 2) ProductGroup have a products list. Ok, have you set the collection-class in the collection-descriptor to ManageableArrayList? If you have not, do it, because default is RemovalAwareCollection (you can't make cast from Collection to List, or you will get ClassCastException). Without more details is hard to give you better ideais about what's can be going wrong. Best regards, Edson Richter - Original Message - From: Mauricio Montblanch To: OJB Users List Sent: Friday, March 19, 2004 11:54 AM Subject: Newbie Proxy problem Hi I am trying to use a dynamic proxy in a 1:n relation (loading a list) but a I can 't figure out how make it work (I get a java.lang.ClassCastException when I try to get the any object), can anyone give me a simple example of how to use a dynamic proxy. Detail Clases: Product InterfaceProduct (Interface) ProductGroup (contains List products) XML: class-descriptor class=Product proxy=dynamic table=PRODUCT .. class-descriptor class=ProductGroup table=PRODUCTGROUP . . collection-descriptor name=products element-class-ref=Product inverse-foreignkey field-ref=idProductGroup/ /collection-descriptor so, when y get a product Group y get a list of products filled with objects of the type (InterfaceProduct) and I can say InterfaceProduct i=(InterfaceProduct) ptoducts.get(0); without errors but how I can materialize the Product Object - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.624 / Virus Database: 401 - Release Date: 15/3/2004 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.637 / Virus Database: 408 - Release Date: 20/3/2004
Re: Newbie Proxy problem
Of course, I forget to metion the mandatory interfaces: public interface TestAIF { } public interface TestBIF { } then public class TestA implements TestAIF { } public class TestB implements TestBIF { } Best regards, Edson Richter - Original Message - From: Edson Carlos Ericksson Richter To: OJB Users List Sent: Tuesday, March 23, 2004 3:48 PM Subject: Re: Newbie Proxy problem I'll try to do show in a sample: public class TestA { public int idA; public java.util.List allB; } public class TestB { public int idB; public int idReferenceToA; public TestA referenceToA; } in XML: class-descriptor class=TestA proxy=dynamic table=TB_A field-descriptor name=idA column=ID_A primarykey=true jdbc-type=Integer/ collection-descriptor name=allB collection-class=org.apache.ojb.broker.util.collections.ManageableArrayList element-class-ref=TestB proxy=true auto-update=false auto-delete=false/ inverse-foreignkey field-ref=idReferenceToA/ /collection-descriptor /class-descriptor class-descriptor class=TestB proxy=dynamic table=TB_B field-descriptor name=idB column=ID_B primarykey=true jdbc-type=Integer/ field-descriptor name=idReferenceToA column=ID_A primarykey=true jdbc-type=Integer/ reference-descriptor name=referenceToA proxy=true class-ref=TestA foreignkey field-ref=idReferenceToA/ /reference-descriptor /class-descriptor I get this sample from my projects (just changed the field/table/bean names, and simplified the beans). This works fine (may be I made some typo when changing names, so this sample could/couldn't run as is). But the main ideia is there. If you are using JavaBeans like acessors (like I do), don't forget to implement getter/setters for your objects. Best regards, Edson Richter - Original Message - From: Mauricio Montblanch To: OJB Users List Sent: Tuesday, March 23, 2004 3:16 PM Subject: Re: Newbie Proxy problem Nop, it did not work, have you any example Edson Carlos Ericksson Richter wrote: As far as you have explained, you should not get ClassCastException. First let's go analize your code: 1) Product implements InterfaceProduct. 2) ProductGroup have a products list. Ok, have you set the collection-class in the collection-descriptor to ManageableArrayList? If you have not, do it, because default is RemovalAwareCollection (you can't make cast from Collection to List, or you will get ClassCastException). Without more details is hard to give you better ideais about what's can be going wrong. Best regards, Edson Richter - Original Message - From: Mauricio Montblanch To: OJB Users List Sent: Friday, March 19, 2004 11:54 AM Subject: Newbie Proxy problem Hi I am trying to use a dynamic proxy in a 1:n relation (loading a list) but a I can 't figure out how make it work (I get a java.lang.ClassCastException when I try to get the any object), can anyone give me a simple example of how to use a dynamic proxy. Detail Clases: Product InterfaceProduct (Interface) ProductGroup (contains List products) XML: class-descriptor class=Product proxy=dynamic table=PRODUCT .. class-descriptor class=ProductGroup table=PRODUCTGROUP . . collection-descriptor name=products element-class-ref=Product inverse-foreignkey field-ref=idProductGroup/ /collection-descriptor so, when y get a product Group y get a list of products filled with objects of the type (InterfaceProduct) and I can say InterfaceProduct i=(InterfaceProduct) ptoducts.get(0); without errors but how I can materialize the Product Object - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.624 / Virus Database: 401 - Release Date: 15/3/2004 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.637 / Virus Database: 408 - Release Date: 20/3/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.637 / Virus Database: 408 - Release Date: 20/3/2004 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Newbie Proxy problem
Hi I am trying to use a dynamic proxy in a 1:n relation (loading a list) but a I can 't figure out how make it work (I get a java.lang.ClassCastException when I try to get the any object), can anyone give me a simple example of how to use a dynamic proxy. Detail Clases: Product InterfaceProduct (Interface) ProductGroup (contains List products) XML: class-descriptor class=Product proxy=dynamic table=PRODUCT .. class-descriptor class=ProductGroup table=PRODUCTGROUP . . collection-descriptor name=products element-class-ref=Product inverse-foreignkey field-ref=idProductGroup/ /collection-descriptor so, when y get a product Group y get a list of products filled with objects of the type (InterfaceProduct) and I can say InterfaceProduct i=(InterfaceProduct) ptoducts.get(0); without errors but how I can materialize the Product Object - 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]
Newbie: Problems with passing persistent Objects via a RMI-Connection
Hello, i am using the Persistence-Broker API and a mySQL-Database. My Server-Application holds persistent Objects in the following way: I have a Container-Object called ProductCon, which holds n Product-Objects in a Vector. I have made this struct persistent using a 1:n mapping and it works really fine. I would like to pass the ProductCon-Object (and the associated Product-Objects) to the Client-Application via RMI. But after having started the Client-Application, the compiler tells me that the Client-App needs the OJB-Libraries, like org.apache. ojb.broker.util.collections.RemovalAwareCollection. The point is, that I don't want to ship the client-app with these libraries. Obviously, the Persistence-Broker added some sort of Code to the ProductCon- or Product-Objects which needs the libraries. Is there any possibility to configure the Broker or what to solve this problem? I would like to just send the Objects via RMI, not the associated ojb-code. Here is the code to retreive the objects (like in the Tutorial): dbBroker = PersistenceBrokerFactory.defaultPersistenceBroker(); query = new QueryByCriteria(ProductCon.class,null); versandvorlageCon = (ProductCon)dbBroker.getObjectByQuery(query); This is used to store(like in the tutorial): dbBroker.beginTransaction(); dbBroker.store(ProductCon); dbBroker.commitTransaction(); I guess, that this is a simple newbie-problem. If there is more information/code needed, please just tell me. Thanks a lot in advance, Philipp. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie: Problems with passing persistent Objects via a RMI-Connection
Philipp, this appears to be the same problem/question asked by another posting last night. Here's the response I sent to that request: I'll try to answer your question, although I'm still somewhat new to OJB myself. OJB uses RemovalAwareCollection as the default implementation class for holding the collection instance. RemovalAwareCollection implements java.util.Collection. So, when your container class is serialized to the client, it contains a reference to the implementation class (RemovalAwareCollection), which must be available to the client either on the local classpath or via the URL class loader. You can control the class used for collection handling in the OJB.properties file. Thus, you could write your own class to handle the collection if you want to avoid distributing the OJB jar file. Steckel, Philipp wrote: Hello, i am using the Persistence-Broker API and a mySQL-Database. My Server-Application holds persistent Objects in the following way: I have a Container-Object called ProductCon, which holds n Product-Objects in a Vector. I have made this struct persistent using a 1:n mapping and it works really fine. I would like to pass the ProductCon-Object (and the associated Product-Objects) to the Client-Application via RMI. But after having started the Client-Application, the compiler tells me that the Client-App needs the OJB-Libraries, like org.apache. ojb.broker.util.collections.RemovalAwareCollection. The point is, that I don't want to ship the client-app with these libraries. Obviously, the Persistence-Broker added some sort of Code to the ProductCon- or Product-Objects which needs the libraries. Is there any possibility to configure the Broker or what to solve this problem? I would like to just send the Objects via RMI, not the associated ojb-code. Here is the code to retreive the objects (like in the Tutorial): dbBroker = PersistenceBrokerFactory.defaultPersistenceBroker(); query = new QueryByCriteria(ProductCon.class,null); versandvorlageCon = (ProductCon)dbBroker.getObjectByQuery(query); This is used to store(like in the tutorial): dbBroker.beginTransaction(); dbBroker.store(ProductCon); dbBroker.commitTransaction(); I guess, that this is a simple newbie-problem. If there is more information/code needed, please just tell me. Thanks a lot in advance, Philipp. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Larry V. Streepy, Jr. Senior Vice President and CTO Health Language, Inc.
a select OQLQuery doing an insert on commit? [newbie]
Hello, I am having the following situation and I don't know where is my error: This is the code: tx = impl.newTransaction(); tx.begin(); final OQLQuery query = impl.newOQLQuery(); query.create(select TABLE from + classtype.class.getName() + where KEY= $1); query.bind( new Long( KEYID ) ); final DList results = (DList) query.execute(); final Iterator iterator = results.iterator(); while ( iterator.hasNext() ) { dataList.add( iterator.next() ); } tx.commit(); After each commit the first row is inserted again in the table, Any suggestion about where to look? Thanks in advance! K. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: a select OQLQuery doing an insert on commit? [newbie]
I was inserting a row with a primary key of 0 (zero) by hand. That was the row that was being duplicated. The autoincrement was true for that field. I would like to learn why? : A field with autoincrement = true and a value of 0 is automatically inserted? If that is true, every time it was reading the object with the field value 0 the commit process realizes that and inserts the object with a new update key value? Am I right or just suffering from a stupid mental state? - K. katarn wrote: ... After each commit the first row is inserted again in the table, Any suggestion about where to look? Thanks in advance! K. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
OQLQuery being cached? [orb newbie]
Hi, I am executing the following code: OQLQuery query = impl.newOQLQuery(); query.create( [THEQUERY] ); DList results = (DList)query.execute(); Iterator iterator = results.iterator(); If I change some column with an external tool and then execute the code, the updated column is not reflected in the orb objects. Is there a config value or a runtime parameter that I need to change? What is going on behind the scenes here? Thanks for your help, K. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OQLQuery being cached? [orb newbie]
Are you working with DefaultCacheImpl or EmptyCacheImpl? If you are working with DefaultCacheImpl, take a look at config parameters. Otherwise, are there any exceptions (stack trace), messages (they can be very usefull if you enable higher level of logging as DEBUG). Best regards, Edson Richter Hi, I am executing the following code: OQLQuery query = impl.newOQLQuery(); query.create( [THEQUERY] ); DList results = (DList)query.execute(); Iterator iterator = results.iterator(); If I change some column with an external tool and then execute the code, the updated column is not reflected in the orb objects. Is there a config value or a runtime parameter that I need to change? What is going on behind the scenes here? Thanks for your help, K. - 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: OQLQuery being cached? [orb newbie]
Thanks for your quick answer, I cheched the OJB.properties file an I was using DefaultCacheImpl I change it to ObjectCacheEmptyImpl and now it is working as I was expecting. Now just to learn the reasons for the previous behaviour: A comment in OJB.properties: # The ObjectCacheClass entry tells OJB which concrete ObjectCache # implementation is to be used as standard cache. # Its also possible to override this entry adding object-cache elements # on jdbc-connection-descriptor level and # per class-descriptor in repository file In my repository_internal.xml I have the following line: object-cache class=org.apache.ojb.broker.cache.ObjectCacheEmptyImpl /object-cache Why it wasn't working as I was expecting? Where is the documentation about the config parameters for the cache implementations? Thanks for your help, K. [EMAIL PROTECTED] wrote: Are you working with DefaultCacheImpl or EmptyCacheImpl? If you are working with DefaultCacheImpl, take a look at config parameters. Otherwise, are there any exceptions (stack trace), messages (they can be very usefull if you enable higher level of logging as DEBUG). Best regards, Edson Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OQLQuery being cached? [orb newbie]
In real, I'm not an specialist in caches ;), but I've used with success object-cache .. tag inside class-descriptor, no elsewhere. I think I've read somewhere that is possible to configure the object-cache for the connection (or the alias), but I never reade more, and now I'm not sure. Give a try to DTD doc. Is the first place I look when in doubt. Best regards, Edson Richter Thanks for your quick answer, I cheched the OJB.properties file an I was using DefaultCacheImpl I change it to ObjectCacheEmptyImpl and now it is working as I was expecting. Now just to learn the reasons for the previous behaviour: A comment in OJB.properties: # The ObjectCacheClass entry tells OJB which concrete ObjectCache # implementation is to be used as standard cache. # Its also possible to override this entry adding object-cache elements # on jdbc-connection-descriptor level and # per class-descriptor in repository file In my repository_internal.xml I have the following line: object-cache class=org.apache.ojb.broker.cache.ObjectCacheEmptyImpl /object-cache Why it wasn't working as I was expecting? Where is the documentation about the config parameters for the cache implementations? Thanks for your help, K. [EMAIL PROTECTED] wrote: Are you working with DefaultCacheImpl or EmptyCacheImpl? If you are working with DefaultCacheImpl, take a look at config parameters. Otherwise, are there any exceptions (stack trace), messages (they can be very usefull if you enable higher level of logging as DEBUG). Best regards, Edson Richter - 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]
Newbie OQL select question - can I selectively retrieve fields?
Is it possible to retrieve only certain fields of a table through OJB OQL? Something similar to the SQL: select id, video_id from VIDEO_DATA where id=5. Doing things like select id, videoId from + VideoData.class.getName() + where id = + videoDataId doesn't seem to work. It continues retrieving the entire table row. What I'm trying to do is avoid loading a huge BLOB unless absolutely necessary. I know I could re-design the application to move the BLOB to its own table or something like that, but I don't have that option at this point. Thanks a lot, -Ara-
RE: Newbie OQL select question - can I selectively retrieve field s?
May be you could try to split the mapping of the table on 2 objects One containing the names and the id , and the other one the id and the data . And you 'll load the second class only when you need the data. B.R Thierry -Original Message- From: Ara Juljulian [mailto:[EMAIL PROTECTED] Sent: Friday, December 26, 2003 4:14 PM To: [EMAIL PROTECTED] Subject: Newbie OQL select question - can I selectively retrieve fields? Is it possible to retrieve only certain fields of a table through OJB OQL? Something similar to the SQL: select id, video_id from VIDEO_DATA where id=5. Doing things like select id, videoId from + VideoData.class.getName() + where id = + videoDataId doesn't seem to work. It continues retrieving the entire table row. What I'm trying to do is avoid loading a huge BLOB unless absolutely necessary. I know I could re-design the application to move the BLOB to its own table or something like that, but I don't have that option at this point. Thanks a lot, -Ara- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Newbie OQL select question - can I selectively retrieve field s?
You can also use the ReportQuery for doing what you want but it doesn't return objects , only the request rows . -Original Message- From: Ara Juljulian [mailto:[EMAIL PROTECTED] Sent: Friday, December 26, 2003 4:14 PM To: [EMAIL PROTECTED] Subject: Newbie OQL select question - can I selectively retrieve fields? Is it possible to retrieve only certain fields of a table through OJB OQL? Something similar to the SQL: select id, video_id from VIDEO_DATA where id=5. Doing things like select id, videoId from + VideoData.class.getName() + where id = + videoDataId doesn't seem to work. It continues retrieving the entire table row. What I'm trying to do is avoid loading a huge BLOB unless absolutely necessary. I know I could re-design the application to move the BLOB to its own table or something like that, but I don't have that option at this point. Thanks a lot, -Ara- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Newbie OQL select question - can I selectively retrieve fields?
That sounds like an interesting solution. I'll try that. Thanks. -Ara- -Original Message- From: Thierry Hanot [mailto:[EMAIL PROTECTED] Sent: Friday, December 26, 2003 7:20 AM To: 'OJB Users List' Subject: RE: Newbie OQL select question - can I selectively retrieve fields? May be you could try to split the mapping of the table on 2 objects One containing the names and the id , and the other one the id and the data . And you 'll load the second class only when you need the data. B.R Thierry -Original Message- From: Ara Juljulian [mailto:[EMAIL PROTECTED] Sent: Friday, December 26, 2003 4:14 PM To: [EMAIL PROTECTED] Subject: Newbie OQL select question - can I selectively retrieve fields? Is it possible to retrieve only certain fields of a table through OJB OQL? Something similar to the SQL: select id, video_id from VIDEO_DATA where id=5. Doing things like select id, videoId from + VideoData.class.getName() + where id = + videoDataId doesn't seem to work. It continues retrieving the entire table row. What I'm trying to do is avoid loading a huge BLOB unless absolutely necessary. I know I could re-design the application to move the BLOB to its own table or something like that, but I don't have that option at this point. Thanks a lot, -Ara- - 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]
Newbie needs help
Hello everybody, I just got started with OJB and i'm experiencing some problems. Here's the scenario that i'm trying to get to work: A DOCUMENT belongs to 1..n CATEGORY. A DOCUMENT is relevant to 0..n PRODUCT_MODELs. A DOCUMENT is written by 1..1 AUTHOR. D DOCUMENT is described by 1..n KEYWORDs. My first question is: since there are many-to-many relatioships between DOCUMENT and CATEGORY and DOCUMENT and KEYWORDS there are two join tables called DOCUMENT_CATEGORY and DOCUMENTS_KEYWORD. How does one handle join tables needed by many-to-many in OJB? All the data retrieved from the database (MySQL) should be wrapped in ValueObject Classes. Following is the repository_user.xml file that I'm using so far. Every time I'm trying to save object to the datastore or try to retrieve them I get a org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException with the following message: java.util.ArrayList not found in OJB Repository. Somebody suggested yesterday to use a List instead of a Vector (I tried Vectors first) but the result is the same. I tips, hints, suggestions would be highly appreciated. TIA. Patrick -- start of repository_user.xml -- class-descriptor class=ch.ctc.support.member.MemberVO table=member field-descriptor id=1 name=memberId column=member_id jdbc-type=BIGINT primarykey=true autoincrement=true access=anonymous/ field-descriptor id=2 name=firstName column=first_name jdbc-type=VARCHAR/ field-descriptor id=3 name=lastName column=last_name jdbc-type=VARCHAR/ field-descriptor id=4 name=userName column=user_name jdbc-type=VARCHAR/ field-descriptor id=5 name=password column=password jdbc-type=VARCHAR/ field-descriptor id=6 name=email column=email jdbc-type=VARCHAR/ field-descriptor id=7 name=companyId column=company_id jdbc-type=BIGINT/ reference-descriptor name=category class-ref=ch.ctc.suppport.CategoryVO auto-retrieve=true foreignkey field-id-ref=9/ /reference-descriptor /class-descriptor class-descriptor class=ch.ctc.support.document.DocumentVO table=document field-descriptor id=1 name=documentId column=document_id jdbc-type=BIGINT primarykey=true autoincrement=true access=anonymous/ field-descriptor id=2 name=documentName column=document_name jdbc-type=VARCHAR/ field-descriptor id=3 name=documentDescription column=document_description jdbc-type=VARCHAR/ field-descriptor id=4 name=documentVersion column=document_version jdbc-type=VARCHAR/ field-descriptor id=5 name=documentAbstract column=document_abstract jdbc-type=LONGVARBINARY/ field-descriptor
Newbie questions .please help me
Hi, Im a very new comer to this technology and dont have clear idea about persistence layer. So I decided to ask some question to this group and hopefully get a reply. Now Im using the JDBC API for the development. Im handling a large database with simple JDBC and have to generate reports continuously, which also contains lot of data as its contents. But I want to use the Persistence layer and I choose to use the OJB. Im also using struts for my application development. First of all, I have to know the basics. § Do I have to create classes for all the Tables of my database? § I have to use JOIN in my query to get the results from the database, do I have to create class for the joining in OJB? § OJB doesnt provide the aggregate function, how this could be solve in OJB? § What about the performance when handling large database and what about the memory requirements? § Between the Persistence Broker, ODMG, JDO which one I should use and why? Any suggestion on these questions will be highly appreciable. Thank you, Mahbub _ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]