objectbridge-users Mailing List for ObJectRelationalBridge (Page 2)
Brought to you by:
thma
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
(32) |
May
(86) |
Jun
(53) |
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Christoph S. <ch...@mc...> - 2002-06-13 14:33:51
|
Hi ojb team! I am converting a project to use ojb, and i wonder if i'd better use the persistence broker or odmg. Reading the faq i came to the conclusion that odmg is always better because it supports more features. But then i read a posting on theserverside.com which says that the persistence broker performance is (much?) better than the odmg api. Some neat features like querybyexample seem to be available only in the PB. Or is there a way to access the broker from the odmg side of ojb? Tia chris |
From: Jakob B. <jbr...@ho...> - 2002-06-13 06:02:34
|
hi martin, 2) ojb 0.9 supports bidirectional m:n mappings only. for unidirectional m:n you have to use the latest from repository. there's also a testcase for unidirectional m:n between person and project. hth jakob ----- Original Message ----- From: "Martin Fuzzey" <fu...@be...> To: <obj...@li...> Sent: Wednesday, June 12, 2002 6:20 PM Subject: [ojb-users] Problems with M-N mappings (newbie) > Hi all, > > I've just started using objectbridge (the 0.9 version) and am having a few > problems with M-N mappings : > > 1) Unable to perform non-decomposed N:M mapping > ====================================== > > I have two classes StringFDP and AndFDP. > StringFDP just contains a string field, wheras AndFDP contains a Collection > (of StringFDPs) (field name m_fdps) > I also added a Collection field (named _containers) to StringFDP (although > I don't really want this - see below) > > Following the test cases I did this : > > <class-descriptor > class="prestudy.persist.bo.StringFdp" > table="STRING_FDP" > > > <field-descriptor id="1" > name="_uid" > column="objid" > jdbc-type="INTEGER" > primarykey="true" > autoincrement="true" > /> > <field-descriptor id="2" > name="m_val" > column="val" > jdbc-type="VARCHAR" > /> > <collection-descriptor > name="_containers" > element-class-ref="prestudy.persist.bo.AndFdp" > indirection-table="AND_FDP_ASSOC" > > > <fk-pointing-to-this-class column="FDP_ID"/> > <fk-pointing-to-element-class column="AND_ID"/> > </collection-descriptor> > </class-descriptor> > > > <class-descriptor > class="prestudy.persist.bo.AndFdp" > table="AND_FDP" > > > <field-descriptor id="1" > name="_uid" > column="objid" > jdbc-type="INTEGER" > primarykey="true" > autoincrement="true" > /> > <collection-descriptor > name="m_fdps" > element-class-ref="prestudy.persist.bo.StringFdp" > indirection-table="AND_FDP_ASSOC" > > > <fk-pointing-to-this-class column="AND_ID"/> > <fk-pointing-to-element-class column="FDP_ID"/> > </collection-descriptor> > > </class-descriptor> > > This gave me a NPE during a lock operation (I had to modify TransactionImpl > to print the cause of the exception rather than just the > LockNotGrantedException) : > > java.lang.NullPointerException > at > ojb.broker.metadata.ObjectReferenceDescriptor.getForeignKeyFieldDescr > iptors(ObjectReferenceDescriptor.java:250) > at ojb.odmg.TransactionImpl.lockCollections(Unknown Source) > at ojb.odmg.TransactionImpl.register(Unknown Source) > at ojb.odmg.TransactionImpl.lock(Unknown Source) > at prestudy.persist.ojb.OjbFdpStorer.save(OjbFdpStorer.java:72) > at prestudy.persist.ojb.OjbFdpStorer.test(OjbFdpStorer.java:119) > at prestudy.persist.ojb.OjbFdpStorer.main(OjbFdpStorer.java:94) > org.odmg.LockNotGrantedException > at ojb.odmg.TransactionImpl.lock(Unknown Source) > at prestudy.persist.ojb.OjbFdpStorer.save(OjbFdpStorer.java:72) > at prestudy.persist.ojb.OjbFdpStorer.test(OjbFdpStorer.java:119) > at prestudy.persist.ojb.OjbFdpStorer.main(OjbFdpStorer.java:94) > > It seems OJB wants a foreign key definition. But the unit test case the > non-decomposed mapping PEOPLE, PROJECTS using indirection_table works fine. > The only difference I can see is that in the unit test there is _also_ a > decomposed mapping between the same two classes (via ROLE). > In tutorial 3 a seemingly dummy reverse_fk_descriptor is used (999) but > when I add this I get an ArrayIndexOutOfBoundsException. > > > 2) How do I do a unidirectional N:M mapping? > ================================= > In fact my object model only needs navigability from AndFdp to StringFdp > and not the inverse. Why do I have to add an unneeded Collection to my > StringFdp class. > > 3) What I'm really trying to do. > ====================== > In fact I'm really trying to map a composite pattern structure of objects > where each object is either a simple object (such as StringFdp) or a > composite (such as AndFdp). The idea being to have several composites > representing logical operations (Or, Nand etc). > > Is it possible to map this type of model? > > > Help much appreciated, > > Martin Fuzzey > > > _______________________________________________________________ > > Sponsored by: > ThinkGeek at http://www.ThinkGeek.com/ > _______________________________________________ > Objectbridge-users mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-users > |
From: Srividya V. <p_s...@ya...> - 2002-06-13 01:07:33
|
Hi , I am having a problem to run the OJB application on SQLMPDatabase. I am getting the open cursor error! ie., it is unable to excute two SQL statements! That first statement is running fine and for the second statement I am getting the following erro message -- "Cannot set a value in a statement with an open cursor" Other JDBC applications on the same Database are working fine! How can I fix this problem.I am including the printStackTrace with some additional debugging statements added by me! I appreciate any help! Thanks Srividya BOOT] INFO: OJB.properties: file:/usr/tandem/objectpersistence/OJB.properties [DEFAULT] INFO: OJB Descriptor Repository: file:/usr/tandem/objectpersistence/repository.xml [BOOT] INFO: loading XML took 1041 msecs [DEFAULT] INFO: ...Finished parsing [ojb.broker.singlevm.PersistenceBrokerImpl] DEBUG: store com.co.atre.engine.container.ATRDataContainer@105248f5 [ojb.broker.singlevm.PersistenceBrokerImpl] DEBUG: getObjectByIdentity ojb.broker.util.sequence.HighLowSequence{com.co.atre.engine.container.ATRDataContainer,m_intPnrID} [ojb.broker.accesslayer.SqlGenerator] DEBUG: SQL: SELECT A0.CLASSNAME,A0.FIELDNAME,A0.MAX_KEY,A0.GRAB_SIZE FROM =OJB_HL_SEQ A0 WHERE (A0.CLASSNAME = ?) AND (A0.FIELDNAME = ?) [ojb.broker.accesslayer.StatementsForClass] DEBUG: prepareStatement: SELECT A0.CLASSNAME,A0.FIELDNAME,A0.MAX_KEY,A0.GRAB_SIZE FROM =OJB_HL_SEQ A0 WHERE (A0.CLASSNAME = ?) AND (A0.FIELDNAME = ?) [ojb.broker.accesslayer.JdbcAccess] DEBUG: before bind select.... [ojb.broker.accesslayer.JdbcAccess] DEBUG: After bind select.... [ojb.broker.accesslayer.JdbcAccess] DEBUG: After EXCUTING QUERYD*************** [ojb.broker.singlevm.PersistenceBrokerImpl] DEBUG: store ojb.broker.util.sequence.HighLowSequence@687248f0 [ojb.broker.accesslayer.JdbcAccess] DEBUG: before bind select.... [DEFAULT] ERROR: bindSelect failed for: ojb.broker.util.sequence.HighLowSequence {com.co.atre.engine.container.ATRDataContainer,m_intPnrID}, PK: 0, value: com.co.atre.engine.container.ATRDataContainer [ojb.broker.accesslayer.JdbcAccess] ERROR: SQLException during the execution of materializeObject: SQLMP: Cannot set a value in a statement with an open cursor SQLMP: Cannot set a value in a statement with an open cursor java.sql.SQLException: SQLMP: Cannot set a value in a statement with an open cursor at com.tandem.sqlmp.SQLMPPreparedStatement.setObject(SQLMPPreparedStatem ent.java, Compiled Code) at com.tandem.sqlmp.SQLMPPreparedStatement.setObject(SQLMPPreparedStatem ent.java, Compiled Code) at ojb.broker.accesslayer.StatementManager.bindSelect(Unknown Source) at ojb.broker.accesslayer.JdbcAccess.materializeObject(Unknown Source) at ojb.broker.singlevm.PersistenceBrokerImpl.store(Unknown Source) at ojb.broker.util.sequence.SequenceManagerHighLowImpl.getUniqueId(Unkno wn Source) at ojb.broker.util.sequence.SequenceManagerDefaultImpl.getUniqueLong(Unk nown Source) at ojb.broker.singlevm.PersistenceBrokerImpl.getUniqueLong(Unknown Source) at ojb.broker.metadata.ClassDescriptor.getAutoIncrementValue(Unknown Source) at ojb.broker.metadata.ClassDescriptor.getKeyValues(Unknown Source) at ojb.broker.Identity.<init>(Unknown Source) at ojb.broker.singlevm.PersistenceBrokerImpl.store(Unknown Source) at objectpersistence.ATRObjectPersistor.writeATREObject(Unknown Source) at TandemTester.main(TandemTester.java, Compiled Code) [DEFAULT] ERROR: OJB ERROR: Dont know how to autoincrement field class com.co.atre.engine.container.ATRDataContainer.m_intPnrID java.lang.RuntimeException: OJB ERROR: Dont know how to autoincrement field class com.co.atre.engine.container.ATRDataContainer.m_intPnrID at ojb.broker.metadata.ClassDescriptor.getAutoIncrementValue(Unknown Source) at ojb.broker.metadata.ClassDescriptor.getKeyValues(Unknown Source) at ojb.broker.Identity.<init>(Unknown Source) at ojb.broker.singlevm.PersistenceBrokerImpl.store(Unknown Source) at objectpersistence.ATRObjectPersistor.writeATREObject(Unknown Source) at ojb.broker.metadata.ClassDescriptor.getAutoIncrementValue(Unknown Sou rce) at ojb.broker.metadata.ClassDescriptor.getKeyValues(Unknown Source) at ojb.broker.Identity.<init>(Unknown Source) at ojb.broker.singlevm.PersistenceBrokerImpl.store(Unknown Source) at objectpersistence.ATRObjectPersistor.writeATREObject(Unknown Source) at TandemTester.main(TandemTester.java, Compiled Code) [DEFAULT] ERROR: null ojb.broker.PersistenceBrokerException at ojb.broker.metadata.ClassDescriptor.getKeyValues(Unknown Source) at ojb.broker.Identity.<init>(Unknown Source) at ojb.broker.singlevm.PersistenceBrokerImpl.store(Unknown Source) at objectpersistence.ATRObjectPersistor.writeATREObject(Unknown Source) at TandemTester.main(TandemTester.java, Compiled Code) null ojb.broker.metadata.ClassNotPersistenceCapableException at ojb.broker.singlevm.PersistenceBrokerImpl.store(Unknown Source) at objectpersistence.ATRObjectPersistor.writeATREObject(Unknown Source) at TandemTester.main(TandemTester.java, Compiled Code) --------------------------------- Do You Yahoo!? Sign-up for Video Highlights of 2002 FIFA World Cup |
From: Grim S. <gri...@ya...> - 2002-06-12 21:02:26
|
I have three classes, Person, Account, Role. A person can have multiple accounts, and each account can have multiple roles. In addition the Role can have many accounts. Making this a 1->M<->N relationship. Using the ODMG stuff, when I save Person, it saves Person and Account, but doens't even try to save Role... OJB also doesn't throw any errors, or do anything else to indicate a problem. I logged what SQL OJB was generating, and it's not even attempting to hit the ACCOUNT_ROLE table, much less the ROLE table. Can OJB handle this style of relationship using what is in the tutorials? Or am I missing something? James Barrows __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com |
From: Martin F. <fu...@be...> - 2002-06-12 16:21:05
|
Hi all, I've just started using objectbridge (the 0.9 version) and am having a few problems with M-N mappings : 1) Unable to perform non-decomposed N:M mapping ====================================== I have two classes StringFDP and AndFDP. StringFDP just contains a string field, wheras AndFDP contains a Collection (of StringFDPs) (field name m_fdps) I also added a Collection field (named _containers) to StringFDP (although I don't really want this - see below) Following the test cases I did this : <class-descriptor class="prestudy.persist.bo.StringFdp" table="STRING_FDP" > <field-descriptor id="1" name="_uid" column="objid" jdbc-type="INTEGER" primarykey="true" autoincrement="true" /> <field-descriptor id="2" name="m_val" column="val" jdbc-type="VARCHAR" /> <collection-descriptor name="_containers" element-class-ref="prestudy.persist.bo.AndFdp" indirection-table="AND_FDP_ASSOC" > <fk-pointing-to-this-class column="FDP_ID"/> <fk-pointing-to-element-class column="AND_ID"/> </collection-descriptor> </class-descriptor> <class-descriptor class="prestudy.persist.bo.AndFdp" table="AND_FDP" > <field-descriptor id="1" name="_uid" column="objid" jdbc-type="INTEGER" primarykey="true" autoincrement="true" /> <collection-descriptor name="m_fdps" element-class-ref="prestudy.persist.bo.StringFdp" indirection-table="AND_FDP_ASSOC" > <fk-pointing-to-this-class column="AND_ID"/> <fk-pointing-to-element-class column="FDP_ID"/> </collection-descriptor> </class-descriptor> This gave me a NPE during a lock operation (I had to modify TransactionImpl to print the cause of the exception rather than just the LockNotGrantedException) : java.lang.NullPointerException at ojb.broker.metadata.ObjectReferenceDescriptor.getForeignKeyFieldDescr iptors(ObjectReferenceDescriptor.java:250) at ojb.odmg.TransactionImpl.lockCollections(Unknown Source) at ojb.odmg.TransactionImpl.register(Unknown Source) at ojb.odmg.TransactionImpl.lock(Unknown Source) at prestudy.persist.ojb.OjbFdpStorer.save(OjbFdpStorer.java:72) at prestudy.persist.ojb.OjbFdpStorer.test(OjbFdpStorer.java:119) at prestudy.persist.ojb.OjbFdpStorer.main(OjbFdpStorer.java:94) org.odmg.LockNotGrantedException at ojb.odmg.TransactionImpl.lock(Unknown Source) at prestudy.persist.ojb.OjbFdpStorer.save(OjbFdpStorer.java:72) at prestudy.persist.ojb.OjbFdpStorer.test(OjbFdpStorer.java:119) at prestudy.persist.ojb.OjbFdpStorer.main(OjbFdpStorer.java:94) It seems OJB wants a foreign key definition. But the unit test case the non-decomposed mapping PEOPLE, PROJECTS using indirection_table works fine. The only difference I can see is that in the unit test there is _also_ a decomposed mapping between the same two classes (via ROLE). In tutorial 3 a seemingly dummy reverse_fk_descriptor is used (999) but when I add this I get an ArrayIndexOutOfBoundsException. 2) How do I do a unidirectional N:M mapping? ================================= In fact my object model only needs navigability from AndFdp to StringFdp and not the inverse. Why do I have to add an unneeded Collection to my StringFdp class. 3) What I'm really trying to do. ====================== In fact I'm really trying to map a composite pattern structure of objects where each object is either a simple object (such as StringFdp) or a composite (such as AndFdp). The idea being to have several composites representing logical operations (Or, Nand etc). Is it possible to map this type of model? Help much appreciated, Martin Fuzzey |
From: <Mao...@in...> - 2002-06-12 06:39:16
|
Srividya, The problem is very likely caused by your old JDBC driver version of mysql. Nothing to do with OJB. Which version is your mysql JDBC driver? Update ur mysql JDBC driver to the latest version and see whether your problem still exist. Regards, Qingwen "Vullanki, Srividya" <Sri...@co...> on 08/06/2002 03:03:51 To: "'obj...@li...'" <obj...@li...> cc: (bcc: Mao Qingwen/NSW/ING-MM/AU) Subject: [ojb-users] Is TimeStamp conversion working in mysql?? > Hi, > > I am using Persistent Broker API in OJB0.9 and the field converstion to > TimeStamp is not working properly! I am not getting any Exception and the > value in the table is filled with either current time or all zeros! Why is > it happening so! > I would appreciate any help! > > Thanks > Srividya _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm _______________________________________________ Objectbridge-users mailing list Obj...@li... https://lists.sourceforge.net/lists/listinfo/objectbridge-users |
From: Jason M. <mc...@na...> - 2002-06-10 23:24:57
|
OK, I have a strange problem. If I instantiate an object and the run store on it, as in the following method public void editTable() { Query query = new QueryByExample(this); try { broker.beginTransaction(); Table table = (Table)broker.getObjectByQuery(query); table.setMetaID(this.getMetaID()); table.setTableName(this.getTableName()); table.setTableDesc(this.getTableDesc()); broker.store(table); broker.commitTransaction(); } catch (Exception e) { broker.abortTransaction(); log.error("Exception in editTable(): " + e); e.printStackTrace(); } } Then only the tableName and the tableDesc get updated in the database. The metaID, which is a foreign key to the database in which this table belongs does not get updated. If I change to the following, simpler method public void editTable() { try { broker.beginTransaction(); broker.store(this); broker.commitTransaction(); } catch (Exception e) { broker.abortTransaction(); log.error("Exception in editTable(): " + e); e.printStackTrace(); } } Then everything works, and the metaID gets updated. My question is...Shouldn't these two methods do exactly the same thing? Why does the first method update only two columns and not the third? Is it related to the fact that metaID is a foreign key? Or is it something to do with the objects Identity. Should I do getObjectByIdentity instead of getObjectByQuery? It's not a big issue, as it seems the second way is better anyway, but I could use some insight here. Any ideas? Thanks, Jason |
From: Vullanki, S. <Sri...@co...> - 2002-06-07 17:02:06
|
> Hi, > > I am using Persistent Broker API in OJB0.9 and the field converstion to > TimeStamp is not working properly! I am not getting any Exception and the > value in the table is filled with either current time or all zeros! Why is > it happening so! > I would appreciate any help! > > Thanks > Srividya |
From: Arvind G. <Arv...@PA...> - 2002-06-07 15:20:38
|
How do i check if there are any objects that exists which match a particular criteria? Is it adviced to use ExistsCriteria or PersistenceBroker.getCount(Query)? Are there any performance issues with any of these? Is there an example for how to use ExistsCriteria? **************************************************************************** ************* This E-mail is from PANACYA Inc. The E-mail and any files transmitted with it are confidential and may also be privileged and intended solely for the use of the individual or entity to whom they are addressed. Any unauthorized direct or indirect dissemination, distribution or copying of this message and any attachments is strictly prohibited. If you have received the E-mail in error please notify adm...@pa... or telephone (410) 910-3300. **************************************************************************** ************ |
From: Matthew b. <mat...@ya...> - 2002-06-06 17:50:48
|
even though we are based on grammar for OQL, we do ignore a bunch of stuff, namely projection attributes. We are also case sensitive (should be easy to fix though). Thomas Mahler <tho...@ho...> wrote: Hi Lorenzo, Lorenzo Nicora wrote: > Hello, > > I've a newbie question on OQL syntax support in OJB. > I'm running some personal tests with OJB 0.9 after successfully > running all junit tests and tutorials. For OQL, I'm referring to the > ODMG 3.0 "bible" paper book (actually not very useful as a > "user"...). > > If I run a simple OQL query using aliases like this: > > select c from test.Client c where c.id = $1 > > I get a parsing error calling oqlQuery.create(...): > > line 1: unexpected token: c > java.lang.NullPointerException > ojb.odmg.OQLQueryImpl.create(OQLQueryImpl.java:178) > > I tried unsuccessfully many "permutations" :-) of the query sintax. > Running the same OQL without alias works! > > select c from test.Client where id = $1 > > > My questions are: > Am I doing some mistake? > and: > What is the level of support and compliance of ODMG 3.0 OQL in > OJB? Hi our OQL parser is based on an ANTLR grammar from the official odmg site. We support the same syntax, but use the parser to build up ojb.broker.query.Criteria objects. Thus if an OQL statement can not be parsed it must be a problem with the original oql.g. There are only a few things like aggregation functions that are not supported. The best thing to see what OJB will generate from you OQL statement is to have a look at our oql-ojb.g (to be found under src/java/ojb/odmg/oql). Thomas > > I browsed the documentation and many of the examples, but > almost all OQL examples I've seen are rather "basic". > > Thanks > > Lorenzo > > WEBPLAN srl > v.Civerchio 4 > 20159 MILANO - ITALY > tel. +39-02-69311782 > fax. +39-02-60857392 > > > > _______________________________________________________________ > > Don't miss the 2002 Sprint PCS Application Developer's Conference > August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm > > _______________________________________________ > Objectbridge-users mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-users > > > > _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm _______________________________________________ Objectbridge-users mailing list Obj...@li... https://lists.sourceforge.net/lists/listinfo/objectbridge-users --------------------------------- Do You Yahoo!? Sign-up for Video Highlights of 2002 FIFA World Cup |
From: Thomas M. <tho...@ho...> - 2002-06-06 17:24:54
|
Hi Lorenzo, Lorenzo Nicora wrote: > Hello, > > I've a newbie question on OQL syntax support in OJB. > I'm running some personal tests with OJB 0.9 after successfully > running all junit tests and tutorials. For OQL, I'm referring to the > ODMG 3.0 "bible" paper book (actually not very useful as a > "user"...). > > If I run a simple OQL query using aliases like this: > > select c from test.Client c where c.id = $1 > > I get a parsing error calling oqlQuery.create(...): > > line 1: unexpected token: c > java.lang.NullPointerException > ojb.odmg.OQLQueryImpl.create(OQLQueryImpl.java:178) > > I tried unsuccessfully many "permutations" :-) of the query sintax. > Running the same OQL without alias works! > > select c from test.Client where id = $1 > > > My questions are: > Am I doing some mistake? > and: > What is the level of support and compliance of ODMG 3.0 OQL in > OJB? Hi our OQL parser is based on an ANTLR grammar from the official odmg site. We support the same syntax, but use the parser to build up ojb.broker.query.Criteria objects. Thus if an OQL statement can not be parsed it must be a problem with the original oql.g. There are only a few things like aggregation functions that are not supported. The best thing to see what OJB will generate from you OQL statement is to have a look at our oql-ojb.g (to be found under src/java/ojb/odmg/oql). Thomas > > I browsed the documentation and many of the examples, but > almost all OQL examples I've seen are rather "basic". > > Thanks > > Lorenzo > > WEBPLAN srl > v.Civerchio 4 > 20159 MILANO - ITALY > tel. +39-02-69311782 > fax. +39-02-60857392 > > > > _______________________________________________________________ > > Don't miss the 2002 Sprint PCS Application Developer's Conference > August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm > > _______________________________________________ > Objectbridge-users mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-users > > > > |
From: Thomas M. <tho...@ho...> - 2002-06-06 17:16:23
|
Hi all, Lorenzo Nicora wrote: > I hope this is not a FAQ :-) > unfortunately it is! As mentioned in tutorial3.html#cascading YOU MUST NOT SET auto-update to true in an ODMG implementation. The ODMG has its own mechanism to do cascading operations! Thomas > >>From: "Govindarajan S (Gover)" <gov...@az...> >>To: obj...@li... >>Date: Wed, 5 Jun 2002 18:58:37 +0530 >>Subject: [ojb-users] Error in 1:n mapping using ODMG API >> > > Hello, > > >>I get the following exception when using the ODMG API for persisting >>the 1:n mapping. I have a product group class which has a collection >>of articles. Iam trying to persist the ProductGroup. As expected it >>tries to persist the Article as well. But during the process i get the >>following exception message, >> >>[ojb.broker.singlevm.PersistenceBrokerImpl] ERROR: Error in >>Transaction abort: General error: Warning: Some non-transactional >>changed tables couldn't be rolled back >>org.odmg.TransactionAbortedException: Invalid argument value: >>Duplicate entry '71' for key 1 >>[...] >> > >>From what i observed its trying to insert the article, which is >>already inserted. I took a look at the SQL queries submitted to the >>database and found this, >>[...] >>At this stage an SQLException is thrown. >> >>What could be going wrong? why is it trying to insert the first >>element again? >> > > > I'm experiencing a similar problem, persinsting the classic 1:n > mapping: 1 Order to n. tems > (using OJB v.0.9) > > I made the association navigable in both directions: > in Order there is a collection of Items AND in the Item there is the > FK to Order + the reference to the Order > Both tables PK are autoincrements. > > If I set the collection of Items in Order for auto-update, when I insert > a new Order (with new Items), OJB tries to insert duplicate Items > (with the same PK) causing the exception. > Setting "auto-update" to false eliminates the problem! ( sadly, the > auto-update feature could be useful :-( ) > > Here is the (very simplified) classes code: > ---------------------------------------------------------- > public class Order > { > private int id; > private Vector items; > [...] > } > > public class Item > { > private int id; > private int orderId; > private Order order; > [...] > } > ---------------------------------------------------------- > > And the (very simplified) mapping is this: > ---------------------------------------------------------- > <class-descriptor class="test.Order" table="_Orders"> > <field-descriptor id="1" > name="id" > column="id" > jdbc-type="INTEGER" > primarykey="true" > autoincrement="true" > /> > [...] > <collection-descriptor name="items" > element-class-ref="test.Item" > auto-retrieve="true" auto-update="true" auto-delete="false" > > > <inverse-foreignkey field-id-ref="3"/> > </collection-descriptor> > </class-descriptor> > > <class-descriptor class="test.Item" table="_Items"> > <field-descriptor id="1" > name="id" > column="id" > jdbc-type="INTEGER" > primarykey="true" > autoincrement="true" > /> > [...] > <field-descriptor id="3" > name="orderId" > column="orderId" > jdbc-type="INTEGER" > /> > <reference-descriptor name="order" > class-ref="test.Order" > > > <foreignkey field-id-ref="3"/> > </reference-descriptor> > </class-descriptor> > ---------------------------------------------------------- > [I removed fileds and references that doesn't have anything to do > with the problem] > > THIS mapping will cause the problem inserting a new Order. > Changing "auto-update" to "false", in the "collection-descriptor", will > not. > > Is is an OJB problem? > Or is it a logic problem in the mapping? > > Bye > Lorenzo > > > > > > > WEBPLAN srl > v.Civerchio 4 > 20159 MILANO - ITALY > tel. +39-02-69311782 > fax. +39-02-60857392 > > > > _______________________________________________________________ > > Don't miss the 2002 Sprint PCS Application Developer's Conference > August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm > > _______________________________________________ > Objectbridge-users mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-users > > > > |
From: <Ste...@eu...> - 2002-06-06 16:28:14
|
hi jakob. Thank you for your help. It works OK with simple mapped objects (without using FieldConversion).= But there is a problem with object with some fields mapped through FieldCnversion. FieldConversion.javaToSgl() is not used during the Query resolving (it should be used probably in StatementManager.bindStatementValue() ). In Toplink they build up condition from all not null Object attribute values, not 0 int primitive attributes (char, int, ....), not false boolean attributes but it is possible to customize it by defining polic= y. Tnx Stefan |--------+----------------------------------------------> | | "Jakob Braeuchi" | | | <jbr...@ho...> | | | Odeslal: | | | obj...@li...urc| | | eforge.net | | | 05.06.2002 15:33 | | | | |--------+----------------------------------------------> >--------------------------------------------------------------------= ---------------------------------------| | = | | Komu: <obj...@li...>, <Stefan_T= am...@eu...> | | Kopie: = | | P=F8edm=ECt: Re: [ojb-users] Does getCollectionByQuery() = with QueryByExample argument works? | | = | | = | >--------------------------------------------------------------------= ---------------------------------------| hi stefan, QueryByExample is actually a query by identity. try new QueryByCriteria(exampleObj) this will build a QueryByExample us= ing all non null values. this feature is not perfect (can't handel null i query, what about primitives ) and it's supported by QueryFactory. do you know how toplink handles this ? hth jakob ----- Original Message ----- From: <Ste...@eu...> To: <obj...@li...> Sent: Wednesday, June 05, 2002 11:01 AM Subject: Re: [ojb-users] Does getCollectionByQuery() with QueryByExampl= e argument works? Yes, getObjectByQuery() work OK but it returns only one object, but I = want to find Collection of object that fulfill conditions defined by "ExampleObject". We found it very flexibly to use "ObjectByExample" idea in our previous= project (Toplink) to simplify finders API. Tnx, Stefan |--------+----------------------------------------------> | | "Jakob Braeuchi" | | | <jbr...@ho...> | | | Odeslal: | | | obj...@li...urc| | | eforge.net | | | 04.06.2002 19:11 | | | | |--------+----------------------------------------------> > -----------------------------------------------------------------------= ---- ---------------------| | | | Komu: <obj...@li...>, <Ste...@eu...> | | Kopie: | | P=F8edm=ECt: Re: [ojb-users] Does getCollectionByQuery() = with QueryByExample argument | | works? | | | | | > -----------------------------------------------------------------------= ---- ---------------------| hi stefan, have you tried getObjectByQuery() ? hth jakob ----- Original Message ----- From: <Ste...@eu...> To: <obj...@li...> Sent: Tuesday, June 04, 2002 5:50 PM Subject: [ojb-users] Does getCollectionByQuery() with QueryByExample argument works? > What I do wrong? > > I call find() method with persistant object with id attribute (primar= y key) > set only (all other attributes are null or 0). There is no unittest w= ith > such functionality. > > public Collection find(Object object) { > Query query =3D new QueryByExample(object); > return broker.getCollectionByQuery(query); > } > > It returns collection of all objects from DB. > > Tnx Stefan > > P.S. I have ojb 0.9 > > > _______________________________________________________________ > > Don't miss the 2002 Sprint PCS Application Developer's Conference > August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cf= m > > _______________________________________________ > Objectbridge-users mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-users > _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm _______________________________________________ Objectbridge-users mailing list Obj...@li... https://lists.sourceforge.net/lists/listinfo/objectbridge-users _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm _______________________________________________ Objectbridge-users mailing list Obj...@li... https://lists.sourceforge.net/lists/listinfo/objectbridge-users _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm _______________________________________________ Objectbridge-users mailing list Obj...@li... https://lists.sourceforge.net/lists/listinfo/objectbridge-users = |
From: Lorenzo N. <ln...@we...> - 2002-06-06 10:24:42
|
I hope this is not a FAQ :-) > From: "Govindarajan S (Gover)" <gov...@az...> > To: obj...@li... > Date: Wed, 5 Jun 2002 18:58:37 +0530 > Subject: [ojb-users] Error in 1:n mapping using ODMG API Hello, > I get the following exception when using the ODMG API for persisting > the 1:n mapping. I have a product group class which has a collection > of articles. Iam trying to persist the ProductGroup. As expected it > tries to persist the Article as well. But during the process i get the > following exception message, > > [ojb.broker.singlevm.PersistenceBrokerImpl] ERROR: Error in > Transaction abort: General error: Warning: Some non-transactional > changed tables couldn't be rolled back > org.odmg.TransactionAbortedException: Invalid argument value: > Duplicate entry '71' for key 1 > [...] > From what i observed its trying to insert the article, which is > already inserted. I took a look at the SQL queries submitted to the > database and found this, > [...] > At this stage an SQLException is thrown. > > What could be going wrong? why is it trying to insert the first > element again? I'm experiencing a similar problem, persinsting the classic 1:n mapping: 1 Order to n. tems (using OJB v.0.9) I made the association navigable in both directions: in Order there is a collection of Items AND in the Item there is the FK to Order + the reference to the Order Both tables PK are autoincrements. If I set the collection of Items in Order for auto-update, when I insert a new Order (with new Items), OJB tries to insert duplicate Items (with the same PK) causing the exception. Setting "auto-update" to false eliminates the problem! ( sadly, the auto-update feature could be useful :-( ) Here is the (very simplified) classes code: ---------------------------------------------------------- public class Order { private int id; private Vector items; [...] } public class Item { private int id; private int orderId; private Order order; [...] } ---------------------------------------------------------- And the (very simplified) mapping is this: ---------------------------------------------------------- <class-descriptor class="test.Order" table="_Orders"> <field-descriptor id="1" name="id" column="id" jdbc-type="INTEGER" primarykey="true" autoincrement="true" /> [...] <collection-descriptor name="items" element-class-ref="test.Item" auto-retrieve="true" auto-update="true" auto-delete="false" > <inverse-foreignkey field-id-ref="3"/> </collection-descriptor> </class-descriptor> <class-descriptor class="test.Item" table="_Items"> <field-descriptor id="1" name="id" column="id" jdbc-type="INTEGER" primarykey="true" autoincrement="true" /> [...] <field-descriptor id="3" name="orderId" column="orderId" jdbc-type="INTEGER" /> <reference-descriptor name="order" class-ref="test.Order" > <foreignkey field-id-ref="3"/> </reference-descriptor> </class-descriptor> ---------------------------------------------------------- [I removed fileds and references that doesn't have anything to do with the problem] THIS mapping will cause the problem inserting a new Order. Changing "auto-update" to "false", in the "collection-descriptor", will not. Is is an OJB problem? Or is it a logic problem in the mapping? Bye Lorenzo WEBPLAN srl v.Civerchio 4 20159 MILANO - ITALY tel. +39-02-69311782 fax. +39-02-60857392 |
From: Lorenzo N. <ln...@we...> - 2002-06-06 07:05:17
|
Hello, I've a newbie question on OQL syntax support in OJB. I'm running some personal tests with OJB 0.9 after successfully running all junit tests and tutorials. For OQL, I'm referring to the ODMG 3.0 "bible" paper book (actually not very useful as a "user"...). If I run a simple OQL query using aliases like this: select c from test.Client c where c.id = $1 I get a parsing error calling oqlQuery.create(...): line 1: unexpected token: c java.lang.NullPointerException ojb.odmg.OQLQueryImpl.create(OQLQueryImpl.java:178) I tried unsuccessfully many "permutations" :-) of the query sintax. Running the same OQL without alias works! select c from test.Client where id = $1 My questions are: Am I doing some mistake? and: What is the level of support and compliance of ODMG 3.0 OQL in OJB? I browsed the documentation and many of the examples, but almost all OQL examples I've seen are rather "basic". Thanks Lorenzo WEBPLAN srl v.Civerchio 4 20159 MILANO - ITALY tel. +39-02-69311782 fax. +39-02-60857392 |
From: Leandro R. S. C. <le...@ib...> - 2002-06-05 18:02:39
|
On Tue, 2002-06-04 at 04:51, Mahler Thomas wrote: > Hi all, Hi > =20 > after some minor problems I managed to assemble a new release. > As I had to fix several bugs to get this release stable, I did not find t= he > time to keep the documentation up to date. > In particular the documentation regarding the repository is out of sync d= ue > to the redesigned repository.dtd. I trying to make ojb-1-0 work with my app. I can help you with the docs if you want. > =20 > Lasse Lindg=E5rd wrote a stylesheet to transform existing repositories to= the > new syntax. I hope this will help users to migrate quickly! >=20 > >From the relase notes: >=20 > Changes in Release 0.9 >=20 >=20 >=20 > new features: > ... > bug fixes: > ... > Refactorings: > ... >=20 > With this release we are feature complete for the 1.0 release! >=20 > For 1.0 you should not expect more features to be added. >=20 I agree with you. One thing I'd like to change in OJB is exception handling. There are many places where Throwable is caught ! That is no good ! We could change the way exceptions are handled and provide better error reporting/logging ! I voluntier to do that ! >=20 > cheers, > =20 > Thomas > =20 --=20 Leandro Rodrigo Saad Cruz IT - Inter Business Tecnologia e Servicos (IB) http://www.ibnetwork.com.br |
From: Vullanki, S. <Sri...@co...> - 2002-06-05 15:59:17
|
Hi , For the auto increment i could not get the next value! the auto increment is usually incrementing to 10 instead of 1.why is it happening so! and about commit in 1:n mapping I am not getting any excpetion if I use Persistent Broker API instead of ODMG API. Thanks Srividya |
From: Jakob B. <jbr...@ho...> - 2002-06-05 13:33:42
|
hi stefan, QueryByExample is actually a query by identity. try new QueryByCriteria(exampleObj) this will build a QueryByExample using all non null values. this feature is not perfect (can't handel null i query, what about primitives ) and it's supported by QueryFactory. do you know how toplink handles this ? hth jakob ----- Original Message ----- From: <Ste...@eu...> To: <obj...@li...> Sent: Wednesday, June 05, 2002 11:01 AM Subject: Re: [ojb-users] Does getCollectionByQuery() with QueryByExample argument works? Yes, getObjectByQuery() work OK but it returns only one object, but I want to find Collection of object that fulfill conditions defined by "ExampleObject". We found it very flexibly to use "ObjectByExample" idea in our previous project (Toplink) to simplify finders API. Tnx, Stefan |--------+----------------------------------------------> | | "Jakob Braeuchi" | | | <jbr...@ho...> | | | Odeslal: | | | obj...@li...urc| | | eforge.net | | | 04.06.2002 19:11 | | | | |--------+----------------------------------------------> >--------------------------------------------------------------------------- ---------------------| | | | Komu: <obj...@li...>, <Ste...@eu...> | | Kopie: | | Předmět: Re: [ojb-users] Does getCollectionByQuery() with QueryByExample argument | | works? | | | | | >--------------------------------------------------------------------------- ---------------------| hi stefan, have you tried getObjectByQuery() ? hth jakob ----- Original Message ----- From: <Ste...@eu...> To: <obj...@li...> Sent: Tuesday, June 04, 2002 5:50 PM Subject: [ojb-users] Does getCollectionByQuery() with QueryByExample argument works? > What I do wrong? > > I call find() method with persistant object with id attribute (primary key) > set only (all other attributes are null or 0). There is no unittest with > such functionality. > > public Collection find(Object object) { > Query query = new QueryByExample(object); > return broker.getCollectionByQuery(query); > } > > It returns collection of all objects from DB. > > Tnx Stefan > > P.S. I have ojb 0.9 > > > _______________________________________________________________ > > Don't miss the 2002 Sprint PCS Application Developer's Conference > August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm > > _______________________________________________ > Objectbridge-users mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-users > _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm _______________________________________________ Objectbridge-users mailing list Obj...@li... https://lists.sourceforge.net/lists/listinfo/objectbridge-users _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm _______________________________________________ Objectbridge-users mailing list Obj...@li... https://lists.sourceforge.net/lists/listinfo/objectbridge-users |
From: Govindarajan S (Gover) <gov...@az...> - 2002-06-05 13:25:48
|
HI, I get the following exception when using the ODMG API for persisting the 1:n mapping. I have a product group class which has a collection of articles. Iam trying to persist the ProductGroup. As expected it tries to persist the Article as well. But during the process i get the following exception message, [ojb.broker.singlevm.PersistenceBrokerImpl] ERROR: Error in Transaction abort: General error: Warning: Some non-transactional changed tables couldn't be rolled back org.odmg.TransactionAbortedException: Invalid argument value: Duplicate entry '71' for key 1 at ojb.odmg.ObjectEnvelopeTable.commit(ObjectEnvelopeTable.java:116) at ojb.odmg.TransactionImpl.doCommit(TransactionImpl.java:200) at ojb.odmg.TransactionImpl.commit(TransactionImpl.java:350) at com.ojb.odmg.ProductDetailsClient.addArticleDetails(ProductDetailsClient.jav a:77) at com.ojb.odmg.ProductDetailsClient.main(ProductDetailsClient.java:49) Exception in thread "main" From what i observed its trying to insert the article, which is already inserted. I took a look at the SQL queries submitted to the database and found this, * INSERT INTO productgroup (prodGrpId,productGrpName,description) VALUES ('80','TestGrp','testgrp') * INSERT INTO article (articleId,articleName,prodGrpId) VALUES ('71','Art1','80') Inserted the first article whose id=71 * INSERT INTO article (articleId,articleName,prodGrpId) VALUES ('72','Art2','80') Inserted the second article whose id=72 * INSERT INTO article (articleId,articleName,prodGrpId) VALUES ('71','Art1','80') Fires a third insert with the same id=71 At this stage an SQLException is thrown. What could be going wrong? why is it trying to insert the first element again? Iam using the same repository.xml which i used for persisting using the PersistenceBroker API. The persistence code is below, try { ProductGroup prodGrp = new ProductGroup(); prodGrp.setProdGroupName("TestGrp"); prodGrp.setDescription ("testgrp"); Article art1 = new Article(); art1.setArticleName("Art1"); Article art2 = new Article(); art2.setArticleName("Art2"); prodGrp.addArticle (art1); prodGrp.addArticle (art2); Transaction tx = odmg.newTransaction(); tx.begin(); tx.lock (prodGrp,tx.WRITE); tx.commit(); } catch (PersistenceBrokerException pExp) { System.out.println ("----- Error persisting Article -----"); pExp.printStackTrace(); } // end of try-catch gover |
From: Mark R. <Mar...@cr...> - 2002-06-05 09:43:40
|
Hi can anyone tell me how to change the default database from Hypersonic in running the unit tests? DB has built successfully but I cannnot see how to supply the properties (dbmsName et al) that the filterset in build.xml requires. Only reference to these I can see are in the .profile files in the profile dir Thanks Mark Rowell ---------------------------------------------------------------- Mark Rowell CreditTrade T: +44 (020) 7400 5078 M: mailto:mar...@cr... CreditTrade Limited is regulated by the FSA. © CreditTrade 2002. All rights reserved. The information and data contained in this email is provided for the information purposes of the addressee only and should not be reproduced and/or distributed to any other person. It is provided without any warranty whatsoever and unless stated otherwise consists purely of indicative market prices and other information. Any opinion or comments expressed or assumption made in association with the data or information provided in this email is a reflection of CreditTrades judgement at the time of compiling the data and is subject to change. CreditTrade hereby makes no representation and accepts no responsibility or liability as to the completeness or accuracy of this email. The content of this email is not intended as an offer or solicitation for, or recommendation of, the purchase or sale of any financial instrument, or as an official confirmation of any transaction, and should not be construed as investment advice. |
From: <Ste...@eu...> - 2002-06-05 09:01:32
|
Yes, getObjectByQuery() work OK but it returns only one object, but I = want to find Collection of object that fulfill conditions defined by "ExampleObject". We found it very flexibly to use "ObjectByExample" idea in our previous= project (Toplink) to simplify finders API. Tnx, Stefan |--------+----------------------------------------------> | | "Jakob Braeuchi" | | | <jbr...@ho...> | | | Odeslal: | | | obj...@li...urc| | | eforge.net | | | 04.06.2002 19:11 | | | | |--------+----------------------------------------------> >--------------------------------------------------------------------= ----------------------------| | = | | Komu: <obj...@li...>, <Stefan_T= am...@eu...> | | Kopie: = | | P=F8edm=ECt: Re: [ojb-users] Does getCollectionByQuery() = with QueryByExample argument | | works? = | | = | | = | >--------------------------------------------------------------------= ----------------------------| hi stefan, have you tried getObjectByQuery() ? hth jakob ----- Original Message ----- From: <Ste...@eu...> To: <obj...@li...> Sent: Tuesday, June 04, 2002 5:50 PM Subject: [ojb-users] Does getCollectionByQuery() with QueryByExample argument works? > What I do wrong? > > I call find() method with persistant object with id attribute (primar= y key) > set only (all other attributes are null or 0). There is no unittest w= ith > such functionality. > > public Collection find(Object object) { > Query query =3D new QueryByExample(object); > return broker.getCollectionByQuery(query); > } > > It returns collection of all objects from DB. > > Tnx Stefan > > P.S. I have ojb 0.9 > > > _______________________________________________________________ > > Don't miss the 2002 Sprint PCS Application Developer's Conference > August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cf= m > > _______________________________________________ > Objectbridge-users mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-users > _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm _______________________________________________ Objectbridge-users mailing list Obj...@li... https://lists.sourceforge.net/lists/listinfo/objectbridge-users = |
From: Ebersole, S. <ste...@vi...> - 2002-06-04 17:56:28
|
I just downloaded version 0.9 and want to start moving the testing code I have been playing with over to our J2EE environment since there is now JTA support. I had some quick questions before I started attempting this: What happens when PersistenceBrokerFactory.createPersistenceBroker() is called multiple times within the scope of a single transaction (if using the J2EE versions of broker and broker factory)? I am assuming that, because of the calls to the TAMonitor class, that it will simply return broker impl previously (if one) obtained during the transaction? Just wanted to make sure that this worked. Thanks. ******************************************** Steve Ebersole IT Integration Engineer Vignette Corporation 512.741.4195 Visit http://www.vignette.com ******************************************** |
From: Jakob B. <jbr...@ho...> - 2002-06-04 17:11:53
|
hi stefan, have you tried getObjectByQuery() ? hth jakob ----- Original Message ----- From: <Ste...@eu...> To: <obj...@li...> Sent: Tuesday, June 04, 2002 5:50 PM Subject: [ojb-users] Does getCollectionByQuery() with QueryByExample argument works? > What I do wrong? > > I call find() method with persistant object with id attribute (primary key) > set only (all other attributes are null or 0). There is no unittest with > such functionality. > > public Collection find(Object object) { > Query query = new QueryByExample(object); > return broker.getCollectionByQuery(query); > } > > It returns collection of all objects from DB. > > Tnx Stefan > > P.S. I have ojb 0.9 > > > _______________________________________________________________ > > Don't miss the 2002 Sprint PCS Application Developer's Conference > August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm > > _______________________________________________ > Objectbridge-users mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-users > |
From: <Ste...@eu...> - 2002-06-04 15:50:40
|
What I do wrong? I call find() method with persistant object with id attribute (primary key) set only (all other attributes are null or 0). There is no unittest with such functionality. public Collection find(Object object) { Query query = new QueryByExample(object); return broker.getCollectionByQuery(query); } It returns collection of all objects from DB. Tnx Stefan P.S. I have ojb 0.9 |
From: Vullanki, S. <Sri...@co...> - 2002-06-04 15:34:41
|
Hi, I am unable to commit a trasaction after writing an object with 1:n mapping!! I am getting the following exception org.odmg.TransactionAbortedException Srividya |