Re: pbapi + select from multiple tables
Hi, in your BAR class you don't declare a collection for FOO, and a collection for BAR childs? Joose Vettenranta wrote: I have like FOO and BAR classes and it's 1:n connection.. There can be lot's of FOO pointing to same BAR id and BAR has parent id which points to BAR itself now I would like to fetch something from that tree.. My first idea was this: in SQL: select * from FOO,BAR where BAR.parent= and BAR.id=FOO.bar_id; but now that I was writing this, can I some how fetch the subtree from BAR? basicely BAR is a tree where there is 1 root element and then childs and their childs .. etc.. I tried to look at http://db.apache.org/ojb/docu/guides/query.html but couldn't find anything to help me. of course one option could be to make a recursive function to go through whole tree, maybe it's what I have to do... Thanks, Joose -- "Always remember that you are unique, just like everyone else!" * http://iki.fi/joose/ * [EMAIL PROTECTED] * +358 44 561 0270 * - 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: Multiple Joined Table using XDoclet.
Thomas Dudziak wrote: Clóvis Wichoski wrote: If I use a reference with super keyword in a subclass, and determine-extents="false" in super-class and include-inherited="false" in subclasses, all fields from super classes are recognized in Query of subclasses, but for collections don't ie: (FROM Company WHERE shortcut = "COMPANYX" works but FROM Company WHERE myAddress.myCity.name = "CITYX" don't), because what OJB don't investigate superclass descriptor about collections and references to resolve query path expressions? There are any design issues about this? this is done for fields but don't for collections. As I said, there are some issues with querying when using the multiple-joined-tables strategy. Could you perhaps add a bug to Scarab for this ? Because this is a design choice this isn't a bug with the solution in past email works very well, I'm only question because I attempt to understand the ways that OJB work, for me support OJB too. ok, I understand all of this, but the idea of ojb-check-colletions-from-super, is to reduce errors from changes in super, think this, you had a super class that have 20 subclasses, if you add only one new field in this superclass then you need to change all subclasses with a include-inherited part for this new field. This is a design choice because I wanted to make the javadoc-'api' as simple as possible (few, easy-to-understand tags) without sacrificing flexibility. And in that regard, the ability to ignore inherited features for one given class without affecting its base- or subclasses is IMO the easiest way. And cases with 20 subclasses that all ignore or change several baseclass features is somewhat rare, I think. ok, for know here I have a case with 10 subclasses that all ignore, the changes on baseclass maybe never occur but for the first mapping in OJB is a great copy and paste work ;), but don't spend time with this I agree with your design choice. Thanks for your help. Clóvis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
About Serialization
Hi, I want to try an issue with OJB and would like to know if anyone had do it: 1) Client side. (note: this application don't have and don't know about OJB only know about the Object) 1.1) request the server for an object. 2) Server side. 2.1) receive a request to load an object. 2.2) load this object from PB. 2.3) serialize this object to client. 3) Client side. 3.1) receive and deserialize the object. 3.2) make changes on this objects. 3.3) serialize this object to server to be updated. 4) Server side. 4.1) receive a request to update an object. 4.1) open a PB transaction. 4.2) update the object. 4.3) commit PB transaction. 4.4) returns a serialization of this new updated object to client 5) Client side. 5.1) receive and deserialize the object. 5.2) and says to user object updated. 5.3) the end. Then troubles to be solved with this in OJB with PB are: For step 2.3, since the client don't know NOTHING about OJB how are you solved problems with dependencies of interfaces and classes for collections, like RemovalAwareCollection. before serialization created a new Vector and put all elements from RemovalAwareCollection in this new Vector and changed the reference to this, then serialize? or OJB provides a better way? For step 4.2, load the object see what has changed in serialized object and change in transaction object, or exists a method like makeDirty (from OJB ODMG) that do this in PB? if yes how OJB will control the RemovalAwareCollection that in serialized object, is now simply a Vector? TIA Clóvis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multiple Joined Table using XDoclet.
Thomas Dudziak wrote: Clóvis Wichoski wrote: Thanks, Thomas all works now there are any reason that OJB don't get collections from super? What do you mean ? If I use a reference with super keyword in a subclass, and determine-extents="false" in super-class and include-inherited="false" in subclasses, all fields from super classes are recognized in Query of subclasses, but for collections don't ie: (FROM Company WHERE shortcut = "COMPANYX" works but FROM Company WHERE myAddress.myCity.name = "CITYX" don't), because what OJB don't investigate superclass descriptor about collections and references to resolve query path expressions? There are any design issues about this? this is done for fields but don't for collections. maybe in newer versions XDoclet/repository includes an attribute like ojb-check-collections-from-super or better. ;) I'm not sure what you mean, but you should be aware of the differences between 'include-inherited' and 'determine-extents'. The former works on the Java level, e.g. it specifies whether base class features marked with an @ojb tag should be copied to the current class descriptor. The latter specifies whether the XDoclet OJB module should automatically create extent-class tags in the repository file for all persistent subtypes of the current class. These extent-class tags tell OJB's runtime about the inheritance, but they won't work with the multiple-joined-table strategy. This however has no influence on the include-inherited part. So you almost always have include-inherited=true (using ojb.modify-inherited with ignore=true for features that you don't want in the descriptor of the current class) whereas you will want determine-extents=false for the inheritance hierarhcies mapped with the multiple-joined-table strategy. ok, I understand all of this, but the idea of ojb-check-colletions-from-super, is to reduce errors from changes in super, think this, you had a super class that have 20 subclasses, if you add only one new field in this superclass then you need to change all subclasses with a include-inherited part for this new field. TIA Clóvis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multiple Joined Table using XDoclet.
Thanks, Thomas all works now there are any reason that OJB don't get collections from super? maybe in newer versions XDoclet/repository includes an attribute like ojb-check-collections-from-super or better. ;) Thomas Dudziak wrote: You don't have to redefine the reference, because it gets inherited (after appliying the change that I outlined in the last email). However, I cannot tell whether the query then works as there seem to be some problems with the multiple-joined-table-mapping strategy and queries. Please try the query after the change of 'include-inherited', and if it is not still working, then please create a bug report. Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multiple Joined Table using XDoclet.
Thomas, thanks for reply, but and about issues for querys at end of email? here are a cut: Now the querys that must work with this model. I don't use ODMG but I will explain in OQL because I use OQL to generate Criteria and appears to be more readable: 1) SELECT obj FROM User obj WHERE myCompany.myAddress.myCity.name = "CITY 1" Works because the user reference points to a Person class. 2) SELECT obj FROM User obj WHERE myCompany.shortcut = "COMPANY 1" AND login = "USER 1" Works like above. 3) SELECT obj FROM Company obj WHERE shortcut = "COMPANY 1" Works OJB discover the shortcut field from Person and does a great job here. 3) SELECT obj FROM Company obj WHERE myAddress.myCity.name = "CITY 1" Don't work, and throws a Database Exception Table must be in from list, because myAddress.myCity.name appears in SQL statement generated by OJB, here OJB does a bad job, because don't discover the collection of Address from Person. (I think that this can be done like for fields). but in an email from Jakob he mentioned for me to redefine references in descriptor, doing that, works, but this redefination must be in repository_user.xml, how do it with XDoclet? isn't better to OJB discover collections from super class like for fields? TIA Clóvis Thomas Dudziak wrote: Clóvis Wichoski wrote: After several days trying to use Multiple Joined Tables with XDoclet, I can do this work, but there are more things with Multiple Joined Table and XDoclet that I need to know how to do. first this are sample classes for better understanding: /** * @ojb.class table="PERSON" *determine-extents="false" **/ public class Person { /** * @ojb.field column="OID" *length="8" *primarykey="true" **/ public String oid; /** * @ojb.field column="VERSION" *locking="true" **/ public int version; /** * @ojb.field column="SHORTCUT" *length="20" **/ String shortcut; /** * @ojb.field column="NAME" *length="40" **/ String name; /** * @ojb.collection element-class-ref="Address" * foreignkey="myPersonOid" * auto-retrieve="true" * auto-update="object" * auto-delete="object" **/ java.util.Vector myAddress; } /** * @ojb.class table="COMPANY" *include-inherited="false" * @ojb.field name="oid" *column="oid" *jdbc-type="VARCHAR" *length="8" *primarykey="true" * @ojb.reference class-ref="Person" *foreignkey="oid" *auto-retrieve="true" *auto-update="object" *auto-delete="object" **/ public class Company extends Person { /** * @ojb.field column="FOUNDATION_DATE" * conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampFieldConversion" *jdbc-type="TIMESTAMP" **/ java.util.Date foundationDate; } /** * @ojb.class table="NATURALPERSON" *include-inherited="false" * @ojb.field name="oid" *column="oid" *jdbc-type="VARCHAR" *length="8" *primarykey="true" * @ojb.reference class-ref="Person" *foreignkey="oid" *auto-retrieve="true" *auto-update="object" *auto-delete="object" **/ public class NaturalPerson extends Person { /** * @ojb.field column="MOTHER_NAME" *length="40" **/ String motherName; /** * @ojb.field column="FATHER_NAME" *length="40" **/ String fatherName; } /** * @ojb.class table="ADDRESS" * @ojb.field name="myPersonOid" *column="MY_PERSON" *jdbc-type="VARCHAR" *length="8" * @ojb.field name="myCityOid" *column="MY_CITY" *jdbc-type="VARCHAR" *length="8" **/ public class Address { /** * @ojb.field column="OID" *length="8" *primarykey="true" **/ public String oid; /** * @ojb.field column="VERSION" *locking="true" **/ public int version; /** * @ojb.field column="STREET" *length="40" **/ String street; /**
Multiple Joined Table using XDoclet.
Hi, After several days trying to use Multiple Joined Tables with XDoclet, I can do this work, but there are more things with Multiple Joined Table and XDoclet that I need to know how to do. first this are sample classes for better understanding: /** * @ojb.class table="PERSON" *determine-extents="false" **/ public class Person { /** * @ojb.field column="OID" *length="8" *primarykey="true" **/ public String oid; /** * @ojb.field column="VERSION" *locking="true" **/ public int version; /** * @ojb.field column="SHORTCUT" *length="20" **/ String shortcut; /** * @ojb.field column="NAME" *length="40" **/ String name; /** * @ojb.collection element-class-ref="Address" * foreignkey="myPersonOid" * auto-retrieve="true" * auto-update="object" * auto-delete="object" **/ java.util.Vector myAddress; } /** * @ojb.class table="COMPANY" *include-inherited="false" * @ojb.field name="oid" *column="oid" *jdbc-type="VARCHAR" *length="8" *primarykey="true" * @ojb.reference class-ref="Person" *foreignkey="oid" *auto-retrieve="true" *auto-update="object" *auto-delete="object" **/ public class Company extends Person { /** * @ojb.field column="FOUNDATION_DATE" * conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampFieldConversion" *jdbc-type="TIMESTAMP" **/ java.util.Date foundationDate; } /** * @ojb.class table="NATURALPERSON" *include-inherited="false" * @ojb.field name="oid" *column="oid" *jdbc-type="VARCHAR" *length="8" *primarykey="true" * @ojb.reference class-ref="Person" *foreignkey="oid" *auto-retrieve="true" *auto-update="object" *auto-delete="object" **/ public class NaturalPerson extends Person { /** * @ojb.field column="MOTHER_NAME" *length="40" **/ String motherName; /** * @ojb.field column="FATHER_NAME" *length="40" **/ String fatherName; } /** * @ojb.class table="ADDRESS" * @ojb.field name="myPersonOid" *column="MY_PERSON" *jdbc-type="VARCHAR" *length="8" * @ojb.field name="myCityOid" *column="MY_CITY" *jdbc-type="VARCHAR" *length="8" **/ public class Address { /** * @ojb.field column="OID" *length="8" *primarykey="true" **/ public String oid; /** * @ojb.field column="VERSION" *locking="true" **/ public int version; /** * @ojb.field column="STREET" *length="40" **/ String street; /** * @ojb.reference foreignkey="myCityOid" **/ City myCity; } /** * @ojb.class table="CITY" **/ public class City { /** * @ojb.field column="OID" *length="8" *primarykey="true" **/ public String oid; /** * @ojb.field column="VERSION" *locking="true" **/ public int version; /** * @ojb.field column="NAME" *length="40" **/ String name; } /** * @ojb.class table="USER" * @ojb.field name="myCompanyOid" *column="MY_COMPANY" *jdbc-type="VARCHAR" *length="8" * @ojb.field name="myNaturalPersonOid" *column="MY_NATURAL_PERSON" *jdbc-type="VARCHAR" *length="8" **/ public class User { /** * @ojb.field column="OID" *length="8" *primarykey="true" **/ public String oid; /** * @ojb.field column="VERSION" *locking="true" **/ public int version; /** * @ojb.field column="LOGIN" *length="15" **/ public String login; /** * @ojb.field column="PASSWORD" *length="15" **/ public String password; /** * @ojb.reference foreignkey="myCompanyOid" **/ Person myCompany; /** * @ojb.reference foreignkey="myNaturalPersonOid" **/ Person myNaturalPerson; } Issues: 1) For this works after repository_user.xml is generated, I manually remove the anonymous attribute of field oid from classes Company and NaturalPerson, then how do this, without override oid in subclasses? (If don't remove I get a java.lang.NullPointerException because oid is a primary key) Now the querys that must work with this model. I don't use ODMG but I will explain in OQL because I use OQL to generate Criteria and appears to be more readable: 1) SELECT obj FROM User obj WHERE myCompany.myAddress.myCity.name = "CITY 1" Works because the user reference points to a Person class. 2) SELECT obj FROM User obj WHERE myCompany.short
Re: wrong SQL generated when use path expression for extent with Multiple Joined Tables
I solved and post the patch to commit, please the solution in http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgId=1750208 Clóvis Wichoski wrote: Hi, I'm getting wrong results when executing a Query with Criteria that uses path expression for extent with Multiple Joined Tables: The QueryByCriteria from class myproject.User where [myCompany.shortcut = COMPANYX, [login = UserX]] The expected result is that returns only the User of COMPANYX with login UserX, but this results in ALL login equals UserX, the OR part in SQL generate the wrong result, because the field shortcut exists only in superclass Person In list archives I found some messages that may make sense for this error: http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgNo=7587 maybe that says "..if no field is found the name from the criteria is used.." but for the multiple joined extend this must be false, or my mappings are wrong? and maybe this message started this trouble with multiple joined tables: http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgId=612081 Follow the part of trace I'm getting here: ... [org.apache.ojb.broker.core.PersistenceBrokerImpl] DEBUG: Creating RsIterator for class [myproject.User] [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeQuery : QueryByCriteria from class myproject.User where [myCompany.shortcut = COMPANYX, [login = UserX]] [org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$TableAlias] DEBUG: TableAlias(): using hints ? false [org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$TableAlias] DEBUG: TableAlias(): using hints ? false [org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$TableAlias] DEBUG: TableAlias(): using hints ? false [org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$TableAlias] DEBUG: TableAlias(): using hints ? false [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: Result of getTableAlias(): PERSON A1 [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.VERSION,A0.STATUS,A0.PASSWORD,A0.LOGIN,A0.OID,A0.MY_COMPANY,A0.MY_EMPLOYEE FROM USER A0,PERSON A1,EMPLOYEE A1E0,COMPANY A1E1 WHERE A0.MY_COMPANY=A1.OID(+) AND A0.MY_COMPANY=A1E0.OID(+) AND A0.MY_COMPANY=A1E1.OID(+) AND (( (A1.SHORTCUT = ? OR shortcut = ? OR shortcut = ?)) AND (A0.LOGIN = ?)) ... but the correct SQL is: SELECT A0.VERSION,A0.STATUS,A0.PASSWORD,A0.LOGIN,A0.OID,A0.MY_COMPANY,A0.MY_EMPLOYEE FROM USER A0,PERSON A1,EMPLOYEE A1E0,COMPANY A1E1 WHERE A0.MY_COMPANY=A1.OID(+) AND A0.MY_COMPANY=A1E0.OID(+) AND A0.MY_COMPANY=A1E1.OID(+) AND (( (A1.SHORTCUT = ? ) AND (A0.LOGIN = ?)) I'm using a compiled CVS checkout of version 1.0, with a SapDB database. TIA Clóvis - 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]
wrong SQL generated when use path expression for extent with Multiple Joined Tables
Hi, I'm getting wrong results when executing a Query with Criteria that uses path expression for extent with Multiple Joined Tables: The QueryByCriteria from class myproject.User where [myCompany.shortcut = COMPANYX, [login = UserX]] The expected result is that returns only the User of COMPANYX with login UserX, but this results in ALL login equals UserX, the OR part in SQL generate the wrong result, because the field shortcut exists only in superclass Person In list archives I found some messages that may make sense for this error: http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgNo=7587 maybe that says "..if no field is found the name from the criteria is used.." but for the multiple joined extend this must be false, or my mappings are wrong? and maybe this message started this trouble with multiple joined tables: http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgId=612081 Follow the part of trace I'm getting here: ... [org.apache.ojb.broker.core.PersistenceBrokerImpl] DEBUG: Creating RsIterator for class [myproject.User] [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeQuery : QueryByCriteria from class myproject.User where [myCompany.shortcut = COMPANYX, [login = UserX]] [org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$TableAlias] DEBUG: TableAlias(): using hints ? false [org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$TableAlias] DEBUG: TableAlias(): using hints ? false [org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$TableAlias] DEBUG: TableAlias(): using hints ? false [org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$TableAlias] DEBUG: TableAlias(): using hints ? false [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: Result of getTableAlias(): PERSON A1 [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.VERSION,A0.STATUS,A0.PASSWORD,A0.LOGIN,A0.OID,A0.MY_COMPANY,A0.MY_EMPLOYEE FROM USER A0,PERSON A1,EMPLOYEE A1E0,COMPANY A1E1 WHERE A0.MY_COMPANY=A1.OID(+) AND A0.MY_COMPANY=A1E0.OID(+) AND A0.MY_COMPANY=A1E1.OID(+) AND (( (A1.SHORTCUT = ? OR shortcut = ? OR shortcut = ?)) AND (A0.LOGIN = ?)) ... but the correct SQL is: SELECT A0.VERSION,A0.STATUS,A0.PASSWORD,A0.LOGIN,A0.OID,A0.MY_COMPANY,A0.MY_EMPLOYEE FROM USER A0,PERSON A1,EMPLOYEE A1E0,COMPANY A1E1 WHERE A0.MY_COMPANY=A1.OID(+) AND A0.MY_COMPANY=A1E0.OID(+) AND A0.MY_COMPANY=A1E1.OID(+) AND (( (A1.SHORTCUT = ? ) AND (A0.LOGIN = ?)) I'm using a compiled CVS checkout of version 1.0, with a SapDB database. TIA Clóvis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: NullPointerException on SqlQueryStatement$Join.getColumns
Hi, Jakob The problem is with mapping of a reference to superclass in Company class, I make that: /** * @ojb.field name="personOid" *column="OID" *jdbc-type="VARCHAR" *length="8" *primarykey="true" * @ojb.reference class-ref="myproject.Person" *foreignkey="personOid" *auto-retrieve="true" *auto-update="object" *auto-delete="object" **/ public class Company extends Person { ... } but the correct one is: /** * @ojb.field name="oid" *column="OID" *jdbc-type="VARCHAR" *length="8" *primarykey="true" * @ojb.reference class-ref="com.supridatta.bo.pessoas.Pessoa" *foreignkey="oid" *auto-retrieve="true" *auto-update="object" *auto-delete="object" **/ public class Company extends Person { ... } I only changed the anonymous field name from personOid to oid, and works fine. I think that is because my classes as the same oid field for all extend, then the declaration of OID is on the super class, and I declared a primary key on a anonymous field but with a different name than superClass, I misunderstood the docs, because all references about it are different names for ids in super and subclasses. Thanks Clóvis Jakob Braeuchi wrote: hi clovis, this looks like a mapping problem to me. have you checked the collection descriptor ? jakob Clóvis Wichoski wrote: Hi, Here I'm getting a java.lang.NullPointerException, when call PersistenceBroker.getCollectionByQuery, this Query is created with follow OQL: select obj from myproject.User where myCompany.shortcut = "COMPANYX" and loginName = "USERX" I think that this is a trouble with my mapping, but the error don't points what I missed, anyone knows what can be this? I'm using XDoclet and a build from a CVS checkout checked today. TIA Clóvis The stack trace concerning OJB: java.lang.NullPointerException at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$Join.getColumns(SqlQueryStatement.java:1960) at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$Join.(SqlQueryStatement.java:1946) at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.addJoin(SqlQueryStatement.java:1121) at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.getTableAlias(SqlQueryStatement.java:1064) at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.buildJoinTreeForColumn(SqlQueryStatement.java:1577) at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.buildJoinTree(SqlQueryStatement.java:1554) at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.splitCriteria(SqlQueryStatement.java:1631) at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.(SqlQueryStatement.java:130) at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.(SqlQueryStatement.java:82) at org.apache.ojb.broker.accesslayer.sql.SqlSelectStatement.(SqlSelectStatement.java:50) at org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl.getPreparedSelectStatement(SqlGeneratorDefaultImpl.java:150) at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(JdbcAccessImpl.java:276) at org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(RsQueryObject.java:74) at org.apache.ojb.broker.accesslayer.RsIterator.(RsIterator.java:183) at org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(RsIteratorFactoryImpl.java:58) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(PersistenceBrokerImpl.java:1791) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(PersistenceBrokerImpl.java:1321) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:110) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:232) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:252) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1205) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(DelegatingPersistenceBroker.java:332) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(DelegatingPersistenceBroker.java:332) - 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]
NullPointerException on SqlQueryStatement$Join.getColumns
Hi, Here I'm getting a java.lang.NullPointerException, when call PersistenceBroker.getCollectionByQuery, this Query is created with follow OQL: select obj from myproject.User where myCompany.shortcut = "COMPANYX" and loginName = "USERX" I think that this is a trouble with my mapping, but the error don't points what I missed, anyone knows what can be this? I'm using XDoclet and a build from a CVS checkout checked today. TIA Clóvis The stack trace concerning OJB: java.lang.NullPointerException at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$Join.getColumns(SqlQueryStatement.java:1960) at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$Join.(SqlQueryStatement.java:1946) at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.addJoin(SqlQueryStatement.java:1121) at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.getTableAlias(SqlQueryStatement.java:1064) at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.buildJoinTreeForColumn(SqlQueryStatement.java:1577) at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.buildJoinTree(SqlQueryStatement.java:1554) at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.splitCriteria(SqlQueryStatement.java:1631) at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.(SqlQueryStatement.java:130) at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.(SqlQueryStatement.java:82) at org.apache.ojb.broker.accesslayer.sql.SqlSelectStatement.(SqlSelectStatement.java:50) at org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl.getPreparedSelectStatement(SqlGeneratorDefaultImpl.java:150) at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(JdbcAccessImpl.java:276) at org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(RsQueryObject.java:74) at org.apache.ojb.broker.accesslayer.RsIterator.(RsIterator.java:183) at org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(RsIteratorFactoryImpl.java:58) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(PersistenceBrokerImpl.java:1791) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(PersistenceBrokerImpl.java:1321) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:110) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:232) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryReferenceBroker.java:252) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1205) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(DelegatingPersistenceBroker.java:332) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(DelegatingPersistenceBroker.java:332) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: XDoclet throws xdoclet.XDocletException when do a reference to same class
Hi Thomas, I'm using the version 1.0.rc7 from binary distribution (db-ojb-1.0.rc7.tgz), but I found the trouble, I passed to you only the part of class that I think that is with the error, but there as a mapping to a collection of other class, but this class isn't mapped, then this invalidades the persistent state of Person and throws the exception, then I removed the mapping for this collection and works here too. Sorry this is my fault, now I will put all XDoclet in all classes before testing xdoclet-ojb generation of repository, in next time I will take more care. Thanks Thomas Dudziak wrote: Clóvis Wichoski wrote: Hi, I'm attempting to map a reference to same class using XDoclet, but I'm geting the Exception on build: xdoclet.XDocletException: The class Person referenced by myCreator in class Person is not persistent Maybe this is a Bug or there is another way to map references to same class? follow are the way that I'm mapping: /** * @ojb.class table="PERSON" * @ojb.field name="myCreatorOid" *column="MY_CREATOR" *jdbc-type="VARCHAR" */ public class Person { /** * @ojb.field column="OID" *length="8" *primarykey="true" **/ public String oid; /** * @ojb.reference foreignkey="myCreatorOid" */ Person myCreator; } I just added a testcase that mimics your scenario, and it passes without problems. Which version of the xdoclet ojb module do you use ? Please try with the CVS version, you can get the three jars - xdoclet, xjavadoc, xdoclet-ojb-module, from the CVS view on the OJB website. Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
XDoclet throws xdoclet.XDocletException when do a reference to same class
Hi, I'm attempting to map a reference to same class using XDoclet, but I'm geting the Exception on build: xdoclet.XDocletException: The class Person referenced by myCreator in class Person is not persistent Maybe this is a Bug or there is another way to map references to same class? follow are the way that I'm mapping: /** * @ojb.class table="PERSON" * @ojb.field name="myCreatorOid" *column="MY_CREATOR" *jdbc-type="VARCHAR" */ public class Person { /** * @ojb.field column="OID" *length="8" *primarykey="true" **/ public String oid; /** * @ojb.reference foreignkey="myCreatorOid" */ Person myCreator; } and the DDL is: CREATE TABLE PERSON (OID VARCHAR(8), MY_CREATOR VARCHAR(8), PRIMARY KEY(OID)) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Best way to use OQL with PB
Hi, I'm using PersistenceBroker and need use OQL only for selecting objects, then I will use OQLQueryImpl, only to make the Query object for me, but I have two issues in doubt: 1) Executing query with broker ... OQLQueryImpl oql = new OQLQueryImpl(broker.getPBKey()); oql.create(sbOQL.toString()); Collection results = broker.getCollectionByQuery(oql.getQuery()); ... 2) Executing query with OQLQueryImpl ... OQLQueryImpl oql = new OQLQueryImpl(broker.getPBKey()); oql.create(sbOQL.toString()); ManageableCollection results = oql.execute(); ... Then the doubts are: What is better approach issue 1, issue 2 or exists a better way? Since I will use the PB for me the best is issue 1, but for future compatibility don't be better to have a class QueryByOQL like QueryBySQL or QueryByCriteria? Is correct instancing OQLQueryImpl programmatically? TIA Clóvis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Migrating from Castor
Hi, I'm thinking to migrate from Castor to OJB, in Castor I use long transactions, and OIDs, are put by my own OIDs manager, I know that this things are supported by OJB. in this list anyone migrate from Castor? any tip to migrate or no? TIA Clóvis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]