objectbridge-users Mailing List for ObJectRelationalBridge (Page 5)
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: David R. <cas...@fr...> - 2002-05-24 15:20:04
|
hi all i have some problems running the performance test with an oracle 8.1.7 server it keeps throwing ClassCastException on double values i managed to make it run by patching ojb.broker.platforms.PlatformOracleImpl : public void setObjectForStatement(PreparedStatement ps, int index, Object value, int sqlType) throws SQLException { if (((sqlType == Types.VARBINARY) || (sqlType == Types.LONGVARBINARY)) && (value instanceof byte[])) { byte buf[] = (byte[])value; ByteArrayInputStream inputStream = new ByteArrayInputStream(buf); changePreparedStatementResultSetType(ps); ps.setBinaryStream(index, inputStream, buf.length); // this is where my patch starts } else if (sqlType == Types.FLOAT) { super.setObjectForStatement(ps, index, value, Types.DOUBLE); // this is where my patch ends } else { super.setObjectForStatement(ps, index, value, sqlType); } } i wonder why i need to do this since it seems that ojb has been tested against oracle.... background information : w2k sp2 + sun jdk1.4.0 + latest objectBridge from cvs oracle 8.1.7 on w2k sp2 oracle driver classes12.zip i successfully tested ObjectBridge against DB2 7.1 W2K, MySQL 3.23 linux, MySQL 3.23 W2K so i guess this is _not_ a configuration_ problem... thanks for your help David |
From: Brian D. <bde...@in...> - 2002-05-24 00:40:36
|
Hi all, Is the ODMG API supposed to delete items in a 1:n collection automatically for you? I saw in the FAQ that "Objects are registered to a transaction so that on commit of the transaction it knows that d and e do not longer belong to the collection. the ODMG collection will not delete the objects d and e but only the REFERENCES from the collection to those objects!". I'm not sure exactly what is meant though by "REFERENCES" vs. the actual object in a 1:n relationship. I have a User object with a collection attribute for Permissions. When I find a persisted User, and then call remove a Permission from the User object's collection, and then commit the transaction, the related row in the permission table is not deleted. For example: transaction.begin(); String removePermID = "DNLD"; User user = ... find persisted user...; for(Iterator i = user.getPermissions().iterator(); i.hasNext;) { Permission perm = (Permission)i.next(); if(perm.getPermissionID().equals(removePermID) { user.getPermissions().remove(perm); } } transaction.commit(); Am I misunderstanding how its supposed to work? Thanks in advance, Brian -- Brian DeVries Sr. Software Engineer mailto:bde...@in... http://www.intraware.com Voice: 925.253.6516 Fax: 925.253.6785 -------------------------------------------------------- Intraware... The leading provider of Electronic Software Delivery and Management (ESDM) Solutions |
From: Jason M. <mc...@na...> - 2002-05-22 16:34:49
|
Sybase Adaptive Server Enterprise (ASE) 12.5 seems to work fine with the ObjectBridge and the ojb.broker.platforms.PlatformDefaultImpl. I haven't tested much of the extended ODMG functionality yet, just messed around a little. But everything is running fine up to now. For the internal table generation I just used the same SQL from the SQL-server implementation (Since they're still pretty similar databases). Changed bigint to numeric for OBJ_LOCKENTRY_.TIMESTAMP. Can send you the DDL file for the internals (didn't do the demo stuff) if you want. -Jason ps. If you use Sybase, make sure table_names, column_names in your repository.xml are same case as in the database. Sybase objects are case sensitive. On Sun, 2002-05-12 at 01:22, Thomas Mahler wrote: > Hi Jason, > > please have a look at the repository.dtd. you will see that it is > possible to have a JdbcConnectionDescriptor element as the first element > of a ClassDescriptor element. > > Of course its possible to use JNDI datasources. There is an example for > a JNDI datasource JDBCConnectionDescriptor in the repository.xml file. > > HTH, > > Thomas > > Jason McKerr wrote: > > > Anyone know how I can use a different JDBC Connection than the one > > defined in repository.xml? Repository.xml says, if a Class does not > > specifiy it's own connection then it uses default. > > > > How do I specify connection in the class? Traditional JDBC/JNDI? If > > so, then how do I usethe broker interface in conjunction with that? > > > > > > Thanks, > > > > Newt > > > > > > > > > > _______________________________________________________________ > > > > Have big pipes? SourceForge.net is looking for download mirrors. We > supply > > the hardware. You get the recognition. Email Us: > ban...@so... > > _______________________________________________ > > Objectbridge-users mailing list > > Obj...@li... > > https://lists.sourceforge.net/lists/listinfo/objectbridge-users > > > > > > > > > > > > > _______________________________________________________________ > > Have big pipes? SourceForge.net is looking for download mirrors. We supply > the hardware. You get the recognition. Email Us: ban...@so... > _______________________________________________ > Objectbridge-users mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-users |
From: <Ste...@eu...> - 2002-05-22 12:30:23
|
What is the most efective way to delete all objects from DB that fulfil some conditions? Tnx Stefan |
From: Craig M. <Cra...@Su...> - 2002-05-20 23:27:27
|
I am implementing a customer SequenceManager and have noticed that the SequenceManagerDefaultImpl and the SequenceManagerFactory reference ojb.broker.singlevm.PersistenceBrokerImpl. Why does the factory use the singlevm broker? And how does the SequenceManagerFactory work if OJB is used in client/server mode? Thanks, Craig |
From: Ebersole, S. <ste...@vi...> - 2002-05-20 12:47:43
|
Any ideas? ******************************************** Steve Ebersole IT Integration Engineer Vignette Corporation 512.741.4195 Visit http://www.vignette.com ******************************************** -----Original Message----- From: Ebersole, Steven [mailto:ste...@vi...] Sent: Wednesday, May 08, 2002 7:09 AM To: 'Thomas Mahler'; obj...@li... Subject: RE: [ojb-users] references Below is the exception I get. I appears that the exception occurs when trying to resolve the reference to parent company when that fk column is null. If I remove that reference descriptor, everything works. Query from class com.vignette.it.apps.dbapi.domain.CompanyDO where comp_id= ? [DEFAULT] WARN: Please define a public constructor for class com.vignette.it.apps.dbapi.domain.CompanyDO with the following signature: (java.lang.Integer, java.lang.String, java.lang.Integer). It must initialize the classes persistent attributes. This is recommended to increase performance but it's not mandatory! [ojb.broker.singlevm.PersistenceBrokerImpl] ERROR: expected type: class com.vignette.it.apps.dbapi.domain.CompanyDO [ojb.broker.accesslayer.RsIterator] ERROR: null java.lang.ArrayIndexOutOfBoundsException at ojb.broker.metadata.ClassDescriptor.getFieldDescriptorByIndex(ClassDescripto r.java:263) at ojb.broker.metadata.ObjectReferenceDescriptor.getForeignKeyFieldDescriptors( ObjectReferenceDescriptor.java:242) at ojb.broker.metadata.ObjectReferenceDescriptor.getForeignKeyValues(ObjectRefe renceDescriptor.java:264) at ojb.broker.singlevm.PersistenceBrokerImpl.getReferencedObject(PersistenceBro kerImpl.java:700) at ojb.broker.singlevm.PersistenceBrokerImpl.retrieveReferences(PersistenceBrok erImpl.java:517) at ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(RsIterator.java:263 ) at ojb.broker.accesslayer.RsIterator.next(RsIterator.java:145) at ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBr okerImpl.java:900) at ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBr okerImpl.java:966) at ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBr okerImpl.java:1054) at ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBr okerImpl.java:1041) at TestOJBInstall.execute(TestOJBInstall.java:66) at TestOJBInstall.main(TestOJBInstall.java:53) java.util.NoSuchElementException at ojb.broker.accesslayer.RsIterator.next(RsIterator.java:154) at ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBr okerImpl.java:900) at ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBr okerImpl.java:966) at ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBr okerImpl.java:1054) at ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBr okerImpl.java:1041) at TestOJBInstall.execute(TestOJBInstall.java:66) at TestOJBInstall.main(TestOJBIError occurred : java.util.NoSuchElementException nstall.java:53) ******************************************** Steve Ebersole IT Integration Engineer Vignette Corporation 512.741.4195 Visit http://www.vignette.com ******************************************** -----Original Message----- From: Thomas Mahler [mailto:tho...@ho...] Sent: Friday, May 03, 2002 12:11 AM To: Ebersole, Steven Subject: Re: [ojb-users] references Hi Steven, Ebersole, Steven wrote: > I am looking at switching from Castor over to OJB as it looks really > promising in terms of its functionality (I especially love the use of > virtual proxies here). I did have two questions come up from my initial > trials of OJB. > > 1) Is it necessary to have both the foreign key and the foreign reference > mapped and present on the object? depends on the navigibility between your persistent classes. If you want to navigate from the 1-side to the n-side only, you just need a foreign key (and a ForeignKeyDescriptor). If you want navigation from the n-side to the 1-side too, you'll also need a reference attribute (and a ReferenceDecsriptor too). In the examples, the relation between > Article and ProductGroup is the example From which I was working. There, > Article has two attributes dealing with its relation to a ProductGroup, Yes, because we have navigation from ProductGroup to all its Articles and from an Article to its associated ProductGroup. > productGroupId (which is the DB fk field) and productGroup (which is an > instance of the ProductGroup object to which productGroupId referes). Is it > necessary to do this, or is there a way to have the Product object only know > about its related ProductGroup? No, because ProductGroup and Article have a 1:n relation the table representaing Article entities *must* have a foreign key to identify the associated ProductGroup. > > 2) I mapped a relationship, uing my classes, similiar to the above > relationship (it is a company -> parent company relationship). However, I > get exceptions if a particular company did not have a parent company (its > PRTN_COMP_ID column on the DB is NULL). Is there something additional I > have to set up in the mapping to define that side of the relationship as > optional? Below is the mapping I have for this: > > > <ClassDescriptor id="2"> > <class.name>com.vignette.it.apps.dbapi.domain.CompanyDO</class.name> > <table.name>COMPANY</table.name> > <FieldDescriptor id="1"> > <field.name>id</field.name> > <column.name>COMP_ID</column.name> > <jdbc_type>INTEGER</jdbc_type> > <PrimaryKey>true</PrimaryKey> > </FieldDescriptor> > ... > <FieldDescriptor id="5"> > <field.name>parentCompanyId</field.name> > <column.name>PRNT_COMP_ID</column.name> > <jdbc_type>INTEGER</jdbc_type> > </FieldDescriptor> > <ReferenceDescriptor id="1"> > <rdfield.name>parentCompany</rdfield.name> > > <referenced.class>com.vignette.it.apps.dbapi.domain.CompanyDO</referenced.cl > ass> > <fk_descriptor_ids>5</fk_descriptor_ids> > </ReferenceDescriptor> > </ClassDescriptor> > Your mapping seems OK. This must be an OJB bug! Can you provide me with a full stacktrace ? thanks, Thomas > > Thanks > > > > > ******************************************** > Steve Ebersole > IT Integration Engineer > Vignette Corporation > 512.741.4195 > > Visit http://www.vignette.com > > ******************************************** > > _______________________________________________________________ > > Have big pipes? SourceForge.net is looking for download mirrors. We supply > the hardware. You get the recognition. Email Us: ban...@so... > _______________________________________________ > Objectbridge-users mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-users > > > > _______________________________________________________________ Have big pipes? SourceForge.net is looking for download mirrors. We supply the hardware. You get the recognition. Email Us: ban...@so... _______________________________________________ Objectbridge-users mailing list Obj...@li... https://lists.sourceforge.net/lists/listinfo/objectbridge-users |
From: Graeme P. <gr...@Gr...> - 2002-05-19 09:59:01
|
Hi all, I'm using OJB 0.8.4 to do BMP in JBoss, but I keep getting "java.sql.SQLException: You cannot set autocommit during a managed transaction!". This happens inside my ejbCreate method when I try to do a store(). I've changed the OJB.properties to use the J2EE stuff (PersistenceBrokerClass and PersistenceBrokerFactoryClass), and I've also set the JNDI properties in that same file. There is nothing relating to transactions in my OJB code (no beginTransaction() calls, etc, etc). If I change the transaction attribute in my ejb-jar file from "Required" to "Supports" (no container transaction), everything works. I did see some stuff about ignoring auto commit problems in the source code, but I haven't managed to figure it out yet. I'm basically struggling to get OJB to use the JBoss transaction in an EJB method. Any help will be appreciated. Graeme |
From: Thomas M. <tho...@ho...> - 2002-05-17 13:48:16
|
Hi Scott, Weaver, Scott wrote: > A couple of quick multi-db questions. > > I have 2 class descriptors (A and B), each using a different jdbc > connection (different RDBMSes)... > > 1. Can I use a foreign-key relation from to A to B (or vice versa)? Yes, that's possible > From what I have read this appears to be possible since (I think) ojb > will use 2 independent JDBC calls, one to materialize A initially then > another to materialize B within A. exactly! > > 2. Can A and B, being in different RDBMSes, participate in the same > transaction? > Depends on the API you use: If you are using the ODMG API you can work against multiple databases, as the tx management is done on the ODMG level without any JDBC interference. If you are using the PersistenceBroker API you can use the PB methods beginTransaction() and commitTransaction(). They will properly handle the JDBC transactions against multiple databases. BUT: Both ways are currently not two phase commit safe. That is if one of the underlying JDBC transaction fails previously commited JDBC transactions are not rolled back! HTH, Thomas > > Thanks, > Scott > > |
From: Weaver, S. <Sw...@ri...> - 2002-05-17 13:22:38
|
A couple of quick multi-db questions. I have 2 class descriptors (A and B), each using a different jdbc connection (different RDBMSes)... 1. Can I use a foreign-key relation from to A to B (or vice versa)? From what I have read this appears to be possible since (I think) ojb will use 2 independent JDBC calls, one to materialize A initially then another to materialize B within A. 2. Can A and B, being in different RDBMSes, participate in the same transaction? Thanks, Scott |
From: Jiri L. <jir...@ho...> - 2002-05-17 11:56:08
|
Hi Thomas, > A commited object must be >removed from all caches in an OJB cluster so that other transaction >(possibly running in different JVMs on different physical machines) only >"see" valid data, that is data read in from the DB. Does this apply to all read objects or just to the objects that are modified during a transaction? Just make sure... Jiri. On Fri, 17 May 2002 12:32:42 +0200, you wrote: >Hi Paul, > > > > Hi, > > > > This may be a naive question and feel free to point me to 'the = manual', > > but I don't understand why the ODMG API flushes the object cache = during > > a commit. > > >Questions related to caching are never 'naive' ;-) >The cache is flashed for tx isolation reasons. A commited object must be >removed from all caches in an OJB cluster so that other transaction >(possibly running in different JVMs on different physical machines) only >"see" valid data, that is data read in from the DB. > >hth, > >Thomas > > > > > > Thanks in advance, > > > > Paul. > > Ascension Software Limited > > http://www.ascensionsoftware.com > > Tel: 01225 484494 > > [Logo] > > > > [Home] > > > > w w w . a s c e n s i o n s o f t w a r e . c o m > > > > > > >_______________________________________________________________ > >Have big pipes? SourceForge.net is looking for download mirrors. We = supply >the hardware. You get the recognition. Email Us: = ban...@so... >_______________________________________________ >Objectbridge-users mailing list >Obj...@li... >https://lists.sourceforge.net/lists/listinfo/objectbridge-users |
From: Jan A. <po...@ag...> - 2002-05-17 11:36:56
|
I think see things a bit more clear now - read some of the pages again and found some more :-) In a web setting, one way of making sure that no one updates a object that someone else is "reading" is to start the request handler with a tx.begin and then commit at the very end of the request handler? And say that I have a page that permits a user to update personal information. Then I would start a transaction, but it en the http session and commit on the next request but obtaining the transaction object from the session, updating the object in question and committing the transaction? Jan Agermose |
From: Thomas M. <tho...@ho...> - 2002-05-17 10:32:58
|
Hi Jan, Jan Agermose wrote: > I'm looking into taking our java programming to the "next level". When > implementing our model layer (as in MVC) we typically do something like: > class P { > public void setValues(ResultSet set) { > .. set variables from JDBC set > } > public void save() { > if (isnew) insert() else update(); > } > public void insert() { > .. JDBC insert stuff > } > public void update() { > .. JDBC update stuff > } > } > > class locateP { > public P getById(id) > public Collection getBySomeOther(Other) > ... lots of other ways to instantiate P > } > > This is a really simple way to do things > > 1. its simple and can be auto generated from the database schema - fast > development! > 2. using jdbcpool to optimize performance is simple > 3. SQL :-) > but > 1. no caching IMHO caching is not *always* a must. there are many scenarios where caching is rather a burden. > 2. two calls to a method in locateP will return to different instances > of the same object - due to no caching A cache is *one* way to solve this. But: The real thing you are looking for is transactional isolation accross threads (or even accross multiple VMs). OJB can help you here. > X. all the problems that arise because of 2. > > So will OJB help me out here? mostly web applications!! sure, lot's of people are running web-apps with OJB. > standalone mode: > > A: if I have one instance of the Database ??? > A1: I will have shared instances of objects because its one database > one cache > A2: but what about performance? I have a cache, yes, but still all > communication with the database is done using -one- connection. Is > that a problem? with OJB you work with multiple brokers. each broker holds its own connection. We don't have connection pooling, we have broker pooling. the OJB broker architecture is thread-safe. > > B: One Database object to each Thread or maybe even better one Database > per session are you talking about an org.odmg.Database? or what else do you mean by "one Database per sesion"? > B2: The performance should be better than A? > B1: but no shared instance of object? > > client/sever mode: > > C: is that any different than B? > yes, C/S mode is about running OJB in a cluster accross multiple JVMs. > Maybe all my troubles are due to my understanding of shared instances of > objects - > should I say object identity? yup ! > > DB --- server cache --- client A > --- client B > > if client A and B query the same Object instance P (having id = 10) they > will end up getting 20 instances due to serialization. How will OJB help > me getting A's committed data into B? > If you are using the OJB ODMG APi you have pessimistic locking that provides a full tx isolation even in client/server mode. > And if I make a query for instance P having id = 10 and then a query for > a collection of P's that all so contains P (id = 10) - will the to > instances of P (id=10) be the same object (in memory) meaning that an > update to one will be reflected in the other? this depends on the tx isolation level you choose. > > I know this is a lot to answer but I really need to understand this in > order to make a decision to go for OJB (or any other framework). > HTH, Thomas > Thanks in advance. > > Jan Agermose > > > > _______________________________________________________________ > > Have big pipes? SourceForge.net is looking for download mirrors. We supply > the hardware. You get the recognition. Email Us: ban...@so... > _______________________________________________ > Objectbridge-users mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-users > > > > |
From: Thomas M. <tho...@ho...> - 2002-05-17 10:32:49
|
Hi Jason, Jason McKerr wrote: > Can someone tell me the difference between these two methods. > Not entirely sure I understand from the JavaDocs. > > Looks like removeFromCache removes the object just from the broker being > used? hmmm.. right ! > > Invalidate removes all examples of the object? invalidate is used in the client/server mode, to inform other caches in the OJB cluster to remove this object too. This feature is needed for cache synchronization in a cluster only. hth, Thomas > > -Jason > > > > > _______________________________________________________________ > > Have big pipes? SourceForge.net is looking for download mirrors. We supply > the hardware. You get the recognition. Email Us: ban...@so... > _______________________________________________ > Objectbridge-users mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-users > > > > |
From: Thomas M. <tho...@ho...> - 2002-05-17 10:32:43
|
Hi Paul, > Hi, > > This may be a naive question and feel free to point me to 'the manual', > but I don't understand why the ODMG API flushes the object cache during > a commit. Questions related to caching are never 'naive' ;-) The cache is flashed for tx isolation reasons. A commited object must be removed from all caches in an OJB cluster so that other transaction (possibly running in different JVMs on different physical machines) only "see" valid data, that is data read in from the DB. hth, Thomas > > Thanks in advance, > > Paul. > Ascension Software Limited > http://www.ascensionsoftware.com > Tel: 01225 484494 > [Logo] > > [Home] > > w w w . a s c e n s i o n s o f t w a r e . c o m > |
From: Jan A. <po...@ag...> - 2002-05-17 08:27:47
|
I'm looking into taking our java programming to the "next level". When implementing our model layer (as in MVC) we typically do something like: class P { public void setValues(ResultSet set) { .. set variables from JDBC set } public void save() { if (isnew) insert() else update(); } public void insert() { .. JDBC insert stuff } public void update() { .. JDBC update stuff } } class locateP { public P getById(id) public Collection getBySomeOther(Other) ... lots of other ways to instantiate P } This is a really simple way to do things 1. its simple and can be auto generated from the database schema - fast development! 2. using jdbcpool to optimize performance is simple 3. SQL :-) but 1. no caching 2. two calls to a method in locateP will return to different instances of the same object - due to no caching X. all the problems that arise because of 2. So will OJB help me out here? mostly web applications!! standalone mode: A: if I have one instance of the Database A1: I will have shared instances of objects because its one database one cache A2: but what about performance? I have a cache, yes, but still all communication with the database is done using -one- connection. Is that a problem? B: One Database object to each Thread or maybe even better one Database per session B2: The performance should be better than A? B1: but no shared instance of object? client/sever mode: C: is that any different than B? Maybe all my troubles are due to my understanding of shared instances of objects - should I say object identity? DB --- server cache --- client A --- client B if client A and B query the same Object instance P (having id = 10) they will end up getting 20 instances due to serialization. How will OJB help me getting A's committed data into B? And if I make a query for instance P having id = 10 and then a query for a collection of P's that all so contains P (id = 10) - will the to instances of P (id=10) be the same object (in memory) meaning that an update to one will be reflected in the other? I know this is a lot to answer but I really need to understand this in order to make a decision to go for OJB (or any other framework). Thanks in advance. Jan Agermose |
From: Jason M. <mc...@na...> - 2002-05-16 17:58:46
|
Can someone tell me the difference between these two methods. Not entirely sure I understand from the JavaDocs. Looks like removeFromCache removes the object just from the broker being used? hmmm.. Invalidate removes all examples of the object? -Jason |
From: Paul W. <pa...@as...> - 2002-05-15 13:11:44
|
Hi, This may be a naive question and feel free to point me to 'the manual', = but I don't understand why the ODMG API flushes the object cache during = a commit. Thanks in advance, Paul. |
From: Phillip R. <rho...@te...> - 2002-05-14 03:26:09
|
I am currently using torque, but migrating my stuff to use objectbridge. One thing I liked about torque was it's sql generation from the xml mapping file. Has anyone started this work? I can help. |
From: Thomas M. <tho...@ho...> - 2002-05-12 20:25:33
|
Hi Jason, There is a bug in your repository. (see my remarks below) Jason McKerr wrote: > Sorry for the long message. If you don't feel like reading all this > crap, don't worry about it. Could use some help though. > > > I'm new to ORM stuff. > I set up a sample DB and classes. Everything works OK until I try > to use auto-retrieve for related columns in a related table. > As soon as I turn <auto.retrieve> to true, everything blows up. > > I've got two tables, DB_USERS and DB_USERS_ROLES > > The primary key in DB_USERS is username, which relates to the > username column in the DB_USERS_ROLES table. > > here's my repository.xml for these. I have defined the references > pretty much the same as in the Artikel and Category examples in the > distro. > > ------------------------------------------------------------------ > <!-- Definitions for org.nacse.data.UserRole --> > <ClassDescriptor id="1101"> > <class.name>org.nacse.data.user.UserRole</class.name> > <table.name>DB_USERS_ROLES</table.name> > <FieldDescriptor id="1"> > <field.name>userName</field.name> > <column.name>USERNAME</column.name> > <jdbc_type>VARCHAR</jdbc_type> > <PrimaryKey>true</PrimaryKey> > </FieldDescriptor> > <FieldDescriptor id="2"> > <field.name>roleName</field.name> > <column.name>ROLENAME</column.name> > <jdbc_type>VARCHAR</jdbc_type> > <PrimaryKey>true</PrimaryKey> > </FieldDescriptor> > <ReferenceDescriptor id="1"> > <rdfield.name>userName</rdfield.name> > <referenced.class>org.nacse.data.user.User</referenced.class> > <fk_descriptor_ids>1</fk_descriptor_ids> > <auto.retrieve>true</auto.retrieve> > <auto.update>false</auto.update> > <auto.delete>false</auto.delete> > </ReferenceDescriptor> This ReferenceDescriptor is buggy ! It says: there is an attribute userName of type org.nacse.data.user.User. But in FieldDescriptor 1 you say userName is a String (or char[]). Is there a reference-attribute of type User in class UserRole? If so use its name. If not, just drop this descriptor. If there is no navigability from UserRole to User, you won't need a ReferenceDescriptor. HTH, Thomas > </ClassDescriptor> > <!-- Definitions for org.nacse.data.User --> > <ClassDescriptor id="1102"> > <class.name>org.nacse.data.user.User</class.name> > <table.name>DB_USERS</table.name> > <FieldDescriptor id="1"> > <field.name>userName</field.name> > <column.name>USERNAME</column.name> > <jdbc_type>VARCHAR</jdbc_type> > <PrimaryKey>true</PrimaryKey> > </FieldDescriptor> > <FieldDescriptor id="2"> > <field.name>password</field.name> > <column.name>PASSWORD</column.name> > <jdbc_type>VARCHAR</jdbc_type> > </FieldDescriptor> > <FieldDescriptor id="3"> > <field.name>firstName</field.name> > <column.name>FIRSTNAME</column.name> > <jdbc_type>VARCHAR</jdbc_type> > </FieldDescriptor> > <FieldDescriptor id="4"> > <field.name>lastName</field.name> > <column.name>LASTNAME</column.name> > <jdbc_type>VARCHAR</jdbc_type> > </FieldDescriptor> > <FieldDescriptor id="5"> > <field.name>organization</field.name> > <column.name>ORGANIZATION</column.name> > <jdbc_type>VARCHAR</jdbc_type> > </FieldDescriptor> > <CollectionDescriptor id="1"> > <cdfield.name>roles</cdfield.name> > <items.class>org.nacse.data.user.UserRole</items.class> > <inverse_fk_descriptor_ids>1</inverse_fk_descriptor_ids> > <auto.retrieve>true</auto.retrieve> > <auto.update>true</auto.update> > <auto.delete>false</auto.delete> > <orderby sort="DESC">rolename</orderby> > </CollectionDescriptor> > </ClassDescriptor> > ----------------------------------------------------------------- > > Then I have my User class > > > ----------------------------------------------------------------- > public class User extends DataObjectBroker implements Serializable { > > static Logger log = Logger.getLogger(User.class); > > private String userName; > private String password; > private String firstName; > private String lastName; > private String organization; > private List roles; > > public User() { > } > public User(String inUserName, > String inPassword, > String inFirstName, > String inLastName, > String inOrganization) { > this.userName = inUserName; > this.password = inPassword; > this.firstName = inFirstName; > this.lastName = inLastName; > this.organization = inOrganization; > } > public synchronized void add(UserRole ur) { > if (roles == null) { > roles = new Vector(); > } > roles.add(ur); > } > public String getUserName() { > return userName; > } > public void setUserName(String inUserName) { > userName = inUserName; > } > public String getPassword() { > return password; > } > public void setPassword(String inPassword) { > password = inPassword; > } > public String getFirstName() { > return firstName; > } > public void setFirstName(String inFirstName) { > firstName = inFirstName; > } > public String getLastName() { > return lastName; > } > public void setLastName(String inLastName) { > lastName = inLastName; > } > public String getOrganization() { > return lastName; > } > public void setOrganization(String inOrganization) { > organization = inOrganization; > } > public List getRoles() { > return roles; > } > public void setRoles(List inRoles) { > roles = inRoles; > } > > public List listAllUsers() { > Query query = new QueryByCriteria(User.class, null); > try { > List allUsers = (List)broker.getCollectionByQuery(query); > return allUsers; > } > catch (Exception e) { > log.error("Exception in listAllRoles(): " + e); > e.printStackTrace(); > } > return null; > } > } > ------------------------------------------------------------------ > > When I run the listAllUsers() method without autoretrieve, ok. > If I turn it on, then I get the following. This appears to be > introspection of some kind, but I'm not sure what is going on. > Why is the system getting User, when it wants String? > Is this happening in the UserRole class? or in the User class? > How do I figure that out? > > [DEFAULT] ERROR: field: userName, type: class java.lang.String > [DEFAULT] ERROR: value: org.nacse.data.user.User@347124, type: class > org.nacse.data.user.User > [ojb.broker.singlevm.PersistenceBrokerImpl] ERROR: expected type: class > java.lang.String > [ojb.broker.singlevm.PersistenceBrokerImpl] DEBUG: getObjectByIdentity > org.nacse.data.user.User{mckerrj} > [ojb.broker.singlevm.PersistenceBrokerImpl] ERROR: actual type: class > org.nacse.data.user.User > [ojb.broker.singlevm.PersistenceBrokerImpl] ERROR: field type mismatch > > > > Any help would be greatly appreciated. Thanks! > > -Jason > > > > > > > > > > > > > > > > > > > _______________________________________________________________ > > Have big pipes? SourceForge.net is looking for download mirrors. We supply > the hardware. You get the recognition. Email Us: ban...@so... > _______________________________________________ > Objectbridge-users mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-users > > > > |
From: Thomas M. <tho...@ho...> - 2002-05-12 08:22:14
|
Hi Arvind, Arvind Gudipati wrote: > Hi all, > I have to say this is a great software. > I have worked with toplink, coco-base a few yeras back and have been > using castor recently.. i have to admit that for my new project > initiative im planning to use OJB (rather than castor and others). > thanks ! > However my only concern is that, there does not seem to be lots of > talk/activity about OJB? im assuming that not a lot of people use this > product unlike castor which seems to be quite popular. > We were busy developing a good product. So we had no time to spread the news ... but as OJB has been accepted as a jakarta project, you will see much OJB related hyping in the near future ;-) cheers, Thomas > > Arvind > ***************************************************************************************** > 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: Thomas M. <tho...@ho...> - 2002-05-12 08:22:06
|
Hi Jason, please have a look at the repository.dtd. you will see that it is possible to have a JdbcConnectionDescriptor element as the first element of a ClassDescriptor element. Of course its possible to use JNDI datasources. There is an example for a JNDI datasource JDBCConnectionDescriptor in the repository.xml file. HTH, Thomas Jason McKerr wrote: > Anyone know how I can use a different JDBC Connection than the one > defined in repository.xml? Repository.xml says, if a Class does not > specifiy it's own connection then it uses default. > > How do I specify connection in the class? Traditional JDBC/JNDI? If > so, then how do I usethe broker interface in conjunction with that? > > > Thanks, > > Newt > > > > > _______________________________________________________________ > > Have big pipes? SourceForge.net is looking for download mirrors. We supply > the hardware. You get the recognition. Email Us: ban...@so... > _______________________________________________ > Objectbridge-users mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-users > > > > |
From: Arvind G. <Arv...@PA...> - 2002-05-10 20:00:10
|
Hi all, I have to say this is a great software. I have worked with toplink, coco-base a few yeras back and have been using castor recently.. i have to admit that for my new project initiative im planning to use OJB (rather than castor and others). However my only concern is that, there does not seem to be lots of talk/activity about OJB? im assuming that not a lot of people use this product unlike castor which seems to be quite popular. Arvind **************************************************************************** ************* 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: Jason M. <mc...@na...> - 2002-05-10 17:14:53
|
Sorry for the long message. If you don't feel like reading all this crap, don't worry about it. Could use some help though. I'm new to ORM stuff. I set up a sample DB and classes. Everything works OK until I try to use auto-retrieve for related columns in a related table. As soon as I turn <auto.retrieve> to true, everything blows up. I've got two tables, DB_USERS and DB_USERS_ROLES The primary key in DB_USERS is username, which relates to the username column in the DB_USERS_ROLES table. here's my repository.xml for these. I have defined the references pretty much the same as in the Artikel and Category examples in the distro. ------------------------------------------------------------------ <!-- Definitions for org.nacse.data.UserRole --> <ClassDescriptor id="1101"> <class.name>org.nacse.data.user.UserRole</class.name> <table.name>DB_USERS_ROLES</table.name> <FieldDescriptor id="1"> <field.name>userName</field.name> <column.name>USERNAME</column.name> <jdbc_type>VARCHAR</jdbc_type> <PrimaryKey>true</PrimaryKey> </FieldDescriptor> <FieldDescriptor id="2"> <field.name>roleName</field.name> <column.name>ROLENAME</column.name> <jdbc_type>VARCHAR</jdbc_type> <PrimaryKey>true</PrimaryKey> </FieldDescriptor> <ReferenceDescriptor id="1"> <rdfield.name>userName</rdfield.name> <referenced.class>org.nacse.data.user.User</referenced.class> <fk_descriptor_ids>1</fk_descriptor_ids> <auto.retrieve>true</auto.retrieve> <auto.update>false</auto.update> <auto.delete>false</auto.delete> </ReferenceDescriptor> </ClassDescriptor> <!-- Definitions for org.nacse.data.User --> <ClassDescriptor id="1102"> <class.name>org.nacse.data.user.User</class.name> <table.name>DB_USERS</table.name> <FieldDescriptor id="1"> <field.name>userName</field.name> <column.name>USERNAME</column.name> <jdbc_type>VARCHAR</jdbc_type> <PrimaryKey>true</PrimaryKey> </FieldDescriptor> <FieldDescriptor id="2"> <field.name>password</field.name> <column.name>PASSWORD</column.name> <jdbc_type>VARCHAR</jdbc_type> </FieldDescriptor> <FieldDescriptor id="3"> <field.name>firstName</field.name> <column.name>FIRSTNAME</column.name> <jdbc_type>VARCHAR</jdbc_type> </FieldDescriptor> <FieldDescriptor id="4"> <field.name>lastName</field.name> <column.name>LASTNAME</column.name> <jdbc_type>VARCHAR</jdbc_type> </FieldDescriptor> <FieldDescriptor id="5"> <field.name>organization</field.name> <column.name>ORGANIZATION</column.name> <jdbc_type>VARCHAR</jdbc_type> </FieldDescriptor> <CollectionDescriptor id="1"> <cdfield.name>roles</cdfield.name> <items.class>org.nacse.data.user.UserRole</items.class> <inverse_fk_descriptor_ids>1</inverse_fk_descriptor_ids> <auto.retrieve>true</auto.retrieve> <auto.update>true</auto.update> <auto.delete>false</auto.delete> <orderby sort="DESC">rolename</orderby> </CollectionDescriptor> </ClassDescriptor> ----------------------------------------------------------------- Then I have my User class ----------------------------------------------------------------- public class User extends DataObjectBroker implements Serializable { static Logger log = Logger.getLogger(User.class); private String userName; private String password; private String firstName; private String lastName; private String organization; private List roles; public User() { } public User(String inUserName, String inPassword, String inFirstName, String inLastName, String inOrganization) { this.userName = inUserName; this.password = inPassword; this.firstName = inFirstName; this.lastName = inLastName; this.organization = inOrganization; } public synchronized void add(UserRole ur) { if (roles == null) { roles = new Vector(); } roles.add(ur); } public String getUserName() { return userName; } public void setUserName(String inUserName) { userName = inUserName; } public String getPassword() { return password; } public void setPassword(String inPassword) { password = inPassword; } public String getFirstName() { return firstName; } public void setFirstName(String inFirstName) { firstName = inFirstName; } public String getLastName() { return lastName; } public void setLastName(String inLastName) { lastName = inLastName; } public String getOrganization() { return lastName; } public void setOrganization(String inOrganization) { organization = inOrganization; } public List getRoles() { return roles; } public void setRoles(List inRoles) { roles = inRoles; } public List listAllUsers() { Query query = new QueryByCriteria(User.class, null); try { List allUsers = (List)broker.getCollectionByQuery(query); return allUsers; } catch (Exception e) { log.error("Exception in listAllRoles(): " + e); e.printStackTrace(); } return null; } } ------------------------------------------------------------------ When I run the listAllUsers() method without autoretrieve, ok. If I turn it on, then I get the following. This appears to be introspection of some kind, but I'm not sure what is going on. Why is the system getting User, when it wants String? Is this happening in the UserRole class? or in the User class? How do I figure that out? [DEFAULT] ERROR: field: userName, type: class java.lang.String [DEFAULT] ERROR: value: org.nacse.data.user.User@347124, type: class org.nacse.data.user.User [ojb.broker.singlevm.PersistenceBrokerImpl] ERROR: expected type: class java.lang.String [ojb.broker.singlevm.PersistenceBrokerImpl] DEBUG: getObjectByIdentity org.nacse.data.user.User{mckerrj} [ojb.broker.singlevm.PersistenceBrokerImpl] ERROR: actual type: class org.nacse.data.user.User [ojb.broker.singlevm.PersistenceBrokerImpl] ERROR: field type mismatch Any help would be greatly appreciated. Thanks! -Jason |
From: David R. <cas...@fr...> - 2002-05-09 18:21:58
|
hi jakob the sql generated is correct , i really don't understand i'm using MySQL 3.23 (ojb automatically switches to default ) may that be an issue ? i wanted to try the cvs version but i feel a little confused by the cvs tree this is what the website says : cvs -d :pserver:ano...@cv...:/cvsroot/objectbridge login cvs -z3 -d :pserver:ano...@cv...:/cvsroot/objectbridge co modulename ok, what module do i checkout ? i don't see tags on the cvs tree... how can i compare the cvs version to the one i downloaded from the download page ? thank for your help David ----- Original Message ----- From: "Jakob Braeuchi" <jbr...@ho...> To: "David Rault" <cas...@fr...>; <obj...@li...> Sent: Thursday, May 09, 2002 7:17 PM Subject: Re: [ojb-users] OQL and order by clauses > hi david, > > i cannot reproduce this error. the following sample code produced a list of > persons sorted by id descending: > > crit = new Criteria(); > crit.addOrderBy("id",false); > query = new QueryByCriteria(Person.class, crit); > broker.getCollectionByQuery(query); > > please set the loglevel for SqlGenerator to DEBUG to see the generated SQL. > modify the following line in OJB.properties: > > # Loger for SqlGenerator, useful for debugging generation of SQL > ojb.broker.accesslayer.SqlGenerator.LogLevel=DEBUG > > i'm working with the current stuff from cvs. > > hth > jakob > |
From: Jakob B. <jbr...@ho...> - 2002-05-09 17:12:53
|
hi david, i cannot reproduce this error. the following sample code produced a list of persons sorted by id descending: crit = new Criteria(); crit.addOrderBy("id",false); query = new QueryByCriteria(Person.class, crit); broker.getCollectionByQuery(query); please set the loglevel for SqlGenerator to DEBUG to see the generated SQL. modify the following line in OJB.properties: # Loger for SqlGenerator, useful for debugging generation of SQL ojb.broker.accesslayer.SqlGenerator.LogLevel=DEBUG i'm working with the current stuff from cvs. hth jakob ----- Original Message ----- From: "David Rault" <cas...@fr...> To: <obj...@li...> Sent: Thursday, May 09, 2002 5:15 PM Subject: [ojb-users] OQL and order by clauses > hi all > i'm new to ObjectBridge but it seems quite an impressive piece of work! > i just met some confusing behaviour so i'm asking to see if it's because i > missed something : > > i'm trying to add an 'order by' clause to my request but the result never > gets ordered > i tried both persistentBroker layer and ODMG layer they both behave in the > same way > > here is what i wrote : > PersistenceBroker pb = > PersistenceBrokerFactory.createPersistenceBroker("repository.xml"); > Criteria criteria = new Criteria(); > criteria.addOrderBy("id", false); > Query query = new QueryByCriteria(test.DVDObject.class, criteria); > java.util.Iterator iter = pb.getCollectionByQuery(query).iterator(); > while (iter.hasNext()) { > System.out.println(iter.next()); > } > > and i get this on the standard output (the 'id' is the value between > parenthesis) : > test.DVDObjectImpl (68)[Superman II] > test.DVDObjectImpl (36)[Men in Black] > test.DVDObjectImpl (48)[Ninja Scroll] > test.DVDObjectImpl (16)[Cybersix - vol. 1] > test.DVDObjectImpl (28)[Evil Cult] > test.DVDObjectImpl (102)[Ghost in the Shell] > test.DVDObjectImpl (9)[Anastasia] > > not really sorted > > so what am i doing wrong ?? > i'm using v0.8.400 with sun jdk1.4 > > thank you for your help > > David > > > > _______________________________________________________________ > > Have big pipes? SourceForge.net is looking for download mirrors. We supply > the hardware. You get the recognition. Email Us: ban...@so... > _______________________________________________ > Objectbridge-users mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-users > |