Re: Interbase/Firebird prepare-testdb problem
Jon, I can't help you with the torque issues. After that I tried using using the ojbcore-schema.sql to insert the default required tables into the firebird database skipping the test torque stuff. However, I got an error when doing that: "GDS Exception. unsuccessful metadata update key size too big for index RDB$PRIMARY5". After a good deal of searching it seems that the primary key should not be greater that 256 bytes in Firebird and less than 200 if the PK is a composite. I changed the OJB_HL_SEQ TABLENAME column size to 128 (with FIELDNAME column with size 70) and finally creating the table worked. However, I don't know whether this is going to mess up OJB's sequence manager. Did you have any trouble with this? Yes, but a) We only use the persistanceBroker layer in OJB ie not ODMG. b) We use generators for our primary keys Therefore we don't need any of the tables in ojbcore-schema.sql We adjusted a copy of ojbcore-schema.sql so it will work with firebird. It is attached. Yes the problem with max index key segments is a problem (note we use Unicode_fss as our database character set which means index fields have to be even shorter). I don't think it will cause a problem with the sequence manager providing you keep your table and column names short enough to fit in the OJB_HL_SEQ table. Regards Dave -- David Warnock, Sundayta Ltd. http://www.sundayta.com iDocSys for Document Management. VisibleResults for Fundraising. Development and Hosting of Web Applications and Sites. - -- OJB_HL_SEQ - CREATE TABLE OJB_HL_SEQ ( TABLENAME VARCHAR (31) character set ASCII not null, FIELDNAME VARCHAR (31) character set ASCII not null, MAX_KEY integer, GRAB_SIZE integer, PRIMARY KEY(TABLENAME,FIELDNAME) ); - -- OJB_LOCKENTRY - CREATE TABLE OJB_LOCKENTRY ( OID_ VARCHAR (164) character set ASCII not null, TX_ID VARCHAR (34) character set ASCII not null, TIMESTAMP_ timestamp, ISOLATIONLEVEL integer, LOCKTYPE integer, PRIMARY KEY(OID_,TX_ID) ); - -- OJB_NRM - CREATE TABLE OJB_NRM ( NAME VARCHAR (250) character set ASCII not null, OID_ VARCHAR(1000), PRIMARY KEY(NAME) ); - -- OJB_DLIST - CREATE TABLE OJB_DLIST ( ID integer not null, SIZE_ integer, PRIMARY KEY(ID) ); - -- OJB_DLIST_ENTRIES - CREATE TABLE OJB_DLIST_ENTRIES ( ID integer not null, DLIST_ID integer, POSITION_ integer, OID_ VARCHAR(1000), PRIMARY KEY(ID) ); - -- OJB_DSET - CREATE TABLE OJB_DSET ( ID integer not null, SIZE_ integer, PRIMARY KEY(ID) ); - -- OJB_DSET_ENTRIES - CREATE TABLE OJB_DSET_ENTRIES ( ID integer not null, DLIST_ID integer, POSITION_ integer, OID_ VARCHAR(1000), PRIMARY KEY(ID) ); - -- OJB_DMAP - CREATE TABLE OJB_DMAP ( ID integer not null, SIZE_ integer, PRIMARY KEY(ID) ); - -- OJB_DMAP_ENTRIES - CREATE TABLE OJB_DMAP_ENTRIES ( ID integer not null, DMAP_ID integer, KEY_OID VARCHAR(1000), VALUE_OID VARCHAR(1000), PRIMARY KEY(ID) ); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: StackOverflow
IMO yes! It's the users responsibility to carefully check the semantics of the mapping repository. If you define a cyclic structure OJB has no problem. But if you define a rule "if A is Loaded then refresh also the referenced B object" another rule "if B is Loaded then refresh also the referenced A object" OJB will do exactly what you told it to do! Other O/R tools like TopLink behave similar! cheers, Thomas [EMAIL PROTECTED] wrote: Is it acceptable for OJB to cause a StackOverflow Exception (infinite recursion)? I get this when I do refresh="true" on bidirectional references. The problem isn't there if you don't say refresh, but in that case, OJB doesn't produce reliable/consistent data. David This message contains information from Equifax Inc. which may be confidential and privileged. If you are not an intended recipient, please refrain from any disclosure, copying, distribution or use of this information and note that such actions are prohibited. If you have received this transmission in error, please notify by 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]
Using ODMG / OQL queries
Hello, again. Thanks to your help a few days ago I've gotten my installation of OJB into half-working order. I'm writing with another beginner's question. I've been trying to figure it out myself for a while, to no avail. I have a class I call ProfileSimple. It contains some member variables that describe a person. I've got a table in my MySQL database that's called Profile_simple. I've written a class called ServiceImplSimple that creates an odmg implementation (named 'odmg') and opens a database. Two methods in ServiceImplSimple handle storing a ProfileSimple object and retrieving a ProfileSimple object. The storing method, storeProfileSimple, does create a record in Profile_simple. I've noticed, though, that it does not update the value of _id, the int variable that identifies the object and maps to the id column in Profile_simple. The new record in the database might have a value for id of 3 or 4, but the object's _id remains 0. A bigger problem occurs when I try to retrieve the object I just persisted with a new ProfileSimple variable. I get a series of nasty exception stack traces that each mention "Could not grab next id, failed with / This feature is not supported by this implementation". Now, I have no familiarity with OQL or object database concepts. I come from a RDBMS background. I've been cribbing different sources, including the ODMG tutorial on the OJB site. I'm sure I'm missing something in the OQL query or in the way I've set up the Service Implementation. I've included everything below: part of my ProfileSimple class, the field-descriptor for _id/id from my repository_user.xml file, the methods from ServiceImplSimple, and the stack traces. Any ideas what I'm doing wrong? Thanks, Michael class ProfileSimple { private int _id; // other code left out for brevity public int get_id() { return _id; } public void set_id(int id) { this._id = id; } } from: repository_otd.xml class ServiceImplSimple Service implementation methods: public void storeProfileSimple( ProfileSimple ps ) { try { // open transaction Transaction tx = odmg.newTransaction(); tx.begin(); // acquire write lock on new object tx.lock(ps, Transaction.WRITE); // commit transaction tx.commit(); } catch( LockNotGrantedException lnge ) { System.out.println("Locking problem for store: "); lnge.printStackTrace( ); } } public ProfileSimple getProfileSimple( int id ) { ProfileSimple foundProfile = null; Transaction tx = odmg.newTransaction(); try { // 1. open a transaction tx.begin(); // 2. get an OQLQuery object from the ODMG facade OQLQuery query = odmg.newOQLQuery(); // 3. set the OQL select statement query.create("select ProfileSimple from " + ProfileSimple.class.getName() + " where _id = " + id); // 4. perform the query and store the result in a persistent Collection DList results = (DList) query.execute(); tx.commit(); foundProfile = (ProfileSimple) results.get(0); } catch( Exception ex ) { // Roll back the transaction tx.abort( ); ex.printStackTrace( ); } return foundProfile; } [org.apache.ojb.odmg.collections.DListImpl] ERROR: Generation of new id failed Could not grab next id, failed with This feature is not supported by this implementation Creation of new sequence failed with This feature is not supported by this implementation : This feature is not supported by this implementation java.lang.UnsupportedOperationException: This feature is not supported by this implementation at org.apache.ojb.broker.platforms.PlatformDefaultImpl.createSequenceQuery( Unknown Source) at org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl.createSeq uence(Unknown Source) at org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl.getUnique Long(Unknown Source) at org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl.getUnique Id(Unknown Source) at org.apache.ojb.odmg.collections.DListImpl.generateNewId(Unknown Source) at org.apache.ojb.odmg.collections.DListImpl.(Unknown Source) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorA ccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCons tructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:274) at java.lang.Class.newInstance0(Class.java:306) at java.lang.Class.newInstance(Class.j
using dynamic proxies
In the section"using dynamic proxies" of the tutorial at http://db.apache.org/ojb/tutorial3.html , it says that a class descriptor is defined as follows:: Why class value is not set to "org.apache.ojb.broker.InterfaceArticle"? "The question of whether computers can think is like the question of whether submarines can swim.", Edsger Wybe Dijkstra (1930-2002). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to choose between JDO, ODMG and PersistenceBroker.
Which are the things that I have to consider to choose using JDO, ODMG orPersistenceBroker.? "The question of whether computers can think is like the question of whether submarines can swim.", Edsger Wybe Dijkstra (1930-2002). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Nested field question
I don't think I'm using PersistentNestedFieldMaxPerformanceImpl correctly. I have a property on a class Vehicle called tareWeight, of type Weight. Weight in turn has one property "grainAmount" of type long. I put the following field descriptor inside Vehicle: This works fine for saving the object: the grainAmount is persisted to the correct column. *But* when the object is retrieved from persistence, OJB is trying to push a correctly constructed Weight object into the grainAmount property of an empty Weight object. Why is it not trying to push the Weight object into the vehicle's "tareWeight" property? Thanks, Gareth. -- --- Gareth Cronin Analyst/Programmer Kiwiplan NZ Ltd www.kiwiplan.com Ph 2727622 x854 --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Help Deploying an OjbStorePMF factory on JBOSS
Hi, I would like to have my OjbStorePMF factory properly deployed on a JBOSS server , unfortunately an appropriate MBean is not provided .. Should I use the (J2EE deployable) PBFactory and modify org.apache.ojb.jdori.sql.OjbStoreConnector so it looks up for PBFactory on a JNDI context ? If you have any hints or advices , please let me know cheers christian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: StackOverflow
On Thu, Apr 03, 2003 at 04:07:40PM -0500, [EMAIL PROTECTED] wrote: > The problem isn't there if you don't say refresh, but in that > case, OJB doesn't produce reliable/consistent data. Question is, can we expect that consistency is the responsibility of OJB? I think db consistency should be done at the db level (using triggers). Oki - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
repository.xml question
Which of the files in the repository.xml hierarchy do I really need if I am using OJB in a servlet based app under Weblogic? I know I need repository.xml, repository_database.xml, and repository_user.xml. How about repository_junit.xml, repository_ejb.xml, repository_internal.xml, and repository_jdo.xml? If I do need them, are there any caveats on how they need to be set up? thanks, Bonnie MacKellar
RE: ODMG vs. PB
I use both the PB and ODMG in the same accessor class. I use PB to do all the read only processing and then ODMG when I will be updating or adding to the database. I've only done a small bit of testing using this methodology however. cheers, gary -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, April 03, 2003 12:44 PM To: OJB Users List Subject: Re: ODMG vs. PB It's beacuse ODMG is a full fledged Object transaction manager. It does a full tracking of object states during transactions etc. This causes all the overhead. The "real" persistence work is done with the underlying PB API and is not slower than native PB operations. cheers, Thomas Jacob Hookom wrote: > Looking at the performance benchmarks at OJB's page, there's a dramatic > difference in speed between ODMG and PB implementations. Is this because of > the object locking features with ODMG, or is it because ODMG uses PB and > that extra adapter layer causes slow downs? > > -Jacob > > > - > 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: Separating LocalTxManager and JTATxManager Use
Armin, Thanks. Unfortunately, would seem to be stuck. Option 1 requires separate J2EE container instances, to get around singleton issues. We are not keen on this. We would like to retain option to deploy web and ejb apps to one container. Ideally would be able to bootstrap 1..N PersistenceBrokerFactory instances and explicitly configure each, allowing that configuration to cascade down through any PersistentBroker instances and child resources created from that factory. Would have to tackle some of the singleton issues to do this I believe. Thinking it might all be mute until/unless there is Transaction Synchronization support for PersistentBroker API as well. Not sure what to do at this point. Andy > -Original Message- > From: Armin Waibel [mailto:[EMAIL PROTECTED] > Sent: Thursday, April 03, 2003 10:19 AM > To: OJB Users List > Subject: Re: Separating LocalTxManager and JTATxManager Use > > > Hi Andrew, > > - Original Message - > From: "Andrew Gilbert" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, April 03, 2003 12:57 AM > Subject: Separating LocalTxManager and JTATxManager Use > > > Have a question trying to use OJB under a J2EE environment. If one > deploys web and ejb components under one web application, what is best > means to ensure proper TxManager is employed? The > configuration appears > to be global. > > Right > > Would seem that web code would want a LocalTxManager, EJB's > would want a > JTATxManager. Is this not the case? > > Right again. Except for the PB-api this does currently not use the > Transaction Synchronization mechanism. But I want to add this too. > > Options include: > > 1. Separate web and ejb into separate applications for deployment, and > configure each according to needs. > > seems for me the best solution > > 2. Create two PBFactory instances, one configured for local > and one for > JTA? > > Will not work because there are some more j2ee specific configuration > properties. > > 3. Implement custom JTATxFactory and make it smart enough to detect if > under JTS or not and act accordingly? > > see 2 / should be possible if we change the > ConnectionFactoryManagedImpl > too. > > Detecting and ensuring use of container datasource is not an issue, as > can add JdbcConnectionDescriptor at runtime. > > A related question is, does any of this matter when just using PB API > and not ODMG? One hopes it does somewhat, as don't want > commits/rollbacks going through unless container is happy. > > As I said above, currently the PB-api does not use > Synchronization, thus > it's different > from the ODMG-api. > > regards, > Armin > > Thanks. > > > > - > 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: OJB date => jdbc date is not saving time part(Scanned for viruses: NotesAdmin)
In the repository_*.xml file specify the type as TIMESTAMP but leave it as DATE in oracle. Sincerely, Vladimir Berezniker Sr. Programmer Analyst Staten Island University Hospital [EMAIL PROTECTED] 04/03/2003 06:39 PM Please respond to "OJB Users List" To: "OJB Users List" <[EMAIL PROTECTED]> cc: Subject:Re: OJB date => jdbc date is not saving time part(Scanned for viruses: Notes Admin) Thanks for your reply. The actual Oracle field is DATE type and I cannot change it to TIMESTAMP (DBA will kill me ;-)). Therefore the jdbc type must be DATE. I ´ve tested using java.util.Date but I did not find a field conversion attribute conversion method to jdbc type DATE. Hope you can help us. Thanks in advance, Gustavo Faerman Buenos Aires, Argentina. <[EMAIL PROTECTED] iuh.edu> To: "OJB Users List" <[EMAIL PROTECTED]> cc: 03/04/2003 Subject: Re: OJB date => jdbc date is not saving time part(Scanned 15:40 for viruses: Notes Admin) Please respond to "OJB Users List" If I am not mistaken java.sql.Date does not have a time part. You can use java.sql.Timestamp or you can use java.util.Date (which contains date & time) and use attribute conversion ="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampFieldConversion" Hope this helps, Vladimir Berezniker Sr. Programmer Analyst Staten Island University Hospital [EMAIL PROTECTED] 04/03/2003 03:47 PM Please respond to "OJB Users List" To: [EMAIL PROTECTED] cc: Subject:OJB date => jdbc date is not saving time part(Scanned for viruses: Notes Admin) Hi all, I´m saving a java.sql.date to an Oracle field using OJB DATE mapping. The java.sql.date ojbect is being set with system date & time. obj.lastModifDate(new java.sql.Date(System.currentTimeMillis())); // Lets say ,with the right mask it would be 03/04/2003 15:40:17. When we retrieve the date from the database it´s being recorded as 03/04/2003 12:00:00, the real time is lost. I really do not know how to fix it. Could anyone help us on this? Regards, Gustavo Faerman - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OJB date => jdbc date is not saving time part(Scanned for viruses: NotesAdmin)
Thanks for your reply. The actual Oracle field is DATE type and I cannot change it to TIMESTAMP (DBA will kill me ;-)). Therefore the jdbc type must be DATE. I ´ve tested using java.util.Date but I did not find a field conversion attribute conversion method to jdbc type DATE. Hope you can help us. Thanks in advance, Gustavo Faerman Buenos Aires, Argentina. <[EMAIL PROTECTED] iuh.edu> To: "OJB Users List" <[EMAIL PROTECTED]> cc: 03/04/2003 Subject: Re: OJB date => jdbc date is not saving time part(Scanned 15:40 for viruses: Notes Admin) Please respond to "OJB Users List" If I am not mistaken java.sql.Date does not have a time part. You can use java.sql.Timestamp or you can use java.util.Date (which contains date & time) and use attribute conversion ="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampFieldConversion" Hope this helps, Vladimir Berezniker Sr. Programmer Analyst Staten Island University Hospital [EMAIL PROTECTED] 04/03/2003 03:47 PM Please respond to "OJB Users List" To: [EMAIL PROTECTED] cc: Subject:OJB date => jdbc date is not saving time part(Scanned for viruses: Notes Admin) Hi all, I´m saving a java.sql.date to an Oracle field using OJB DATE mapping. The java.sql.date ojbect is being set with system date & time. obj.lastModifDate(new java.sql.Date(System.currentTimeMillis())); // Lets say ,with the right mask it would be 03/04/2003 15:40:17. When we retrieve the date from the database it´s being recorded as 03/04/2003 12:00:00, the real time is lost. I really do not know how to fix it. Could anyone help us on this? Regards, Gustavo Faerman - 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]
StackOverflow
Is it acceptable for OJB to cause a StackOverflow Exception (infinite recursion)? I get this when I do refresh="true" on bidirectional references. The problem isn't there if you don't say refresh, but in that case, OJB doesn't produce reliable/consistent data. David This message contains information from Equifax Inc. which may be confidential and privileged. If you are not an intended recipient, please refrain from any disclosure, copying, distribution or use of this information and note that such actions are prohibited. If you have received this transmission in error, please notify by e-mail [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ODMG vs. PB
It's beacuse ODMG is a full fledged Object transaction manager. It does a full tracking of object states during transactions etc. This causes all the overhead. The "real" persistence work is done with the underlying PB API and is not slower than native PB operations. cheers, Thomas Jacob Hookom wrote: Looking at the performance benchmarks at OJB's page, there's a dramatic difference in speed between ODMG and PB implementations. Is this because of the object locking features with ODMG, or is it because ODMG uses PB and that extra adapter layer causes slow downs? -Jacob - 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]
new eclipse plugin for OJB version 1.0.rc1
Hello, I made a new version (1.0) of the eclips plugin for OJB. It supports now the structure of the repository.xml of the OJB version 1.0.rc1. Download the plugin from: http://www.impart.ch/download/ If you still use the plugin 0.7.1 you should add three now properties to the ImpartOJBGenerator.properties file: - jcd-alias= - default-connection= - batch-mode= regards Matthias Roth Dipl. Ing. HTL in Wirtschaftsinformatik impart Software Engineering GmbH Chasseralstrasse 13 Postfach CH-3063 Ittigen Phone +41 (0)31 922 39 25 Fax +41 (0)31 922 39 18 EMail mailto:[EMAIL PROTECTED] Homepagehttp://www.impart.ch
Re: JDO query question
Hi Susanne, Susanne Sherba wrote: I'm using the JDO API and 1.0.rc1 right now. I was expecting that a query would return a Collection of persistent objects. However, it appears to return objects that are not persistent. (I've included my code below.) Can someone clear up my confusion? :-) Mh, I'm puzzled. :-) The executed query looks up objects from the DB. So the returned instances are as persistent as it gets ! IMO the problem is that the JDORI query mechanism works different than it's lookup by ID mechanism. Maybe I must perform some additional undocumented state changes on all instance returned by query. Debugging through the JDORI mechanism will tell you more... cheers, thomas Thanks in advance! Susanne - PersistenceBrokerFactory.defaultPersistenceBroker().clearCache(); tx.begin(); q = manager.newQuery(CollectionImpl.class); result = (java.util.Collection) q.execute(); Iterator i = result.iterator(); while (i.hasNext()) { CollectionImpl c = (CollectionImpl) i.next(); System.out.println("Is persistent = " + JDOHelper.isPersistent(c)); // Here JDOHelper.isPersistent(c) is false // However, I've added: Identity oid = new Identity(c); Object nc = manager.getObjectById(oid, false); System.out.println("After getObjectById: is persistent = " + JDOHelper.isPersistent(nc)); // now JDOHelper.isPersistent(nc) is true } tx.commit(); - 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: Invalid argument value: Not unique table/alias: 'A1'
hi João, thanks for your testcase. i commited a patch to SqlQueryStatement. the sql produced is now as follows: SELECT A0.idInternal,A0.name FROM A A0 INNER JOIN AB A1 ON A0.idInternal=A1.keyA INNER JOIN B A2 ON A1.keyB=A2.idInternal INNER JOIN C A3 ON A2.idInternal=A3.keyB INNER JOIN D A4 ON A2.idInternal=A4.keyB WHERE (A3.idInternal = '101' ) AND A4.idInternal = '202' thanks jakob João Luz wrote: I'm using rc1 version. -Original Message- From: Jakob Braeuchi [mailto:[EMAIL PROTECTED] Sent: quarta-feira, 2 de Abril de 2003 18:06 To: OJB Users List Subject: Re: Invalid argument value: Not unique table/alias: 'A1' hi João, what version of ojb do you use ? jakob João Luz wrote: Hi, Look to this simple case: A --- AB --- B C | D 1- A got a M:N relation with B 2 - B got a 1:M to C and D The M:N relationship is implemented with collections (indirection-table AB). If I want to get "All A's that have B's associated that have C's and D's with some property equals to something", i.e, if I do this OQL query: select all from A.class.getName() where bs.cs.idInternal = $1 and bs.ds.idInternal = $2 The execution result of this query is this: SELECT A0.name,A0.idInternal FROM A A0 INNER JOIN AB A1 ON A0.idInternal=A1.keyA INNER JOIN B A2 ON A1.keyB=A2.idInternal INNER JOIN AB A1 ON A0.idInternal=A1.keyA INNER JOIN B A2 ON A1.keyB=A2.idInternal WHERE ( A2.idInternal = ? ) AND (A2.idInternal = ? ) Well this don't works because A1 alias is duplicated. The error tells me that: ERROR [main] (?:?) - SQLException during the execution of the query (for a A): Invalid argument value: Not unique table/alias: 'A1' java.sql.SQLException: Invalid argument value: Not unique table/alias: 'A1' at com.mysql.jdbc.MysqlIO.sendCommand(Unknown Source) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(Unknown Source) at com.mysql.jdbc.Connection.execSQL(Unknown Source) at com.mysql.jdbc.PreparedStatement.executeQuery(Unknown Source) at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown Source) at org.apache.ojb.broker.accesslayer.RsIterator.(Unknown Source) at org.apache.ojb.broker.singlevm.RsIteratorFactoryImpl.createRsIterator(Unkno w n Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getRsIteratorFromQuery ( Unknown Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getIteratorFromQuery(U n known Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(U n known Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(U n known Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(U n known Source) at org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.getCollectionByQ u ery(Unknown Source) at org.apache.ojb.odmg.oql.OQLQueryImpl.execute(Unknown Source) at Main.main(Main.java:54) Well, my question is: Am I doing something wrong or sqlGenerator got a bug/feature? :) Thanks in advance João PS: Mapping is below: PS2:Now the database sql: /* Mascon Dump Source Host: localhost Source Server Version: 3.23.53-max-nt Source Database: testDB Date: 2003-04-01 11:35:58 */ use testDB ; # # Table structure for A # drop table if exists A; create table A ( idInternal int(11) not null default '0', name varchar(50) not null, primary key (idInternal)) type=MyISAM; # # Table structure for AB # drop table if exists AB; create table AB ( keyA int(11) not null default '0', keyB int(11) not null default '0') type=MyISAM; # # Table structure for B # drop table if exists B; create table B ( idInternal int(11) not null default '0', keyA int(11) not null default '0', name varchar(50) not null, primary key (idInternal)) type=MyISAM; # # Table structure for C # drop table if exists C; create table C ( idInternal int(11) not null default '0', keyB int(11) not null default '0', primary key (idInternal)) type=MyISAM; # # Table structure for D # drop table if exists D; create table D ( idInternal int(11) not null default '0', keyB int(11) not null default '0', primary key (idInternal)) type=MyISAM; - To unsubs
AW: OJB RC2 with Oracle 9i2 OS X Beta
Hi, an evergreen problem with oracle (asked and answered several times here): you can only have on LONG or LONG RAW column in one table with oracle, unfortunately OJB_DMAP_ENTRIES is defined with two such fields. We changed the datatype for column VALUE_OID to VARCHAR2(2048) (in the repository and in the database) and it works (so far). Don't know a better way to get it working and don't know of potential side effects yet. Max > -Ursprüngliche Nachricht- > Von: Julio Barros [mailto:[EMAIL PROTECTED] > Gesendet: Donnerstag, 3. April 2003 20:17 > An: [EMAIL PROTECTED] > Betreff: OJB RC2 with Oracle 9i2 OS X Beta > > > Hi, > > I'm trying to set up OJB RC2 to work with my Oracle 9i OS X > Beta. I've > modified my build.properties to use oracle oracle.properties > to specify > the connection url but when trying to execute a prepare-tutorials to > test out the system I get the following error: > > [torque-insert-sql] Failed to execute: CREATE TABLE > OJB_DMAP_ENTRIES ( > ID NUMBER NOT NULL, DMAP_ID NUMBER NOT NULL, KEY_OID LONG RAW, > VALUE_OID LONG RAW ) > [torque-insert-sql] java.sql.SQLException: ORA-01754: a table may > contain only one column of type LONG > > Any ideas? > > Thanks, > > Julio > > > - > 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]
ODMG vs. PB
Looking at the performance benchmarks at OJB's page, there's a dramatic difference in speed between ODMG and PB implementations. Is this because of the object locking features with ODMG, or is it because ODMG uses PB and that extra adapter layer causes slow downs? -Jacob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie OJB problem
RE: Newbie OJB problemThanks, Pete, it turns out that ant wasn't copying over the latest repository_user.xml file and thus it was using an old copy which, surprisingly, only had the two columns, so you can chalk that one up to user-error. The other comments were helpful. One other question for the group. Say I have a collection of UserRole objects in my Users object (see definition below), the user_id field is auto_increment so I cannot set the user_id attribute on any of the UserRoles objects until I persist the User object. If i have auto-update set to on, will this be taken care of automagically? i.e. will OJB persist the users object, and then call the userRole.setUserId() method automatically when the Users object is stored? Thanks again, Chuck Grohowski - Original Message - From: McKinstry, Pete (HQP) To: 'charles grohowski' ; OJB Users List Sent: Thursday, April 03, 2003 12:38 PM Subject: RE: Newbie OJB problem I'm a relative newbie to OJB, but i'll give this one a whirl. See comments preceded w/ pgm: -Original Message- From: charles grohowski [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 02, 2003 3:16 PM To: OJB Users List Subject: Newbie OJB problem Hi, I recently set up OJB to work with a MySQL database and am having a problem storing an UserRoles object I created. Here are snippets from the repository_user.xml and other important files. repository_user.xml: ... more here, cut for brevity Classes: UserRoles.java public class UserRoles { private Integer userId; public void setUserId( Integer userId ) { this.userId = userId; } public Integer getUserId() { return userId; } private String logon; public void setLogon( String logon ) { this.logon = logon; } public String getLogon() { return logon; } private String roleName; public void setRoleName( String roleName ) { this.roleName = roleName; } public String getRoleName() { return roleName; } private Users users; public void setUsers( Users users ) { this.users = users; } public Users getUsers() { return users; } } Users.java public class Users { private Integer id; public void setId( Integer id ) { this.id = id; } public Integer getId() { return id; } private String logon; public void setLogon( String logon ) { this.logon = logon; } public String getLogon() { return logon; } private Vector userRoles; public void setUserRoles( Vector userRoles ) { this.userRoles = userRoles; } public Vector getUserRoles() { return userRoles; } // cut for brevity as well } 1st question: When I store a User object which has a Vector of User Roles should these UserRole objects be persisted automagically? (they're not currently and I have to store all the objects related to a user separately). If this is possible, how is it accomplished? pgm: if you set auto-update=true in your mapping, (similar to auto-retrieve flag) the relationship objects will be automagically persisted when you persist the container (in your case, saving the User will save the UserRoles stored in the User's collection) 2nd question: Am I mapping this relationship correctly? (It's a 1:n relationship Users:UserRoles ) pgm: seems right to me. Now the real problem, when i go to store a UserRoles object, I get the following debug code: [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL: SELECT role_name,logon FROM user_roles WHERE logon = ? AND role_name = ? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL: INSERT INTO user_roles (logon,role_name) VALUES ( ?, ? ) Why is this totally ignoring my user_id field even though it's specified as a primary key? pgm: Not sure. I've never looked @ the SQL that OJB generates. Are you assigning the PK field yourself. If so, you can set auto-increment to false in the descriptor, which I believe will ensure that the PK strategy specified in your OJB.properties file will not be used. This might help. Perhaps someone else can help w/ this one... Any help is appreciated as I am wearing a hole in my desk from banging my head on it. Thanks for any and all help ( I thought I mapped things correctly according to the tutorials ), Chuck Grohowski
Re: OJB date => jdbc date is not saving time part(Scanned for viruses: NotesAdmin)
If I am not mistaken java.sql.Date does not have a time part. You can use java.sql.Timestamp or you can use java.util.Date (which contains date & time) and use attribute conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampFieldConversion" Hope this helps, Vladimir Berezniker Sr. Programmer Analyst Staten Island University Hospital [EMAIL PROTECTED] 04/03/2003 03:47 PM Please respond to "OJB Users List" To: [EMAIL PROTECTED] cc: Subject:OJB date => jdbc date is not saving time part(Scanned for viruses: Notes Admin) Hi all, I´m saving a java.sql.date to an Oracle field using OJB DATE mapping. The java.sql.date ojbect is being set with system date & time. obj.lastModifDate(new java.sql.Date(System.currentTimeMillis())); // Lets say ,with the right mask it would be 03/04/2003 15:40:17. When we retrieve the date from the database it´s being recorded as 03/04/2003 12:00:00, the real time is lost. I really do not know how to fix it. Could anyone help us on this? Regards, Gustavo Faerman - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: OJB date => jdbc date is not saving time part
Use java.sql.Timestamp instead. Date is used to indicate dates only, Time indicates time only, Timestamp is both date and time. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, April 03, 2003 12:47 PM To: [EMAIL PROTECTED] Subject: OJB date => jdbc date is not saving time part Hi all, I´m saving a java.sql.date to an Oracle field using OJB DATE mapping. The java.sql.date ojbect is being set with system date & time. obj.lastModifDate(new java.sql.Date(System.currentTimeMillis())); // Lets say ,with the right mask it would be 03/04/2003 15:40:17. When we retrieve the date from the database it´s being recorded as 03/04/2003 12:00:00, the real time is lost. I really do not know how to fix it. Could anyone help us on this? Regards, Gustavo Faerman - 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]
OJB date => jdbc date is not saving time part
Hi all, I´m saving a java.sql.date to an Oracle field using OJB DATE mapping. The java.sql.date ojbect is being set with system date & time. obj.lastModifDate(new java.sql.Date(System.currentTimeMillis())); // Lets say ,with the right mask it would be 03/04/2003 15:40:17. When we retrieve the date from the database it´s being recorded as 03/04/2003 12:00:00, the real time is lost. I really do not know how to fix it. Could anyone help us on this? Regards, Gustavo Faerman - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
OJB RC2 with Oracle 9i2 OS X Beta
Hi, I'm trying to set up OJB RC2 to work with my Oracle 9i OS X Beta. I've modified my build.properties to use oracle oracle.properties to specify the connection url but when trying to execute a prepare-tutorials to test out the system I get the following error: [torque-insert-sql] Failed to execute: CREATE TABLE OJB_DMAP_ENTRIES ( ID NUMBER NOT NULL, DMAP_ID NUMBER NOT NULL, KEY_OID LONG RAW, VALUE_OID LONG RAW ) [torque-insert-sql] java.sql.SQLException: ORA-01754: a table may contain only one column of type LONG Any ideas? Thanks, Julio - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JDO query question
I'm using the JDO API and 1.0.rc1 right now. I was expecting that a query would return a Collection of persistent objects. However, it appears to return objects that are not persistent. (I've included my code below.) Can someone clear up my confusion? :-) Thanks in advance! Susanne - PersistenceBrokerFactory.defaultPersistenceBroker().clearCache(); tx.begin(); q = manager.newQuery(CollectionImpl.class); result = (java.util.Collection) q.execute(); Iterator i = result.iterator(); while (i.hasNext()) { CollectionImpl c = (CollectionImpl) i.next(); System.out.println("Is persistent = " + JDOHelper.isPersistent(c)); // Here JDOHelper.isPersistent(c) is false // However, I've added: Identity oid = new Identity(c); Object nc = manager.getObjectById(oid, false); System.out.println("After getObjectById: is persistent = " + JDOHelper.isPersistent(nc)); // now JDOHelper.isPersistent(nc) is true } tx.commit(); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic OR Maping
Can you please elaborate on what you mean by "in a per thread manner or global"? I thought OJB can only have a global metadata definition. Are you implying by "per thread" to mean that each application can dynamically load its own metadata using the same OJB instance? If that is the case, then it solves the problem of metadata conflicts for co-existing applications sharing a single OJB instance. Please clarify/confirm this. regards, Rajeev - Original Message - From: "Armin Waibel" <[EMAIL PROTECTED]> To: "OJB Users List" <[EMAIL PROTECTED]> Sent: Thursday, April 03, 2003 7:11 AM Subject: Re: Dynamic OR Maping > Hi, > > it is possible to change the persistent object metadata > (all ClassDescriptors) in a per thread manner or global > using the org.apache.ojb.broker.metadata.MetadataManager. > > > Is this possbile ? If not, where can I get in dynamic OJB config ? > It is also possible to load and merge > additional repository class-descriptor at runtime with > global repository file. > > regards, > Armin > > > - Original Message - > From: "Goncalo Luiz" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, April 03, 2003 2:07 AM > Subject: Dynamic OR Maping > > > Hello. > > I need to use a variable in my repository-user.xml file to use multiple > instances of the same application, each one using a differente table for > the same classes. > . > For example, if I run an instance of MyApp I'd like it to something like > this: > > table="instance123 > > but in another instance if may look like > > table="instance342 > > What I need is something like > >table=${some_variable_in_java_context} > > Is this possbile ? If not, where can I get in dynamic OJB config ? > > I hope I was clear enough to get answers :-) > > Thanx in advance > > Gonçalo Luiz - IST 4º Ano (PSI) > [EMAIL PROTECTED] > > Gonçalo Luiz - IST 4º Ano (PSI) > [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]
temporary fix for null foreign key references
Hello everybody, does anybody has a workaraound or temporary patch for the null foreign key reference bug in OJB? This bug was reported twice in scarab. It occurs when inserting or updating objects that have a null foreign key reference. When using primitives (integer etc. ) as a primary key for the referenced entity OJB tries to set the reference to an object with 0 as the primary key. This is not intended and may result in underlying "parent key not found" exceptions when there is no entity with primay key 0. Can someone point me the right place in the source where I can temporarily make some changes to get this to work? Thanks a lot, Vincenz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Newbie OJB problem
I'm a relative newbie to OJB, but i'll give this one a whirl. See comments preceded w/ pgm: -Original Message- From: charles grohowski [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 02, 2003 3:16 PM To: OJB Users List Subject: Newbie OJB problem Hi, I recently set up OJB to work with a MySQL database and am having a problem storing an UserRoles object I created. Here are snippets from the repository_user.xml and other important files. repository_user.xml: ... more here, cut for brevity Classes: UserRoles.java public class UserRoles { private Integer userId; public void setUserId( Integer userId ) { this.userId = userId; } public Integer getUserId() { return userId; } private String logon; public void setLogon( String logon ) { this.logon = logon; } public String getLogon() { return logon; } private String roleName; public void setRoleName( String roleName ) { this.roleName = roleName; } public String getRoleName() { return roleName; } private Users users; public void setUsers( Users users ) { this.users = users; } public Users getUsers() { return users; } } Users.java public class Users { private Integer id; public void setId( Integer id ) { this.id = id; } public Integer getId() { return id; } private String logon; public void setLogon( String logon ) { this.logon = logon; } public String getLogon() { return logon; } private Vector userRoles; public void setUserRoles( Vector userRoles ) { this.userRoles = userRoles; } public Vector getUserRoles() { return userRoles; } // cut for brevity as well } 1st question: When I store a User object which has a Vector of User Roles should these UserRole objects be persisted automagically? (they're not currently and I have to store all the objects related to a user separately). If this is possible, how is it accomplished? pgm: if you set auto-update=true in your mapping, (similar to auto-retrieve flag) the relationship objects will be automagically persisted when you persist the container (in your case, saving the User will save the UserRoles stored in the User's collection) 2nd question: Am I mapping this relationship correctly? (It's a 1:n relationship Users:UserRoles ) pgm: seems right to me. Now the real problem, when i go to store a UserRoles object, I get the following debug code: [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL: SELECT role_name,logon FROM user_roles WHERE logon = ? AND role_name = ? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL: INSERT INTO user_roles (logon,role_name) VALUES ( ?, ? ) Why is this totally ignoring my user_id field even though it's specified as a primary key? pgm: Not sure. I've never looked @ the SQL that OJB generates. Are you assigning the PK field yourself. If so, you can set auto-increment to false in the descriptor, which I believe will ensure that the PK strategy specified in your OJB.properties file will not be used. This might help. Perhaps someone else can help w/ this one... Any help is appreciated as I am wearing a hole in my desk from banging my head on it. Thanks for any and all help ( I thought I mapped things correctly according to the tutorials ), Chuck Grohowski
Re: Problems when using composite primary keys
Thx Jakob, I've changed the IndirectionHandler class in the release 2 as you recomended: public Object invoke(Object proxy, Method method, Object[] args) { Object subject = null; try { subject = getRealSubject(); // handle toString differently for non-materialized proxies // to avoid materialization due to logging. if (subject == null) { if (method.getName() == "toString") { return "unmaterialized proxy for " + getIdentity(); } else { return null; } } else { Method m = subject.getClass().getMethod(method.getName(), method.getParameterTypes()); return m.invoke(subject, args); } } catch (Exception e) { log.error("Method invoking failed for method *"+method.getName()+"* on object "+subject, e); throw new PersistenceBrokerException("Error invoking:"+method.getName(),e); } } The following are entries in my descriptors files: ... ... I still get this error: [DEFAULT] WARN: OJB broker could not materialize com.fedex.data.CorePieceCounterImpl{188119,JP} submit flag: null [DEFAULT] WARN: OJB broker could not materialize com.fedex.data.CorePieceCounterImpl{188119,JP} Type flag: null [org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] INFO: Destroy object was called, try to close connection: [EMAIL PROTECTED] Any help on this is appreciated. Thx regards, Janet - Original Message - From: "Jakob Braeuchi" <[EMAIL PROTECTED]> To: "OJB Developers List" <[EMAIL PROTECTED]> Sent: Tuesday, April 01, 2003 05:15 Subject: Re: Problems when using composite primary keys > hi janet, > > sorry, i overlooked the message in your stacktrace. > the following sample using multiple keys works for me: > > class="brj.ojb.MultiPkParent" > table="multipkparent" > > > name="id1" > column="key1" > jdbc-type="INTEGER" > primarykey="true" > /> > name="id2" > column="key2" > jdbc-type="VARCHAR" > primarykey="true" > /> > name="field1" > column="field1" > jdbc-type="VARCHAR" > /> > name="field2" > column="field2" > jdbc-type="VARCHAR" > /> > name="children" > element-class-ref="brj.ojb.MultiPkChild" > auto-retrieve="true" > auto-update="true" > auto-delete="true" > > > > > > > > class="brj.ojb.MultiPkChild" > table="multipkchild" > proxy="dynamic" >> > name="c_id1" > column="parent_key1" > jdbc-type="INTEGER" > primarykey="true" > /> > name="c_id2" > column="parent_key2" > jdbc-type="VARCHAR" > primarykey="true" > /> > name="field1" > column="field1" > jdbc-type="VARCHAR" > primarykey="true" > /> > name="parent" > class-ref="brj.ojb.MultiPkParent" > > > > > > > > jakob > > Jakob Braeuchi wrote: > > > hi janet, > > > > don't you get an error message like "[DEFAULT] WARN: OJB broker could > > not materialize " in the log before the npe occurs ? > > do you have access to the source of ojb ? > > if yes, please try to replace the following method in IndirectionHandler: > > > > public Object invoke(Object proxy, Method method, Object[] args) > > { > > Object subject = null; > > try > > { > > subject = getRealSubject(); > > // handle toString differently for > > non-materialized proxies > > // to avoid materialization due to logging. > > if (subject == null) > > { > > if (method.getName() == "toString") > > { > > return "unmaterialized proxy for " + getIdentity(); > > } > > else > > { > > return null; > > } > > } > > else > > { > > Method m = > > subject.getClass().getMethod(method.getName(), > > method.getParameterTypes()); > > return m.invoke(subject, args); > > } > > } > > catch (Exception e) > > { > > log.error("Method invoking failed for method > > *"+method.getName()+"* on object "+subject, e); > > throw new PersistenceBrokerException("Error > > invoking:"+method.getName(),e); > > } > > } > > > > > > hth > > jakob > > > > Janet Song wrote: > > > >> Hi, > >> > >> Thanks. Got that problem solve
RE: Problem with the assignement of primary keys.
and public class Customer { protected long id; don't match. You either need to set the jdbc-type to BIGINT in your class-descriptor or change id to int in class Customer. What type is CUS_ID in your database? -Original Message- From: PICARD Jérôme [mailto:[EMAIL PROTECTED] Sent: Thursday, April 03, 2003 9:50 AM To: '[EMAIL PROTECTED]' Subject: Problem with the assignement of primary keys. Hello, I have just recovered the last version of OJB. This my problem : When I store the object "Customer" I obtain the following exception. This exception occurs on assignement of the primary key. Can you help me ? please. Thanks java.lang.ClassCastException: java.lang.Long at com.ashna.jturbo.driver.x.setObject(x.java) at org.apache.ojb.broker.platforms.PlatformDefaultImpl.setObjectForStatement(Pl atformDefaultImpl.java:230) at org.apache.ojb.broker.accesslayer.StatementManager.bindInsert(StatementManag er.java:493) at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeInsert(JdbcAccessImp l.java:198) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.storeToDb(PersistenceBr okerImpl.java:1835) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.store(PersistenceBroker Impl.java:1759) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.store(PersistenceBroker Impl.java:638) at org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.store(DelegatingP ersistenceBroker.java:152) at org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.getSequence(S equenceManagerHighLowImpl.java:288) at org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.getUniqueLong (SequenceManagerHighLowImpl.java:190) at org.apache.ojb.broker.util.sequence.AbstractSequenceManager.getUniqueId(Abst ractSequenceManager.java:243) at org.apache.ojb.broker.util.sequence.AbstractSequenceManager.getUniqueValue(A bstractSequenceManager.java:158) at org.apache.ojb.broker.util.BrokerHelper.getAutoIncrementValue(BrokerHelper.j ava:317) at org.apache.ojb.broker.util.BrokerHelper.getKeyValues(BrokerHelper.java:218) at org.apache.ojb.broker.Identity.init(Identity.java:198) at org.apache.ojb.broker.Identity.(Identity.java:135) at aston.banque.test.RendezVousTechno.testCreerClientsComptes(RendezVousTechno. java:57) at aston.banque.test.RendezVousTechno.main(RendezVousTechno.java:133) rethrown as org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException: Could not init Identity for given object class aston.banque.domaine.client.Client: java.lang.Long at org.apache.ojb.broker.Identity.init(Identity.java:205) at org.apache.ojb.broker.Identity.(Identity.java:135) at aston.banque.test.RendezVousTechno.testCreerClientsComptes(RendezVousTechno. java:57) at aston.banque.test.RendezVousTechno.main(RendezVousTechno.java:133) For the assignment of the primary keys I use the class "SequenceManagerHiLowImpl". Here the mapping of the class "Customer", Here the Jdbc connection descriptor Here the classe "Customer" public class Customer { protected long id; protected String name; protected String firstname; protected String password; protected String login; protected int version; public Customer () { } public Customer (String pLogin,String pPassword){ this.login = pLogin; this.password = pPassword; } public long getId() { return id; } public String getName() { return name; } public String getPassword() { return password; } public void setId(long id) { this.id = id; } public void setName(String name) { this.name = name; } public void setPassword(String password) { this.password = password; } public String getFirstname() { return firstname; } public void setFirstname(String firstname) { this.firstname= firstname; } public String getLogin() { return login; } public void setLogin(String login) { this.login = login; } public int getVersion() { return version; } public void setVersion(int version) { this.version = version; } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
1-1 relationships
Hi, I'm just starting to use OJB, and I have a question about 1:1 relationships. If I understand the docs, for every object reference, I need *two* attributes in the source class, is that correct? for example: public class Car{ int id; Person driver; int driver_id; } public class Person{ int id; String name; } which maps to the DB tables Table CAR { ID INT NOT NULL PRIMARY KEY DRIVER_ID INT } Table PERSON{ ID INT NOT NULL PRIMARY KEY, NAME VARCHAR2 } and in the repository.xml I would have: If this is corect, is the Car class code responsible for making sure the driver_id and the reference to the driver object remain in sync? What if I change the driver reference to point to another Person object and try to save it back to the db without updating the driver_id attribute to reflect the new person id? Or likewise change the driver_id without updating the reference? Maybe I'm mis-interpreting the docs? Thanks, --Larry - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FW: Encountered (serious) bug in v0.9.7, don't know if it as been fix ed in later version
hi roger, ok then i wait until you report problems with the new release, i hope of course there are none ;) jakob Janssen, Roger wrote: hi, we are planning to migrate to the latest release very soon (maybe even next week). until then i'm not able to test it on a version newer than 0.9.7. (sorry for that) the result looks imo not too bad. selects are done for each of the concrete classes: selects are done in some cases but, suppose an article had bookarticle and cdarticle; Article (abstract) - BookArticle (concrete) - CdArticle (concrete) If both book and cd articles have instances, no problem! If only cdarticle has instances and it appears after bookarticle in the mapping; Article extend-class BookArticle extend-class CdArticle then querying for article returns nothing, where it should. Again, in the same case, if i were to do: ArticleInterface extend-class Article Article extend-class BookArticle extend-class CdArticle and i would query for ArticleInterface, all goes well again! This is what i observe within our app (i translated it to above example). roger -Original Message- From: Jakob Braeuchi [mailto:[EMAIL PROTECTED] Sent: woensdag 2 april 2003 21:06 To: OJB Users List Subject: Re: FW: Encountered (serious) bug in v0.9.7, don't know if it as been fix ed in later version hi roger, i did some test using the latest from repository: Article - BookArticle - AbstractCdArticle -- CdArticle --- CdSubArticle (mapping to table artikel for this test to keep it simple) i also enabled debugging on PersistenceBrokerImpl (inOJB.properties) the result looks imo not too bad. selects are done for each of the concrete classes: [org.apache.ojb.broker.singlevm.PersistenceBrokerImpl] DEBUG: Creating one RsIterator per extent class of [org.apache.ojb.broker.Article] 1049309678343|109|0|statement|SELECT A0.Einzelpreis,A0.Kategorie_Nr,A0.Auslaufartikel,A0.MindestBestand,A0.Lagerb estand,A0.Artikel_Nr,A0.Liefereinheit,A0.BestellteEinheiten,A0.Lieferanten_N r,A0.Artikelname FROM Artikel A0 WHERE A0.Einzelpreis >= (SELECT avg(A0.Einzelpreis) FROM Artikel A0) |SELECT A0.Einzelpreis,A0.Kategorie_Nr,A0.Auslaufartikel,A0.MindestBestand,A0.Lagerb estand,A0.Artikel_Nr,A0.Liefereinheit,A0.BestellteEinheiten,A0.Lieferanten_N r,A0.Artikelname FROM Artikel A0 WHERE A0.Einzelpreis >= (SELECT avg(A0.Einzelpreis) FROM Artikel A0) [org.apache.ojb.broker.singlevm.PersistenceBrokerImpl] DEBUG: Adding RsIterator of class [class org.apache.ojb.broker.BookArticle] to ChainingRsIterator 1049309680718|0|0|statement|SELECT A0.Einzelpreis,A0.Kategorie_Nr,A0.ISBN,A0.AUTHOR,A0.Auslaufartikel,A0.Mindes tBestand,A0.Lagerbestand,A0.Artikel_Nr,A0.Liefereinheit,A0.BestellteEinheite n,A0.Lieferanten_Nr,A0.Artikelname FROM BOOKS A0 WHERE A0.Einzelpreis >= (SELECT avg(A0.Einzelpreis) FROM Artikel A0) |SELECT A0.Einzelpreis,A0.Kategorie_Nr,A0.ISBN,A0.AUTHOR,A0.Auslaufartikel,A0.Mindes tBestand,A0.Lagerbestand,A0.Artikel_Nr,A0.Liefereinheit,A0.BestellteEinheite n,A0.Lieferanten_Nr,A0.Artikelname FROM BOOKS A0 WHERE A0.Einzelpreis >= (SELECT avg(A0.Einzelpreis) FROM Artikel A0) [org.apache.ojb.broker.singlevm.PersistenceBrokerImpl] DEBUG: Adding RsIterator of class [class org.apache.ojb.broker.AbstractCdArticle] to ChainingRsIterator [org.apache.ojb.broker.singlevm.PersistenceBrokerImpl] DEBUG: Creating one RsIterator per extent class of [org.apache.ojb.broker.AbstractCdArticle] [org.apache.ojb.broker.singlevm.PersistenceBrokerImpl] DEBUG: Adding RsIterator of class [class org.apache.ojb.broker.CdArticle] to ChainingRsIterator [org.apache.ojb.broker.singlevm.PersistenceBrokerImpl] DEBUG: Creating one RsIterator per extent class of [org.apache.ojb.broker.CdArticle] 1049309682171|0|0|statement|SELECT A0.Einzelpreis,A0.Kategorie_Nr,A0.LABEL,A0.MUSICIANS,A0.Auslaufartikel,A0.Mi ndestBestand,A0.Lagerbestand,A0.Artikel_Nr,A0.Liefereinheit,A0.BestellteEinh eiten,A0.Lieferanten_Nr,A0.Artikelname FROM CDS A0 WHERE A0.Einzelpreis >= (SELECT avg(A0.Einzelpreis) FROM Artikel A0) |SELECT A0.Einzelpreis,A0.Kategorie_Nr,A0.LABEL,A0.MUSICIANS,A0.Auslaufartikel,A0.Mi ndestBestand,A0.Lagerbestand,A0.Artikel_Nr,A0.Liefereinheit,A0.BestellteEinh eiten,A0.Lieferanten_Nr,A0.Artikelname FROM CDS A0 WHERE A0.Einzelpreis >= (SELECT avg(A0.Einzelpreis) FROM Artikel A0) [org.apache.ojb.broker.singlevm.PersistenceBrokerImpl] DEBUG: Adding RsIterator of class [class org.apache.ojb.broker.CdSubArticle] to ChainingRsIterator 1049309683203|172|0|statement|SELECT A0.Einzelpreis,A0.Kategorie_Nr,A0.Auslaufartikel,A0.MindestBestand,A0.Lagerb estand,A0.Artikel_Nr,A0.Liefereinheit,A0.BestellteEinheiten,A0.Lieferanten_N r,A0.Artikelname FROM Artikel A0 WHERE A0.Einzelpreis >= (SELECT avg(A0.Einzelpreis) FROM Artikel A0) |SELECT A0.Einzelpreis,A0.Kategorie_Nr,A0.Auslaufartikel,A0.MindestBestand,A0.Lagerb estand,A0.Artikel_Nr,A0.Liefereinheit,A0.BestellteEinheiten,A0.Lieferanten_N r,A0.Artike
RE: Interbase/Firebird prepare-testdb problem
Hi David, The following files were missing from the torque-3.0.jar for some reason: sql/load/interbase/row.vm sql/load/interbase/val.vm [TORQUE-GUYS] Is there a reason for this? The SQL seemed pretty straight forward so I just placed slightly modified copies of the postgres version of those files on the classpath and managed to get past the 'project-sql-classpath' target in OJB's build.xml. However, then in the 'project-insert-sql' target I got the error at the bottom of this email (even though firebirdsql.jar is in the lib directory). The code does a Class.forName() on the database driver and then calls newInstance() on the returned class, this isn't working for some reason. After that I tried using using the ojbcore-schema.sql to insert the default required tables into the firebird database skipping the test torque stuff. However, I got an error when doing that: "GDS Exception. unsuccessful metadata update key size too big for index RDB$PRIMARY5". After a good deal of searching it seems that the primary key should not be greater that 256 bytes in Firebird and less than 200 if the PK is a composite. I changed the OJB_HL_SEQ TABLENAME column size to 128 (with FIELDNAME column with size 70) and finally creating the table worked. However, I don't know whether this is going to mess up OJB's sequence manager. Did you have any trouble with this? thanks, Jon project-insert-sql: [torque-insert-sql] Our new url -> jdbc:firebirdsql:127.0.0.1/3050:C:\Program Files\VoiceRunner\ccpdb\ladder.gdb BUILD FAILED java.lang.NoClassDefFoundError: javax/resource/ResourceException at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:1590) at java.lang.Class.getConstructor0(Class.java:1762) at java.lang.Class.newInstance0(Class.java:276) at java.lang.Class.newInstance(Class.java:259) at org.apache.torque.task.TorqueSQLExec.insertDatabaseSqlFiles(TorqueSQLExec.ja va:560) > Jonathan, > > > I am trying to use OJB with the Firebird database, > > We are using Firebird and OJB, I contributed the very basic Firebird > implementation for OJB in > > src/java/org/apache/ojb/broker/platforms/PlatformFirebirdImpl.java > > We have not bothered with Torque yet. I took the sql scripts > created by > the default test process for HSQLDB and changed them to > Firebird syntax > and ran them manually. > > I would create a firebird driver for Torque, start with > postgresql, make > changes as per the interbase driver if still required (if you can use > dialect 3 then the changes maybe fewer than in the past with > dialect 1). > > Hope this helps. > > Dave > -- > David Warnock, Sundayta Ltd. http://www.sundayta.com > iDocSys for Document Management. VisibleResults for Fundraising. > Development and Hosting of Web Applications and Sites. > > > > - > 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: Dynamic OR Maping
Hi, it is possible to change the persistent object metadata (all ClassDescriptors) in a per thread manner or global using the org.apache.ojb.broker.metadata.MetadataManager. > Is this possbile ? If not, where can I get in dynamic OJB config ? It is also possible to load and merge additional repository class-descriptor at runtime with global repository file. regards, Armin - Original Message - From: "Goncalo Luiz" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, April 03, 2003 2:07 AM Subject: Dynamic OR Maping Hello. I need to use a variable in my repository-user.xml file to use multiple instances of the same application, each one using a differente table for the same classes. . For example, if I run an instance of MyApp I'd like it to something like this:
Problem with SELECT - UPDATE - SELECT cycle
Hello. We're using OJB 0.9.7 and I am facing a weird error. I'm selecting data from one table, joining it on a second table using an inner join and retrieving one column from the second table. So I use a Criteria, and type something like "criteria.addEqualTo("joinTable.col", "somevalue");", as well as "criteria.addNotNull("joinTable.col");", depending on whether I need to filter on joinTable.col or get all results satisfying the join. This done, I retrieve a list of results, and I choose to update one of the results and the store it using broker.store(). And here comes the trouble : when I re-run my select, and when it gets to the element I have updated, well I realize that there's no result corresponding to the second table : the object stored in the first table's object is null. Here's some pseudo-code to help understand : criteria.addNotNull("joinTable.col"); iterator = broker.getIteratorByQuery(QueryFactory.newQuery(Table1.class, criteria)); // iterate over the iterator ... table1 = (Table1) iterator.next(); if (table1.getKey().equals("XXX")) { // modify ... // store after beginning transaction (actually, it is not table1 himself that is stored : copy(copy)... broker.store(table1); broker.commitTransaction(); } // Another go iterator = broker.getIteratorByQuery(QueryFactory.newQuery(Table1.class, criteria)); // iterate again table1 = (Table1) iterator.next(); if (table1.getKey().equals("XXX")) { table1.getJoinTable().setSomeColumn("Some data"); // raises NullPointerException for table1.getJoinTable() == null } Basically, it seems that I can't retrieve the joined table object associated with the object that has just been updated. Has anyone ever encountered this problem ? Has anyone got a clue of where the problem could be ? Thanks. Patrick. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem with the assignement of primary keys.
Hello, I have just recovered the last version of OJB. This my problem : When I store the object "Customer" I obtain the following exception. This exception occurs on assignement of the primary key. Can you help me ? please. Thanks java.lang.ClassCastException: java.lang.Long at com.ashna.jturbo.driver.x.setObject(x.java) at org.apache.ojb.broker.platforms.PlatformDefaultImpl.setObjectForStatement(Pl atformDefaultImpl.java:230) at org.apache.ojb.broker.accesslayer.StatementManager.bindInsert(StatementManag er.java:493) at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeInsert(JdbcAccessImp l.java:198) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.storeToDb(PersistenceBr okerImpl.java:1835) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.store(PersistenceBroker Impl.java:1759) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.store(PersistenceBroker Impl.java:638) at org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.store(DelegatingP ersistenceBroker.java:152) at org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.getSequence(S equenceManagerHighLowImpl.java:288) at org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.getUniqueLong (SequenceManagerHighLowImpl.java:190) at org.apache.ojb.broker.util.sequence.AbstractSequenceManager.getUniqueId(Abst ractSequenceManager.java:243) at org.apache.ojb.broker.util.sequence.AbstractSequenceManager.getUniqueValue(A bstractSequenceManager.java:158) at org.apache.ojb.broker.util.BrokerHelper.getAutoIncrementValue(BrokerHelper.j ava:317) at org.apache.ojb.broker.util.BrokerHelper.getKeyValues(BrokerHelper.java:218) at org.apache.ojb.broker.Identity.init(Identity.java:198) at org.apache.ojb.broker.Identity.(Identity.java:135) at aston.banque.test.RendezVousTechno.testCreerClientsComptes(RendezVousTechno. java:57) at aston.banque.test.RendezVousTechno.main(RendezVousTechno.java:133) rethrown as org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException: Could not init Identity for given object class aston.banque.domaine.client.Client: java.lang.Long at org.apache.ojb.broker.Identity.init(Identity.java:205) at org.apache.ojb.broker.Identity.(Identity.java:135) at aston.banque.test.RendezVousTechno.testCreerClientsComptes(RendezVousTechno. java:57) at aston.banque.test.RendezVousTechno.main(RendezVousTechno.java:133) For the assignment of the primary keys I use the class "SequenceManagerHiLowImpl". Here the mapping of the class "Customer", Here the Jdbc connection descriptor Here the classe "Customer" public class Customer { protected long id; protected String name; protected String firstname; protected String password; protected String login; protected int version; public Customer () { } public Customer (String pLogin,String pPassword){ this.login = pLogin; this.password = pPassword; } public long getId() { return id; } public String getName() { return name; } public String getPassword() { return password; } public void setId(long id) { this.id = id; } public void setName(String name) { this.name = name; } public void setPassword(String password) { this.password = password; } public String getFirstname() { return firstname; } public void setFirstname(String firstname) { this.firstname= firstname; } public String getLogin() { return login; } public void setLogin(String login) { this.login = login; } public int getVersion() { return version; } public void setVersion(int version) { this.version = version; } }
RE: Default Cache - bug? design catostrophe? user error?
Hi, I allso have this problem. It is because you have since some version after 0.9.6 a direct reference to the objects in the cash of OJB. If you have an object A with attribute a,b,c and you save this, then the object in the cach is a reference to A. So if you now change the attribute b, then on the same time the attribute b is also changed in the cach. If you try now to update the object, then the cach think there was no changes, and no update will be send to the db. For me it is a bug. My workaround is to make an clone of object A before a save it. regards Matthias -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Donnerstag, 3. April 2003 16:32 To: [EMAIL PROTECTED] Subject: RE: Default Cache - bug? design catostrophe? user error? For me the problem appears without any reference/collection. If you get a simple query to retrieve an object, modify an attribute of this object in the database and get this object a second time the attribute won't be updated. Is it a bug or is there something wrong in my app? Sylvain -Message d'origine- De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Date: jeudi, 3. avril 2003 16:20 À: OJB Users List Cc: [EMAIL PROTECTED] Objet: RE: Default Cache - bug? design catostrophe? user error? Well, that kind of works. That is, it works great, unless you have bidirectional references that you want refreshed, in which case you get a Stack Overflow |-+---> | | Ron Gallagher | | | <[EMAIL PROTECTED]| | | uth.net>| | | | | | 04/02/2003 11:48| | | AM | | | Please respond | | | to "OJB Users | | | List" | | | | |-+---> >--- ---| | | |To: [EMAIL PROTECTED] | |cc: | |Subject: RE: Default Cache - bug? design catostrophe? user error? | | | >--- ---| David -- It's not used by the cache. It's used by the PersistenceBroker when it retrieves an object. If the 'target' object is found in the cache, then any reference/collection descriptors that are marked with refresh="true" are re-populated before the 'target' is returned to the caller. Ron Gallagher Atlanta, GA [EMAIL PROTECTED] > > From: [EMAIL PROTECTED] > Date: 2003/04/02 Wed AM 11:44:27 EST > To: "OJB Users List" <[EMAIL PROTECTED]> > CC: [EMAIL PROTECTED] > Subject: Re: RE: Default Cache - bug? design catostrophe? user error? > > > No, I haven't. I will take a look at that, but the code I saw in the cache > didn't look like it would do that - 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: Default Cache - bug? design catostrophe? user error?
I think what you're describing is a different problem. If your changing your database outside of OJB, then you probably don't want to use the "standard cache". |-+-> | | <[EMAIL PROTECTED]| | | isscom.com> | | | | | | 04/03/2003 09:32 | | | AM| | | Please respond to | | | "OJB Users List" | | | | |-+-> >--| | | |To: <[EMAIL PROTECTED]> | |cc: | |Subject: RE: Default Cache - bug? design catostrophe? user error? | | | >--| For me the problem appears without any reference/collection. If you get a simple query to retrieve an object, modify an attribute of this object in the database and get this object a second time the attribute won't be updated. Is it a bug or is there something wrong in my app? Sylvain -Message d'origine- De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Date: jeudi, 3. avril 2003 16:20 À: OJB Users List Cc: [EMAIL PROTECTED] Objet: RE: Default Cache - bug? design catostrophe? user error? Well, that kind of works. That is, it works great, unless you have bidirectional references that you want refreshed, in which case you get a Stack Overflow |-+---> | | Ron Gallagher | | | <[EMAIL PROTECTED]| | | uth.net>| | | | | | 04/02/2003 11:48| | | AM | | | Please respond | | | to "OJB Users | | | List" | | | | |-+---> > --| | | |To: [EMAIL PROTECTED] | |cc: | |Subject: RE: Default Cache - bug? design catostrophe? user error? | | | > --| David -- It's not used by the cache. It's used by the PersistenceBroker when it retrieves an object. If the 'target' object is found in the cache, then any reference/collection descriptors that are marked with refresh="true" are re-populated before the 'target' is returned to the caller. Ron Gallagher Atlanta, GA [EMAIL PROTECTED] > > From: [EMAIL PROTECTED] > Date: 2003/04/02 Wed AM 11:44:27 EST > To: "OJB Users List" <[EMAIL PROTECTED]> > CC: [EMAIL PROTECTED] > Subject: Re: RE: Default Cache - bug? design catostrophe? user error? > > > No, I haven't. I will take a look at that, but the code I saw in the cache > didn't look like it would do that - 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: Separating LocalTxManager and JTATxManager Use
Hi Andrew, - Original Message - From: "Andrew Gilbert" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, April 03, 2003 12:57 AM Subject: Separating LocalTxManager and JTATxManager Use Have a question trying to use OJB under a J2EE environment. If one deploys web and ejb components under one web application, what is best means to ensure proper TxManager is employed? The configuration appears to be global. Right Would seem that web code would want a LocalTxManager, EJB's would want a JTATxManager. Is this not the case? Right again. Except for the PB-api this does currently not use the Transaction Synchronization mechanism. But I want to add this too. Options include: 1. Separate web and ejb into separate applications for deployment, and configure each according to needs. seems for me the best solution 2. Create two PBFactory instances, one configured for local and one for JTA? Will not work because there are some more j2ee specific configuration properties. 3. Implement custom JTATxFactory and make it smart enough to detect if under JTS or not and act accordingly? see 2 / should be possible if we change the ConnectionFactoryManagedImpl too. Detecting and ensuring use of container datasource is not an issue, as can add JdbcConnectionDescriptor at runtime. A related question is, does any of this matter when just using PB API and not ODMG? One hopes it does somewhat, as don't want commits/rollbacks going through unless container is happy. As I said above, currently the PB-api does not use Synchronization, thus it's different from the ODMG-api. regards, Armin Thanks. - 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: MSSQL server - error in ojbtest-schema.xml
The errors from the broker test were due to MSSQL not being able to handle aggregate functions where the argument is qualified thusly: count(foo.*). So far, it hasn't been a problem with the spike solutions I've been coding. So, the short of it is that I incorporated OJB in my test project against live data and things just worked. I know its not that scientific, but its what I have to go on. I didn't pursue the ODMG failure too much, since I don't plan on using it. -Original Message- From: Bonnie MacKellar [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 02, 2003 12:34 PM To: OJB Users List Subject: RE: MSSQL server - error in ojbtest-schema.xml How did you determine that they were not significant? I want to move forwards on this. thanks, Bonnie -Original Message- From: BURT, RANDALL (CONTRACTOR) [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 01, 2003 6:19 PM To: OJB Users List Subject: RE: MSSQL server - error in ojbtest-schema.xml Well, the JUnit errors *were* nothing to worry about. I've completed some small spikes and things are looking good so far. Thanks to everyone for their help and input. I'm sure you'll be hearing more from us as this project gets going! -Original Message- From: BURT, RANDALL (CONTRACTOR) Sent: Monday, March 31, 2003 4:32 PM To: OJB Users List Subject: RE: MSSQL server - error in ojbtest-schema.xml Looking through the JUnit output, I wonder if these are significant as well. I tried some of the queries manually against my db, and they failed there too. What kills me is that something like "SELECT COUNT(F.*) FROM FOO F;" fails no matter what driver you use in SQL Server 2000 (or so my limited testing shows me...) Could you send the JUnit output so we could see what those errors were? GFD, I'll pick this up in the morning... -Original Message- From: Bonnie MacKellar [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 4:25 PM To: OJB Users List Subject: RE: MSSQL server - error in ojbtest-schema.xml I tested on Friday with the rc1 build, using JSQLConnect, and got 0 failures, 1 error, which I was told was not important. Today, testing with the rc2 build, and with the columns modifed to be NOT NULL as specified earlier, I get 0 failures, 4 errors. I have no clue if these are important or not. Bonnie MacKellar -Original Message- From: BURT, RANDALL (CONTRACTOR) [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 5:01 PM To: OJB Users List Subject: RE: MSSQL server - error in ojbtest-schema.xml Some issues with the JSQLConnect driver: 1. Due to network restrictions, I suppose, I was getting 403 errors using the ant task to download the driver. I grabbed it manually without incident, and commented out the ant call. 2. I am actually getting *more* JUnit failures/errors with this driver, though I concede it may be due to the changes I mentioned below in the ojbtest-schema.xml? 3. With the money the PHB's are already throwing at MS licensing, I am loath to try and work another ($4000+ for us, if I read their pricing correctly) purchase into the budget... -Original Message- From: Matthew Baird [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 3:25 PM To: OJB Users List Subject: RE: MSSQL server - error in ojbtest-schema.xml I don't have any issues with MSSQL, but the driver always makes a difference. When people ask me I recommend the JSQLConnect #1 and Opta2000 #2. Bother are great drivers. -Original Message- From: BURT, RANDALL (CONTRACTOR) [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 1:25 PM To: OJB Users List Subject: RE: MSSQL server - error in ojbtest-schema.xml I'll give it a shot. Truth to tell, *I* wouldn't use MSSQL server at all, but this is a port of an app we "inherited", so we're kinda stuck... :( -Original Message- From: Matthew Baird [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 3:20 PM To: OJB Users List Subject: RE: MSSQL server - error in ojbtest-schema.xml if you are worried about using OJB, I'd be more worried about using the MS Driver. Switch over and use the JSQLConnect profile and the build will automatically download the jsqlconnect driver which is much better. -Original Message- From: BURT, RANDALL (CONTRACTOR) [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 1:20 PM To: OJB Users List Subject: RE: MSSQL server - error in ojbtest-schema.xml Glad I could help. I can sympathize with your trepidation about using OJB in a large project. Seems I've been taking one step forward and two steps back for the last few days. I like what it is and what it does, though, and I can't see hacking a persistence service for the projects I have lined up would be very cost-effective... As for those JUnit errors I mentioned before, anyone getting anything like this (from tests-broker.txt): [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] ERROR: SQLException during the execution of the query (SELECT count(A0.*) FROM Artikel A0 WHERE A0
RE: FW: Encountered (serious) bug in v0.9.7, don't know if it as been fix ed in later version
hi, we are planning to migrate to the latest release very soon (maybe even next week). until then i'm not able to test it on a version newer than 0.9.7. (sorry for that) >the result looks imo not too bad. selects are done for each of the >concrete classes: selects are done in some cases but, suppose an article had bookarticle and cdarticle; Article (abstract) - BookArticle (concrete) - CdArticle (concrete) If both book and cd articles have instances, no problem! If only cdarticle has instances and it appears after bookarticle in the mapping; Article extend-class BookArticle extend-class CdArticle then querying for article returns nothing, where it should. Again, in the same case, if i were to do: ArticleInterface extend-class Article Article extend-class BookArticle extend-class CdArticle and i would query for ArticleInterface, all goes well again! This is what i observe within our app (i translated it to above example). roger -Original Message- From: Jakob Braeuchi [mailto:[EMAIL PROTECTED] Sent: woensdag 2 april 2003 21:06 To: OJB Users List Subject: Re: FW: Encountered (serious) bug in v0.9.7, don't know if it as been fix ed in later version hi roger, i did some test using the latest from repository: Article - BookArticle - AbstractCdArticle -- CdArticle --- CdSubArticle (mapping to table artikel for this test to keep it simple) i also enabled debugging on PersistenceBrokerImpl (inOJB.properties) the result looks imo not too bad. selects are done for each of the concrete classes: [org.apache.ojb.broker.singlevm.PersistenceBrokerImpl] DEBUG: Creating one RsIterator per extent class of [org.apache.ojb.broker.Article] 1049309678343|109|0|statement|SELECT A0.Einzelpreis,A0.Kategorie_Nr,A0.Auslaufartikel,A0.MindestBestand,A0.Lagerb estand,A0.Artikel_Nr,A0.Liefereinheit,A0.BestellteEinheiten,A0.Lieferanten_N r,A0.Artikelname FROM Artikel A0 WHERE A0.Einzelpreis >= (SELECT avg(A0.Einzelpreis) FROM Artikel A0) |SELECT A0.Einzelpreis,A0.Kategorie_Nr,A0.Auslaufartikel,A0.MindestBestand,A0.Lagerb estand,A0.Artikel_Nr,A0.Liefereinheit,A0.BestellteEinheiten,A0.Lieferanten_N r,A0.Artikelname FROM Artikel A0 WHERE A0.Einzelpreis >= (SELECT avg(A0.Einzelpreis) FROM Artikel A0) [org.apache.ojb.broker.singlevm.PersistenceBrokerImpl] DEBUG: Adding RsIterator of class [class org.apache.ojb.broker.BookArticle] to ChainingRsIterator 1049309680718|0|0|statement|SELECT A0.Einzelpreis,A0.Kategorie_Nr,A0.ISBN,A0.AUTHOR,A0.Auslaufartikel,A0.Mindes tBestand,A0.Lagerbestand,A0.Artikel_Nr,A0.Liefereinheit,A0.BestellteEinheite n,A0.Lieferanten_Nr,A0.Artikelname FROM BOOKS A0 WHERE A0.Einzelpreis >= (SELECT avg(A0.Einzelpreis) FROM Artikel A0) |SELECT A0.Einzelpreis,A0.Kategorie_Nr,A0.ISBN,A0.AUTHOR,A0.Auslaufartikel,A0.Mindes tBestand,A0.Lagerbestand,A0.Artikel_Nr,A0.Liefereinheit,A0.BestellteEinheite n,A0.Lieferanten_Nr,A0.Artikelname FROM BOOKS A0 WHERE A0.Einzelpreis >= (SELECT avg(A0.Einzelpreis) FROM Artikel A0) [org.apache.ojb.broker.singlevm.PersistenceBrokerImpl] DEBUG: Adding RsIterator of class [class org.apache.ojb.broker.AbstractCdArticle] to ChainingRsIterator [org.apache.ojb.broker.singlevm.PersistenceBrokerImpl] DEBUG: Creating one RsIterator per extent class of [org.apache.ojb.broker.AbstractCdArticle] [org.apache.ojb.broker.singlevm.PersistenceBrokerImpl] DEBUG: Adding RsIterator of class [class org.apache.ojb.broker.CdArticle] to ChainingRsIterator [org.apache.ojb.broker.singlevm.PersistenceBrokerImpl] DEBUG: Creating one RsIterator per extent class of [org.apache.ojb.broker.CdArticle] 1049309682171|0|0|statement|SELECT A0.Einzelpreis,A0.Kategorie_Nr,A0.LABEL,A0.MUSICIANS,A0.Auslaufartikel,A0.Mi ndestBestand,A0.Lagerbestand,A0.Artikel_Nr,A0.Liefereinheit,A0.BestellteEinh eiten,A0.Lieferanten_Nr,A0.Artikelname FROM CDS A0 WHERE A0.Einzelpreis >= (SELECT avg(A0.Einzelpreis) FROM Artikel A0) |SELECT A0.Einzelpreis,A0.Kategorie_Nr,A0.LABEL,A0.MUSICIANS,A0.Auslaufartikel,A0.Mi ndestBestand,A0.Lagerbestand,A0.Artikel_Nr,A0.Liefereinheit,A0.BestellteEinh eiten,A0.Lieferanten_Nr,A0.Artikelname FROM CDS A0 WHERE A0.Einzelpreis >= (SELECT avg(A0.Einzelpreis) FROM Artikel A0) [org.apache.ojb.broker.singlevm.PersistenceBrokerImpl] DEBUG: Adding RsIterator of class [class org.apache.ojb.broker.CdSubArticle] to ChainingRsIterator 1049309683203|172|0|statement|SELECT A0.Einzelpreis,A0.Kategorie_Nr,A0.Auslaufartikel,A0.MindestBestand,A0.Lagerb estand,A0.Artikel_Nr,A0.Liefereinheit,A0.BestellteEinheiten,A0.Lieferanten_N r,A0.Artikelname FROM Artikel A0 WHERE A0.Einzelpreis >= (SELECT avg(A0.Einzelpreis) FROM Artikel A0) |SELECT A0.Einzelpreis,A0.Kategorie_Nr,A0.Auslaufartikel,A0.MindestBestand,A0.Lagerb estand,A0.Artikel_Nr,A0.Liefereinheit,A0.BestellteEinheiten,A0.Lieferanten_N r,A0.Artikelname FROM Artikel A0 WHERE A0.Einzelpreis >= (SELECT avg(A0.Einzelpreis) FROM Artikel A0) jakob Jakob Braeuchi wrote: > hi roger,
RE: Default Cache - bug? design catostrophe? user error?
For me the problem appears without any reference/collection. If you get a simple query to retrieve an object, modify an attribute of this object in the database and get this object a second time the attribute won't be updated. Is it a bug or is there something wrong in my app? Sylvain -Message d'origine- De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Date: jeudi, 3. avril 2003 16:20 À: OJB Users List Cc: [EMAIL PROTECTED] Objet: RE: Default Cache - bug? design catostrophe? user error? Well, that kind of works. That is, it works great, unless you have bidirectional references that you want refreshed, in which case you get a Stack Overflow |-+---> | | Ron Gallagher | | | <[EMAIL PROTECTED]| | | uth.net>| | | | | | 04/02/2003 11:48| | | AM | | | Please respond | | | to "OJB Users | | | List" | | | | |-+---> >--| | | |To: [EMAIL PROTECTED] | |cc: | |Subject: RE: Default Cache - bug? design catostrophe? user error? | | | >--| David -- It's not used by the cache. It's used by the PersistenceBroker when it retrieves an object. If the 'target' object is found in the cache, then any reference/collection descriptors that are marked with refresh="true" are re-populated before the 'target' is returned to the caller. Ron Gallagher Atlanta, GA [EMAIL PROTECTED] > > From: [EMAIL PROTECTED] > Date: 2003/04/02 Wed AM 11:44:27 EST > To: "OJB Users List" <[EMAIL PROTECTED]> > CC: [EMAIL PROTECTED] > Subject: Re: RE: Default Cache - bug? design catostrophe? user error? > > > No, I haven't. I will take a look at that, but the code I saw in the cache > didn't look like it would do that - 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: Default Cache - bug? design catostrophe? user error?
Well, that kind of works. That is, it works great, unless you have bidirectional references that you want refreshed, in which case you get a Stack Overflow |-+---> | | Ron Gallagher | | | <[EMAIL PROTECTED]| | | uth.net>| | | | | | 04/02/2003 11:48| | | AM | | | Please respond | | | to "OJB Users | | | List" | | | | |-+---> >--| | | |To: [EMAIL PROTECTED] | |cc: | |Subject: RE: Default Cache - bug? design catostrophe? user error? | | | >--| David -- It's not used by the cache. It's used by the PersistenceBroker when it retrieves an object. If the 'target' object is found in the cache, then any reference/collection descriptors that are marked with refresh="true" are re-populated before the 'target' is returned to the caller. Ron Gallagher Atlanta, GA [EMAIL PROTECTED] > > From: [EMAIL PROTECTED] > Date: 2003/04/02 Wed AM 11:44:27 EST > To: "OJB Users List" <[EMAIL PROTECTED]> > CC: [EMAIL PROTECTED] > Subject: Re: RE: Default Cache - bug? design catostrophe? user error? > > > No, I haven't. I will take a look at that, but the code I saw in the cache > didn't look like it would do that - 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: Invalid argument value: Not unique table/alias: 'A1'
I'm using rc1 version. -Original Message- From: Jakob Braeuchi [mailto:[EMAIL PROTECTED] Sent: quarta-feira, 2 de Abril de 2003 18:06 To: OJB Users List Subject: Re: Invalid argument value: Not unique table/alias: 'A1' hi João, what version of ojb do you use ? jakob João Luz wrote: >Hi, > >Look to this simple case: > A --- AB --- B C >| >D >1- A got a M:N relation with B >2 - B got a 1:M to C and D > >The M:N relationship is implemented with collections (indirection-table AB). > >If I want to get "All A's that have B's associated that have C's and D's >with some property equals to something", i.e, if I do this OQL query: > select all from A.class.getName() where bs.cs.idInternal = $1 and >bs.ds.idInternal = $2 > >The execution result of this query is this: > SELECT A0.name,A0.idInternal > FROM A A0 INNER JOIN AB A1 ON A0.idInternal=A1.keyA > INNER JOIN B A2 ON A1.keyB=A2.idInternal > INNER JOIN AB A1 ON A0.idInternal=A1.keyA > INNER JOIN B A2 ON A1.keyB=A2.idInternal > WHERE ( A2.idInternal = ? ) AND (A2.idInternal = ? ) > >Well this don't works because A1 alias is duplicated. The error tells me >that: >ERROR [main] (?:?) - SQLException during the execution of the query (for a >A): Invalid argument value: Not unique table/alias: 'A1' >java.sql.SQLException: Invalid argument value: Not unique table/alias: 'A1' > at com.mysql.jdbc.MysqlIO.sendCommand(Unknown Source) > at com.mysql.jdbc.MysqlIO.sqlQueryDirect(Unknown Source) > at com.mysql.jdbc.Connection.execSQL(Unknown Source) > at com.mysql.jdbc.PreparedStatement.executeQuery(Unknown Source) > at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown >Source) > at org.apache.ojb.broker.accesslayer.RsIterator.(Unknown Source) > at >org.apache.ojb.broker.singlevm.RsIteratorFactoryImpl.createRsIterator(Unkno w >n Source) > at >org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getRsIteratorFromQuery ( >Unknown Source) > at >org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getIteratorFromQuery(U n >known Source) > at >org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(U n >known Source) > at >org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(U n >known Source) > at >org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(U n >known Source) > at >org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.getCollectionByQ u >ery(Unknown Source) > at org.apache.ojb.odmg.oql.OQLQueryImpl.execute(Unknown Source) > at Main.main(Main.java:54) > >Well, my question is: Am I doing something wrong or sqlGenerator got a >bug/feature? :) > >Thanks in advance > João > >PS: Mapping is below: > > >name="idInternal" >column="idInternal" >jdbc-type="INTEGER" >primarykey="true" >autoincrement="true" >id="1" >/> >name="name" >column="name" >jdbc-type="VARCHAR"/> > indirection-table="AB"> > > > > > >jdbc-type="INTEGER" primarykey="true" autoincrement="true"/> > > > > > > > > > > > indirection-table="AB"> > > > > > > table="C"> >name="idInternal" >column="idInternal" >jdbc-type="INTEGER" >primarykey="true" >autoincrement="true" >/> > > > > > > > > > > >name="idInternal" >column="idInternal" >jdbc-type="INTEGER" >primarykey="true" >autoincrement="true" >/> > > > > > > > >PS2:Now the database sql: >/* >Mascon Dump >Source Host: localhost >Source Server Version: 3.23.53-max-nt >Source Database: testDB >Date: 2003-04-01 11:35:58 >*/ > >use testDB ; ># ># Table structure for A ># >drop table if exists A; >create table A ( > idInternal int(11) not null default '0', > name varchar(50) not null, > primary key (idInternal)) > type=MyISAM; > ># ># Table structure for AB ># >drop table if exists AB; >create table AB ( > keyA int(11) not null default '0', > keyB int(11) not null default '0') > type=MyISAM; > ># ># Table structure for B ># >drop table if exists B; >create table B ( > idInternal int(11) not null default '0', > keyA int(11) not null default '0', > name varchar(50) not null, > primary key (idInternal)) > type=MyISAM; > ># ># Table structure for C ># >drop t