Re: Tomcat 5.5.9 and OJB?
I thought I would not need or even want the commons dbcp because of this speicific link: http://www.mail-archive.com/tomcat-user@jakarta.apache.org/msg150576.html In short it says below: - the JNDI resource configuration has changed in 5.5. Check out the docs for an example: http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html. Also Tomcat 5.5 has changed the commons-dbcp-x.x.x.jar to naming-factory-dbcp.jar. And the org.apache.commons.dbcp.BasicDataSource is now moved to org.apache.tomcat.dbcp.dbcp.BasicDataSource. - Trying what you said, however, worked. The writeup above confused me though as to what I would need. Thanks for helping me and everybody else out Martin and others. JohnE - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat 5.5.9 and OJB?
I belive some of this stuff was changed for them in 5.5 and the dbcp part is called: naming-factory-dbcp.jar I am not using another dbcp library. JohnE - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat 5.5.9 and OJB?
Hey all, When I run OJB 1.0.3 with Tomcat 4.1.30 everything works. When I upgrade to Tomcat 5.5.9 I am getting the exception at the bottom of the file. Any ideas why this might be happening? Ideas on how to fix it? In general I am trying to upgrade my libraries because I am having problems with Tomcat 4.1.30 stabilty for some reason. It goes down without error and is being very hard to diagnose. There are changes in Tomcat 5.5.9 that makes me think the problem might go away. Let me know if there is any further information I can provide. JohnE ERROR [main] [/].listenerStart() - Exception sending context initialized event to listener instance of class com.jb.manager.jbContextListener java.lang.NoClassDefFoundError: org/apache/commons/dbcp/AbandonedConfig at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:1647) at java.lang.Class.getDeclaredMethod(Class.java:1254) at java.io.ObjectStreamClass.getPrivateMethod(ObjectStreamClass.java:1246) at java.io.ObjectStreamClass.access$1500(ObjectStreamClass.java:47) at java.io.ObjectStreamClass$3.run(ObjectStreamClass.java:348) at java.security.AccessController.doPrivileged(Native Method) at java.io.ObjectStreamClass.(ObjectStreamClass.java:333) at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:253) at java.io.ObjectStreamClass.(ObjectStreamClass.java:329) at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:253) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1010) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278) at java.util.ArrayList.writeObject(ArrayList.java:529) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:809) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1296) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278) at org.apache.commons.lang.SerializationUtils.serialize(SerializationUtils.java:145) at org.apache.commons.lang.SerializationUtils.serialize(SerializationUtils.java:170) at org.apache.commons.lang.SerializationUtils.clone(SerializationUtils.java:117) at org.apache.ojb.broker.metadata.ConnectionRepository.getAllDescriptor(Unknown Source) at org.apache.ojb.broker.metadata.MetadataManager.buildDefaultKey(Unknown Source) at org.apache.ojb.broker.metadata.MetadataManager.init(Unknown Source) at org.apache.ojb.broker.metadata.MetadataManager.(Unknown Source) at org.apache.ojb.broker.metadata.MetadataManager.getInstance(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.getDefaultKey(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersistenceBroker(Unknown Source) at org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(Unknown Source) at com.sp.model.common.ServiceLocator.getBroker(ServiceLocator.java:74) at com.jb.model.services.Jp.popularity.dao.JpPopularityDAO.getCountriesWithJps(JpPopularityDAO.java:183) at com.jb.model.services.Jp.popularity.JpPopularityManagerBD.getCountriesWithJps(JpPopularityManagerBD.java:138) at com.jb.model.services.Jp.popularity.JpPopOrganizer.initializePopCounts(JpPopOrganizer.java:157) at com.jb.model.services.Jp.popularity.JpPopOrganizer.initialize(JpPopOrganizer.java:77) at com.jb.model.services.Jp.popularity.JpPopularityManagerBD.initialize(JpPopularityManagerBD.java:59) at com.jb.model.services.Jp.manager.JpContextManagerBD.initializeService(JpContextManagerBD.java:57) at com.jb.manager.jbContextListener.contextInitialized(jbContextListener.java:89) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3669) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4104) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759) a
Re: Cache clearing question
Well I have my answer, but I don't like it I think. If I also null out the region record in the parent object associated with the region id when the regionId becomes null, things work. The regions are not removed from cache. I am still all that knowledgable about object relational bridges, but I don't think I like this behavior. If I mark the object as always stay in cache and have the attribute on delete to be "none" that not only should the record not be deleted from the database, but it should also not be deleted from cache...even if I null out a referring id. Of course I could also be doing something wrong. JohnE - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cache clearing question
I think I am understanding a bit better what is happening, but not sure if it should be or how I can prevent it. I have the following parent object (in brief) to the region object that is getting removed from cache: With the objects materialized with a countryId, regionId, and localId all with values, when the parent object gets updated with the regionId nulled out the former region seems to be being taken out of cache even though I asked for it not to be as shown in the first email and the delete attribute is set to "none". The regions are not getting deleted from the database so when I restart the server the lists are ok again. How do I prevent the countries, regions, etc from not being able to be removed from cache to stop this problem from happening? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Cache clearing question
Hey all, I have not been able to find my answer in he archives and wanted to ask how this might be handled. I am using PB with 1.0.2. I want certain records (countries/regions) never to be allowed to leave cache once they are in memory. To have this happen I used the following: The country/region records are used in many different places. What I think I am seeing is when a person updates their record and I use: pb.removeFromCache(serviceRecord); The region being used here is from other lists seem to get nulled out when serviceRecord is cleared from cache even though I have set: auto-retrieve="true" auto-update="none" auto-delete="none" Any ideas? I am still trying to figure out why I am seeing happen what I am seeing. JohnE - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: NULL is ok problem.
Thank you Armin. I am thinking about what you said. I kinda figured what you said was happening, but didn't know a best way around it. Thank you for the options. I think in the end I might have to choose the first solution, but not sure yet. I follow you guys on the dev list and can't wait to play with 1.0.2 potentially this weekend. It is a lot of good creative work and I am trying to learn about OJB internals through the discussions you go through there. Cheers. JohnE - Original Message - From: Armin Waibel <[EMAIL PROTECTED]> Date: Saturday, March 12, 2005 6:00 pm Subject: Re: NULL is ok problem. > Hi, > > the problem is that FK 'countryid' is used for Region and Country. > If > OJB doesn't find a Region on update of the main object and auto- > update > set to 'link' it nullify all FK fields of Region (regionid, > countryid) > in the main object. > > - Set auto-update/auto-delete to 'none' in reference-descriptor > "region". In this case you have insert/update/delete Region > objects "by > hand" - "link by hand". > http://db.apache.org/ojb/docu/guides/basic- > technique.html#Link+references > - Use different countryid FK fields -> countryid, countryRegionId. > You > can declare the new 1:1 FK field 'countryRegionId' as anonymous, > then > you don't have to change your persistent object class (but you > need > another column in main object table) > > - Avoid the composed PK in Region and make a single PK > > regards, > Armin > > [EMAIL PROTECTED] wrote: > > I have a pretty large system running OJB which works well, but > now I am trying to internationalize it. I have a problem. > > > > country->region->local is the new general object mapping. > > > > Previously in our last release we just had US and the states, > but now the mapping doesn't seem to work. > > > > The problem is for many countries, there are no regions. When I > go to update/insert a record without a region, it is now nulling > out the country. I believe this is because OJB requires the > region to be non-null. I do resolve references before the update, > but where regionId is null there can be no region object. > > > > Right now the mapping looks as follow. I don't map local yet as > there is no need yet. I would be interested in knowing if this > is possible if region is null as well. > > > > I believe what I need is that "NULL" be ok for a key. I need > some guidance on what I can do. > > > > > > > > Here are the pertinent fields: > > > > - > > ... lots of other fields > > > > > name="countryId" > > column="countryid" > > jdbc-type="CHAR" > > /> > > > name="regionId" > > column="regionid" > > jdbc-type="CHAR" > > /> > > > name="localId" > > column="localid" > > jdbc-type="CHAR" > > /> > > > > > name="country" > > class-ref="com.jb.sp.model.places.CountryVO" > > auto-retrieve="true" > > auto-update="link" > > auto-delete="none" > > proxy="false"> > > > > > > > > > name="region" > > class-ref="com.jb.sp.model.places.RegionVO" > > auto-retrieve="true" > > auto-update="link" > > auto-delete="none" > > proxy="false"> > > > > > > > > > > - > > > > table="country">> column="CountryCode" jdbc-type="CHAR" primarykey="true"/> > > type="VARCHAR"/>> > > > > > > table="region">> column="SUCountry" jdbc-type="CHAR" primarykey="true"/> > > type="CHAR" primarykey="true"/> > > > > > > > > > > > > > > > > - > > > 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]
NULL is ok problem.
I have a pretty large system running OJB which works well, but now I am trying to internationalize it. I have a problem. country->region->local is the new general object mapping. Previously in our last release we just had US and the states, but now the mapping doesn't seem to work. The problem is for many countries, there are no regions. When I go to update/insert a record without a region, it is now nulling out the country. I believe this is because OJB requires the region to be non-null. I do resolve references before the update, but where regionId is null there can be no region object. Right now the mapping looks as follow. I don't map local yet as there is no need yet. I would be interested in knowing if this is possible if region is null as well. I believe what I need is that "NULL" be ok for a key. I need some guidance on what I can do. Here are the pertinent fields: - ... lots of other fields - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HAVING BY? question about how to form a PB query
Thank you. Not sure how I missed that one. I will look into how to implement it right now. Thanks Carlos. JohnE - Original Message - From: Carlos Chávez <[EMAIL PROTECTED]> Date: Thursday, February 3, 2005 9:58 am Subject: Re: HAVING BY? question about how to form a PB query > > [EMAIL PROTECTED] Escribio :-) > > > > I am trying to implement this query using the PB: > > > > SELECT regionid AS r, COUNT(regionid) AS r_cnt > > FROM jps1 > > WHERE (countryid="US") > > GROUP BY regionid > > HAVING (r_cnt > 1); > > > > Hi JohnE, > > Well, We can specify a HAVING criteria in a ReportQueryByCriteria. > for example: > > ... > ReportQueryByCriteria query = new ReportQueryByCriteria(...); > ... > query.setHavingCriteria(specify the criteria); > ... > ... > > > Cheers. > Carlos Chávez. > > > In general I am trying to get list of regions and the number of > regions by > > country. > > > > It wuold be good to be able to associate the regionId to another > table> which has the name, but I can deal with that myself. > > > > I have some experience with OJB, but I am not seeing how to do this > > without using a query by sql. I would prefer not to do that. Any > > ideas? > > > > Thanks for any help. > > > > JohnE > > > > > > > > - > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > -- > Carlos Chávez > > --- > -- > 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]
HAVING BY? question about how to form a PB query
I am trying to implement this query using the PB: SELECT regionid AS r, COUNT(regionid) AS r_cnt FROM jps1 WHERE (countryid="US") GROUP BY regionid HAVING (r_cnt > 1); In general I am trying to get list of regions and the number of regions by country. It wuold be good to be able to associate the regionId to another table which has the name, but I can deal with that myself. I have some experience with OJB, but I am not seeing how to do this without using a query by sql. I would prefer not to do that. Any ideas? Thanks for any help. JohnE - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Unique query without using primary key?
I wanted to say thank you Danilo. With your tip and a hunk of code from the Lucene project, I was able to significantly enhance searching capabilities on my site. I need to get a bit more understanding of how efficient memory wise a RowReader is. I am dealing with large data sets where people are all searching at the same times, so memory requirements could get high. This is why i was just trying to get a distinct selection of service keys. I am still thinking about the use of anonymous keys. Right now whenever a person updates their record, the search criteria has to be deleted and re-put back into the database. At some point (not anytime vaguely soon) I am going to run out of room for the primary key and I would then have to reindex the search table. This seems useless since I don't even want the primary key. I just need to be able to do the 1:N matching. I am concerned about what was said about anonymous keys not working in clustered environment. I need to really understand this better. Thanks again!!! It works!!! JohnE - Original Message - From: Danilo Tommasina <[EMAIL PROTECTED]> Date: Tuesday, November 23, 2004 4:44 am Subject: Re: Unique query without using primary key? > A ReportQueryByCriteria should do the job: > > something like this: > > Criteria crit = new Criteria(); > crit.addLike( "state", "somestate" ); > crit.addLike( ".searchword", "somesearchword" ); > > ReportQueryByCriteria query = new ReportQueryByCriteria( > SearchKeys.class, new String [] { "sid" }, crit, true ); > > PersistenceBroker pb = null; > try { > pb = PersistenceBrokerFactory.defaultPersistenceBroker(); > > ArrayList results = new ArrayList(); > for ( Iterator resultsIt = pb.getReportQueryIteratorByQuery( > query ); resultsIt.hasNext(); ) { > results.add( ((Object []) resultsIt.next())[ 0 ] ); > } > > // The results ArrayList now contains all the ids you need > // Note: always extact the values from the Iterator before > closing the broker. > > } catch ( Exception e ) { > // Do exception handling > } finally { > if ( pb != null ) { > pb.close(); > } > } > > Replace with the reference path defined in > your repository.xml > I didn't tested the code, so there are probably syntax errors... > > > > I am not getting this. I need a nudge in the right direction. > > > > I want to do this query: > > select distinct sk.sid from searchkeys sk, searchwords sw > >where sw.searchword="somesearchword" > > sw.sid = sk.sid > > sk.state="somestate"; > > > > table searchkeys: > > sid <-- unique PK > > state > > > > table searchwords: > > swid <-- unique PK I wish OJB > didn't require > > sid <-- sid in searchkey table > > searchword > > > > searchkeys and searchwords having a 1:n relationship. > > > > > > Right now I both tables mapped according to their > characteristics which I have done many times before. In the past > I have always wanted the primary keys and full records. > > > > Here I don't want the full records or mapping, but just a > collection of the unique sid. I would prefer not to get the full > records and I only require this for read and not write. Imagine > I am doing a keyword search and I just want to know which services > match the search criteria. > > > > Can anybody nudge me in the right direction? Would be great to > get past this problem. I am trying to inprove the searching on my > live OJB used site by including parts of the Lucene project, but > need to be able to do this for it to work. > > > > Thanks lots. > > > > > > > > > > > > - > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > --- > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RE: Unique query without using primary key?
I think likely because I was doing a searchword elsewhere and often searches are matching. In reality I would need an equals there on that query part. Also about anonymous keys... In the end I think the site I have created could be massive and the data may have to be on multiple machines. Clustering later might be an issue, but I am not there yet. I take it that anonymous keys fail on clusters? I will do looking into that as well on the boards here. I was not happy with what i had as options before and the rowreader idea has me really psyched because it is so much more memory efficient then what I was attempting to create. If you end up pulling 5000, records frequently, that gets impotant. - Original Message - From: "Stark, Roman" <[EMAIL PROTECTED]> Date: Tuesday, November 23, 2004 4:15 pm Subject: RE: Unique query without using primary key? > I am still new to OJB and I was just wondering why in the suggestion > code below you chose > > crit.addLike( "state", "somestate" ); > > Rather than something like > > Crit.addEqualTo("state", "somestate"); > > Or even > > Crit.addColumnEqualTo("state", "somestate"); > > Sorry if this is a stupid question, but I just was wondering why? > > Roman > > > > -Original Message- > From: Danilo Tommasina [EMAIL PROTECTED] > Sent: Tuesday, November 23, 2004 04:44 > To: OJB Users List > Subject: Re: Unique query without using primary key? > > A ReportQueryByCriteria should do the job: > > something like this: > > Criteria crit = new Criteria(); > crit.addLike( "state", "somestate" ); > crit.addLike( ".searchword", "somesearchword" ); > > ReportQueryByCriteria query = new ReportQueryByCriteria( > SearchKeys.class, new String [] { "sid" }, crit, true ); > > PersistenceBroker pb = null; > try { > pb = PersistenceBrokerFactory.defaultPersistenceBroker(); > > ArrayList results = new ArrayList(); > for ( Iterator resultsIt = pb.getReportQueryIteratorByQuery( > query ); > resultsIt.hasNext(); ) { > results.add( ((Object []) resultsIt.next())[ 0 ] ); > } > > // The results ArrayList now contains all the ids you need > // Note: always extact the values from the Iterator before closing > the broker. > > } catch ( Exception e ) { > // Do exception handling > } finally { > if ( pb != null ) { > pb.close(); > } > } > > Replace with the reference path defined in your > repository.xml I didn't tested the code, so there are probably syntax > errors... > > > > I am not getting this. I need a nudge in the right direction. > > > > I want to do this query: > > select distinct sk.sid from searchkeys sk, searchwords sw > >where sw.searchword="somesearchword" > > sw.sid = sk.sid > > sk.state="somestate"; > > > > table searchkeys: > > sid <-- unique PK > > state > > > > table searchwords: > > swid <-- unique PK I wish OJB didn't > require > > sid <-- sid in searchkey table > > searchword > > > > searchkeys and searchwords having a 1:n relationship. > > > > > > Right now I both tables mapped according to their characteristics > which I have done many times before. In the past I have always wanted > the primary keys and full records. > > > > Here I don't want the full records or mapping, but just a collection > of the unique sid. I would prefer not to get the full records and I > only require this for read and not write. Imagine I am doing a > keywordsearch and I just want to know which services match the > search criteria. > > > > Can anybody nudge me in the right direction? Would be great to get > past this problem. I am trying to inprove the searching on my > live OJB > used site by including parts of the Lucene project, but need to be > ableto do this for it to work. > > > > Thanks lots. > > > > > > > > > > > > - > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > --- > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > --- > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Unique query without using primary key?
Thank you so much. I have done lots of crazy queries, but have not done one where I was not wanting a primary key in the result. I have some learning to do as to which is better way to handle this. I have to look up both rowreaders and anonymous keys. I would prefer if the searchword table didn't even have a primary key, but just an indexed sidsince search words will be added and deleted all the time. Thanks for the great nudge, JohnE - Original Message - From: Danilo Tommasina <[EMAIL PROTECTED]> Date: Tuesday, November 23, 2004 4:44 am Subject: Re: Unique query without using primary key? > A ReportQueryByCriteria should do the job: > > something like this: > > Criteria crit = new Criteria(); > crit.addLike( "state", "somestate" ); > crit.addLike( ".searchword", "somesearchword" ); > > ReportQueryByCriteria query = new ReportQueryByCriteria( > SearchKeys.class, new String [] { "sid" }, crit, true ); > > PersistenceBroker pb = null; > try { > pb = PersistenceBrokerFactory.defaultPersistenceBroker(); > > ArrayList results = new ArrayList(); > for ( Iterator resultsIt = pb.getReportQueryIteratorByQuery( > query ); resultsIt.hasNext(); ) { > results.add( ((Object []) resultsIt.next())[ 0 ] ); > } > > // The results ArrayList now contains all the ids you need > // Note: always extact the values from the Iterator before > closing the broker. > > } catch ( Exception e ) { > // Do exception handling > } finally { > if ( pb != null ) { > pb.close(); > } > } > > Replace with the reference path defined in > your repository.xml > I didn't tested the code, so there are probably syntax errors... > > > > I am not getting this. I need a nudge in the right direction. > > > > I want to do this query: > > select distinct sk.sid from searchkeys sk, searchwords sw > >where sw.searchword="somesearchword" > > sw.sid = sk.sid > > sk.state="somestate"; > > > > table searchkeys: > > sid <-- unique PK > > state > > > > table searchwords: > > swid <-- unique PK I wish OJB > didn't require > > sid <-- sid in searchkey table > > searchword > > > > searchkeys and searchwords having a 1:n relationship. > > > > > > Right now I both tables mapped according to their > characteristics which I have done many times before. In the past > I have always wanted the primary keys and full records. > > > > Here I don't want the full records or mapping, but just a > collection of the unique sid. I would prefer not to get the full > records and I only require this for read and not write. Imagine > I am doing a keyword search and I just want to know which services > match the search criteria. > > > > Can anybody nudge me in the right direction? Would be great to > get past this problem. I am trying to inprove the searching on my > live OJB used site by including parts of the Lucene project, but > need to be able to do this for it to work. > > > > Thanks lots. > > > > > > > > > > > > - > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > --- > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Unique query without using primary key?
I am not getting this. I need a nudge in the right direction. I want to do this query: select distinct sk.sid from searchkeys sk, searchwords sw where sw.searchword="somesearchword" sw.sid = sk.sid sk.state="somestate"; table searchkeys: sid <-- unique PK state table searchwords: swid <-- unique PK I wish OJB didn't require sid <-- sid in searchkey table searchword searchkeys and searchwords having a 1:n relationship. Right now I both tables mapped according to their characteristics which I have done many times before. In the past I have always wanted the primary keys and full records. Here I don't want the full records or mapping, but just a collection of the unique sid. I would prefer not to get the full records and I only require this for read and not write. Imagine I am doing a keyword search and I just want to know which services match the search criteria. Can anybody nudge me in the right direction? Would be great to get past this problem. I am trying to inprove the searching on my live OJB used site by including parts of the Lucene project, but need to be able to do this for it to work. Thanks lots. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Unique query without using primary key?
This might be a simple question but I am not getting it. Question: How does one retrieve a unique value that is not the primary key? I have the following data: primaryKey <-- wish didn't have to have this autonumbered PK. serviceId searchWord<-- many for each serviceId A single searchWord can be repeated across many serviceIds and primaryKeys. primaryKey is an autonumber pk, but serviceId is not unique. A service can contain different searchWords and different PKs can all have the same searchWords. I would like to do: select unique(serviceId) where searchWord="A" or searchWord="B" or OJB requires a primary key to be returned, but this won't give me a unique serviceId which is what I really need. How does one manage this? In this case I really wish I had a table without a primary key, but OJB does not work that way either. I never need to work with one record, but only collections of same serviceId, many searchwords. Breaking this easy thing across 2 tables seems silly-wasteful. I think I am missing something very simple. JohnE - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: LIMIT timeframe?
I think I need to look at the OJB code more closely. I am not understanding if what I am trying below will work or not. I am not sure if my code will break yet and don't want surprises because I have a large application already working in production using OJB. I guess as I originally said, this is a common long term post on this board. I should try to learn how to implement it so people can use. Thank you very much Jakob for explaining. JohnE - Original Message - From: Jakob Braeuchi <[EMAIL PROTECTED]> Date: Friday, November 12, 2004 11:20 am Subject: Re: LIMIT timeframe? > hi john, > > to implement the LIMIT is not too complicated but to make it > really work for > extents is a bit harder. > imo you should use the platform for db-specific stuff. > > jakob > > [EMAIL PROTECTED] schrieb: > > Thank you for your post Jakob. It sounds like a bit of an > effort. I was thinking based on other code perviously posted on > the board to get around the problem that it might be a bit easier. > I was about to test code people placed on the board previously > to get around the problem. I am not sure based on your words if > it should work? I will try testing it tonight, but I am a bit > nervous it might run me into problems in the future now. Here is > the database specific code: > > > > > > import > org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl;> > import org.apache.ojb.broker.metadata.ClassDescriptor; > > import org.apache.ojb.broker.platforms.Platform; > > import org.apache.ojb.broker.query.Query; > > > > public class MySqlStatementGenerator extends SqlGeneratorDefaultImpl > > { > > > > public MySqlStatementGenerator(Platform pf) > > { > > super(pf); > > } > > > > public String getPreparedSelectStatement(Query query, > ClassDescriptor cld) > > { > > String result = super.getPreparedSelectStatement(query, > cld);> return addOffsetLimit(query, result); > > } > > > > public String getSelectStatementDep(Query query, > ClassDescriptor cld) > > { > > String result = super.getSelectStatementDep(query, cld); > > return addOffsetLimit(query, result); > > } > > > > private String addOffsetLimit(Query q, String stmt) > > { > > int startIndex = q.getStartAtIndex(); > > int endIndex = q.getEndAtIndex(); > > > > if (endIndex > 0) > > { > > if (startIndex < 0 || startIndex >= endIndex) > > { > > startIndex = 0; > > } > > > > stmt += " LIMIT " + (endIndex - startIndex); > > } > > > > if (startIndex > 0) > > { > > stmt += " OFFSET " + startIndex; > > } > > return stmt; > > } > > > > } > > > > > > > > Thank you for your ideas. > > > > JohnE > > > > > > > > > > > > > >>hi john, > >> > >>to be hones, my version of the sql-limit stuff was rather basic > >>and didn't work > >>correctly for extents. > >>before we can really use the sql-LIMIT we'll have to change ojb > to > >>use a > >>_single_ query for all extents (using the UNION clause). with > the > >>current > >>solution using one select for each extent the LIMIT-clause is > not > >>useful. > >>example: > >> > >>-ojb current version: > >>select * from person where ... limit ... > >>select * from musicians where ... limit ... > >> > >>-future version: > >>select * from person where ... > >>union > >>select * from musicians where ... > >>limit ... > >> > >>jakob > >> > >>[EMAIL PROTECTED] schrieb: > >> > >>>Hey all. Thank you for great project. > >>> > >>>I am very excited about my site having gone live with OJB, but > >> > >>there is one aspect of OJB I am really not liking to have to do > >>right now -- make it database specific. It was part of my > >>marketing to have the platform I created be non-database > specific, > >>but that can't be for one reason. > >> > >>>I am looking at all the posts on the board about not having > >> > >>LIMIT supported. I need to do very large table queries but I > >>have to add LIMITs specific to MySQL on the query or there would > >>be a drastically bad performance issue. > >> > >>>Jakob is your LIMIT code you had working working and do you > >> > >>think it might get into 1.0.2 or 1.1? I know you have bigger > fish > >>to fry. > >> > >>>I don't know OJB internals well but I am trying to learn so I > >> > >>can help in the future. > >> > >>>JohnE > >>> > >>> > >>> > >>> > >>> > >>> > - > >> > >> > >> > >>>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: LIMIT timeframe?
Thank you for your post Jakob. It sounds like a bit of an effort. I was thinking based on other code perviously posted on the board to get around the problem that it might be a bit easier. I was about to test code people placed on the board previously to get around the problem. I am not sure based on your words if it should work? I will try testing it tonight, but I am a bit nervous it might run me into problems in the future now. Here is the database specific code: import org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl; import org.apache.ojb.broker.metadata.ClassDescriptor; import org.apache.ojb.broker.platforms.Platform; import org.apache.ojb.broker.query.Query; public class MySqlStatementGenerator extends SqlGeneratorDefaultImpl { public MySqlStatementGenerator(Platform pf) { super(pf); } public String getPreparedSelectStatement(Query query, ClassDescriptor cld) { String result = super.getPreparedSelectStatement(query, cld); return addOffsetLimit(query, result); } public String getSelectStatementDep(Query query, ClassDescriptor cld) { String result = super.getSelectStatementDep(query, cld); return addOffsetLimit(query, result); } private String addOffsetLimit(Query q, String stmt) { int startIndex = q.getStartAtIndex(); int endIndex = q.getEndAtIndex(); if (endIndex > 0) { if (startIndex < 0 || startIndex >= endIndex) { startIndex = 0; } stmt += " LIMIT " + (endIndex - startIndex); } if (startIndex > 0) { stmt += " OFFSET " + startIndex; } return stmt; } } Thank you for your ideas. JohnE > hi john, > > to be hones, my version of the sql-limit stuff was rather basic > and didn't work > correctly for extents. > before we can really use the sql-LIMIT we'll have to change ojb to > use a > _single_ query for all extents (using the UNION clause). with the > current > solution using one select for each extent the LIMIT-clause is not > useful. > example: > > -ojb current version: > select * from person where ... limit ... > select * from musicians where ... limit ... > > -future version: > select * from person where ... > union > select * from musicians where ... > limit ... > > jakob > > [EMAIL PROTECTED] schrieb: > > Hey all. Thank you for great project. > > > > I am very excited about my site having gone live with OJB, but > there is one aspect of OJB I am really not liking to have to do > right now -- make it database specific. It was part of my > marketing to have the platform I created be non-database specific, > but that can't be for one reason. > > > > I am looking at all the posts on the board about not having > LIMIT supported. I need to do very large table queries but I > have to add LIMITs specific to MySQL on the query or there would > be a drastically bad performance issue. > > > > Jakob is your LIMIT code you had working working and do you > think it might get into 1.0.2 or 1.1? I know you have bigger fish > to fry. > > > > I don't know OJB internals well but I am trying to learn so I > can help in the future. > > > > JohnE > > > > > > > > > > > > - > > > 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]
LIMIT timeframe?
Hey all. Thank you for great project. I am very excited about my site having gone live with OJB, but there is one aspect of OJB I am really not liking to have to do right now -- make it database specific. It was part of my marketing to have the platform I created be non-database specific, but that can't be for one reason. I am looking at all the posts on the board about not having LIMIT supported. I need to do very large table queries but I have to add LIMITs specific to MySQL on the query or there would be a drastically bad performance issue. Jakob is your LIMIT code you had working working and do you think it might get into 1.0.2 or 1.1? I know you have bigger fish to fry. I don't know OJB internals well but I am trying to learn so I can help in the future. JohnE - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem compiling
Thank you Thomas, I didn't remember seeing that in the release notes, but I should have figured it out. Not too familiar with Forrest yet. Upon recompiling, however, I was getting this new error below. I am too sleepy to figure it out tonight, but likely something just trivial I am missing. Don't see docs though on it. Just being a dumb user. Will figure it out tomorrow. JohnE rokenlinks.xml [exec] | //check if you have tools.jar installed [exec] | tools.jar.present = true [exec] [exec] | The following properties could be removed from future builds: [exec] | //which skin to apply [exec] | project.skin= tigris-style [exec] | //where your documentation xml is [exec] | project.content-dir = C:\cvslocal\extras\libraries\Apache\OJB\OJB 1.0\src\db-ojb-1.0.0\target\doc\src\documentat ion [exec] [exec] [exec] BUILD FAILED [exec] C:\forrest\forrest.build.xml:224: java.io.FileNotFoundException: C:\forrest\ant\lib\skinconfig-v06.dtd (The system canno t find the file specified) [exec] Total time: 1 second forrest-on-win-with-command: forrest-on-unix: BUILD FAILED file:c:/cvslocal/extras/libraries/Apache/OJB/OJB%201.0/src/db-ojb-1.0.0/build.xml:680: C:\cvslocal\extras\libraries\Apache\OJB\OJB 1 .0\src\db-ojb-1.0.0\target\doc\build\site not found. Total time: 3 minutes 0 seconds - Original Message - From: Thomas Dudziak <[EMAIL PROTECTED]> Date: Thursday, July 1, 2004 2:04 am Subject: Re: problem compiling > [EMAIL PROTECTED] wrote: > > > I downloaded db-ojb-1.0.0-src.zip and made my standard > modifications which had worked in the past. > > > > I am getting the failure below which I have never had before. > > > > Any ideas? I can send more detail if necessary. Not seeing > anything wrong as of yet with the properties. > > OJB now uses Forrest (http://forrest.apache.org) to build its > documentation. So if you run the build with 'ant' or 'ant all' > then it's > also trying to build the doc which fails because you don't have > Forrest > installed. Now you can either install Forrest (from SVN, see their > website), or you build only the OJB jars with 'ant jar' or 'ant > jar-debug'. > > 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]
problem compiling
I downloaded db-ojb-1.0.0-src.zip and made my standard modifications which had worked in the past. I am getting the failure below which I have never had before. Any ideas? I can send more detail if necessary. Not seeing anything wrong as of yet with the properties. Thank you JohnE doc: [echo] *** Preparing generation of documentation ... [mkdir] Created dir: C:\cvslocal\extras\libraries\apache\OJB\OJB 1.0\src\db-ojb-1.0.0\target\doc [copy] Copying 88 files to C:\cvslocal\extras\libraries\apache\OJB\OJB 1.0\src\db-ojb-1.0.0\target\doc [copy] Copying 487 files to C:\cvslocal\extras\libraries\apache\OJB\OJB 1.0\src\db-ojb-1.0.0\target\doc\src\documentation\conte nt\api [copy] Copying 1 file to C:\cvslocal\extras\libraries\apache\OJB\OJB 1.0\src\db-ojb-1.0.0\target\doc\src\documentation\content [copy] Copying 1 file to C:\cvslocal\extras\libraries\apache\OJB\OJB 1.0\src\db-ojb-1.0.0\target\doc\src\documentation\content [copy] Copying 1 file to C:\cvslocal\extras\libraries\apache\OJB\OJB 1.0\src\db-ojb-1.0.0\target\doc\src\documentation\content [copy] Copying 1 file to C:\cvslocal\extras\libraries\apache\OJB\OJB 1.0\src\db-ojb-1.0.0\target\doc\src\documentation\content [copy] Copying 1 file to C:\cvslocal\extras\libraries\apache\OJB\OJB 1.0\src\db-ojb-1.0.0\target\doc\src\documentation\content [copy] Copying 1 file to C:\cvslocal\extras\libraries\apache\OJB\OJB 1.0\src\db-ojb-1.0.0\target\doc\src\documentation\content [copy] Copying 1 file to C:\cvslocal\extras\libraries\apache\OJB\OJB 1.0\src\db-ojb-1.0.0\target\doc\src\documentation\content [copy] Copying 1 file to C:\cvslocal\extras\libraries\apache\OJB\OJB 1.0\src\db-ojb-1.0.0\target\doc\src\documentation\content [copy] Copying 1 file to C:\cvslocal\extras\libraries\apache\OJB\OJB 1.0\src\db-ojb-1.0.0\target\doc\src\documentation\content forrest-on-win-with-cmd: [exec] 'forrest.bat' is not recognized as an internal or external command, [exec] operable program or batch file. [exec] Result: 1 forrest-on-win-with-command: forrest-on-unix: BUILD FAILED file:c:/cvslocal/extras/libraries/apache/OJB/OJB%201.0/src/db-ojb-1.0.0/build.xml:680: C:\cvslocal\extras\libraries\apache\OJB\OJB 1 .0\src\db-ojb-1.0.0\target\doc\build\site not found. Total time: 2 minutes 42 seconds - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Still no luck with this query
I will think about what you said. I have read the advanced manual so many times, but somehow didn't think about that as the solution. Soon enough OR mappings will flow like SQL does, but not yet!!! I have such a "common parent" for another piece of the model, but hadn't here. Thank you for your suggestions. John - Original Message - From: Laurie Harper <[EMAIL PROTECTED]> Date: Tuesday, March 16, 2004 6:22 pm Subject: Re: Still no luck with this query > If all you're interested in is managing an N:M relationship > between > instances of a particular type (rows in a particular table), you > just > need a regular N:M mapping. See the Advanced OR Mapping tutorial > section > on this [1]. That takes care of if there's just one object/table > involved. The only difference is you end up with two collection > descriptors on one class descriptor, to describe the two sides of > the > relationship. > > If your object model has a different class for each service > (rstep1..N) > you need to define a pair of collection descriptors for each class. > > Finally, you'll probably want all the services to have a common > parent > class and have the collections be of that type, so you have the > same API > for getting the who's interested / who am I interested in data > accross > all services. > > Hope that helps, > > L. > > [1] http://db.apache.org/ojb/tutorial3.html#Mapping+m:n+associations > > [EMAIL PROTECTED] wrote: > > > Jakob, > > > > I agree. I hope/believe the model is a db model is well thought > out. In straight SQL the solotion is perfect and trivial as > shown by the few line query I gave you. It becomes a bit more > complicated representing it in OR mappings it seems and I am not > as good with that. I am taking in all of what we are talking > about here before I implement this part across all the services > because you impart good ideas. Here is what I was trying to do in > a less abreviated manner. > > > > Basically what I have is: > >Many services (rstep is an example) each with a unique > > primary key (msid) that spans all services. > Each service > > is housed in their own sets of tables (rstep1 > .. rstepN). > >The serviceinterest table gives the ability for one > service to show > > interest in another service, hense the double > primary key > > (interestmsid, targetmsid) making entries unique. > > Basically it shows the primary key of one > service being > > interested in the primary key of the other service. > >In general from this I can get two things. All of the > services that my > > service is interested in and all of the > services interested in my > > service. In the end, I need the > serviceinterest table just > > to create that connection, but I don't need its > data as my > > service would just like to see the collection > of a type of service > > interested in it. > >Boggle. I hope you didn't follow all that. I believe > that means that > > the serviceinterest table creates a m:n type of > connection> between the service tables. > > > > In the end, it would be nice for a service (rstep1) to > be able to say, > > "give me the data of all the services > interested in me" and > > "give me the data of all the services I am > interested in." > > > > That was how I was thinking about the problem and you > now have > > me thinking "map a specific serviceinterest to > a specific service > > and I can get the collection of services that > are interested in > > my service." "Create another mapping from > serviceinterest to > > that same specific service to get the > collection of services that > > I am interested in." > > > >It will work unlike mine, but it isn't as natural a fit. > As I said before, it > > kinda flips the problem upside down but matches > the primary keys. > > > > > > Thanks again for listening to this long windedness. I am > learning!!!> > > John > > [EMAIL PROTECTED] > > > > > > > > > > - Original Message - > > From: Jakob Braeuchi <[EMAIL PROTECTED]> > > Date: Monday, March 15, 2004 1:09 pm > > Subject: Re: Still no luck with this query > > > > > >>hi john, > >> > >>a very important issue doing or-mapping is having a clean object- > >>model and clean > >>db-schema. you say service has to point to a serviceinterest > >>(1:1), but why is > >>it actually a 1:n relation ship ? what is the meaning of the > >>columns targetmsid > >>and interestmsid. to me this table looks like an m:n-connection- > >>table, like the > >>person_project table in the ojb-tes
Re: Still no luck with this query
Jakob, I agree. I hope/believe the model is a db model is well thought out. In straight SQL the solotion is perfect and trivial as shown by the few line query I gave you. It becomes a bit more complicated representing it in OR mappings it seems and I am not as good with that. I am taking in all of what we are talking about here before I implement this part across all the services because you impart good ideas. Here is what I was trying to do in a less abreviated manner. Basically what I have is: Many services (rstep is an example) each with a unique primary key (msid) that spans all services. Each service is housed in their own sets of tables (rstep1 .. rstepN). The serviceinterest table gives the ability for one service to show interest in another service, hense the double primary key (interestmsid, targetmsid) making entries unique. Basically it shows the primary key of one service being interested in the primary key of the other service. In general from this I can get two things. All of the services that my service is interested in and all of the services interested in my service. In the end, I need the serviceinterest table just to create that connection, but I don't need its data as my service would just like to see the collection of a type of service interested in it. Boggle. I hope you didn't follow all that. I believe that means that the serviceinterest table creates a m:n type of connection between the service tables. In the end, it would be nice for a service (rstep1) to be able to say, "give me the data of all the services interested in me" and "give me the data of all the services I am interested in." That was how I was thinking about the problem and you now have me thinking "map a specific serviceinterest to a specific service and I can get the collection of services that are interested in my service." "Create another mapping from serviceinterest to that same specific service to get the collection of services that I am interested in." It will work unlike mine, but it isn't as natural a fit. As I said before, it kinda flips the problem upside down but matches the primary keys. Thanks again for listening to this long windedness. I am learning!!! John [EMAIL PROTECTED] - Original Message - From: Jakob Braeuchi <[EMAIL PROTECTED]> Date: Monday, March 15, 2004 1:09 pm Subject: Re: Still no luck with this query > hi john, > > a very important issue doing or-mapping is having a clean object- > model and clean > db-schema. you say service has to point to a serviceinterest > (1:1), but why is > it actually a 1:n relation ship ? what is the meaning of the > columns targetmsid > and interestmsid. to me this table looks like an m:n-connection- > table, like the > person_project table in the ojb-testcases. > > jakob > > [EMAIL PROTECTED] wrote: > > Thank you so much Jakob. You help lots of people here. > Hopefully when I feel I understand OR mappings a bit better I can > help some as well. > > > > I had not responded right away because I have been thinking > about your solution. You turned the problem upside down making > the keys match which works. > > > > The only downside to the solution which has been having me do > that thinking part is that the serviceinterest table/object "was" > kinda generic. By turning this upside down, I now map a seperate > serviceinterest object to each service rather then a service to a > generic serviceinterest. Though not a big deal it doubles the > number of required mappings and reduces a bit of the abstraction. > It also creates/stores more objects then I was hoping it would > because i was not hoping ot have to hold onto all of the > serviceinterest data, but just the service data (rstep1 is just > one service type in the bigger problem). > > > > All in all, however, this is a HUGE improvement over not being > able to get the query to work at all!!! > > > > Thank you sir. > > > > JohnE > > > > > > - Original Message - > > From: Jakob Braeuchi <[EMAIL PROTECTED]> > > Date: Friday, March 12, 2004 12:13 pm > > Subject: Re: Still no luck with this query > > > > > >>hi john, > >> > >>[EMAIL PROTECTED] wrote: > >> > >> > >>>Sorry for the confusion. I tried to abbreviate to make it > >> > >>easier to read. > >> > >>> > >>>In the end, I want to do this query: > >>> > >>>SELECT r.msid, r.rtitle, r.brief > >>>FROM rstep1 r, serviceinterest si > >>>WHERE ((si.targetmsid = 101) > >>> AND (si.interestmsid = r.msid)) > >>> > >>> > >>> > >>>Based o
Re: Still no luck with this query
Thank you so much Jakob. You help lots of people here. Hopefully when I feel I understand OR mappings a bit better I can help some as well. I had not responded right away because I have been thinking about your solution. You turned the problem upside down making the keys match which works. The only downside to the solution which has been having me do that thinking part is that the serviceinterest table/object "was" kinda generic. By turning this upside down, I now map a seperate serviceinterest object to each service rather then a service to a generic serviceinterest. Though not a big deal it doubles the number of required mappings and reduces a bit of the abstraction. It also creates/stores more objects then I was hoping it would because i was not hoping ot have to hold onto all of the serviceinterest data, but just the service data (rstep1 is just one service type in the bigger problem). All in all, however, this is a HUGE improvement over not being able to get the query to work at all!!! Thank you sir. JohnE - Original Message - From: Jakob Braeuchi <[EMAIL PROTECTED]> Date: Friday, March 12, 2004 12:13 pm Subject: Re: Still no luck with this query > hi john, > > [EMAIL PROTECTED] wrote: > > > Sorry for the confusion. I tried to abbreviate to make it > easier to read. > > > > > > In the end, I want to do this query: > > > > SELECT r.msid, r.rtitle, r.brief > > FROM rstep1 r, serviceinterest si > > WHERE ((si.targetmsid = 101) > > AND (si.interestmsid = r.msid)) > > > > > > > > Based on these two tables and the repository I gave previously: > > CREATE TABLE rstep1 ( > > msid BIGINT(20) NOT NULL, > > rtitle VARCHAR(70) NOT NULL, > > brief VARCHAR(255) NULL, > > PRIMARY KEY(msid), > > ) > > > > CREATE TABLE serviceinterest ( > > targetmsid BIGINT(20) UNSIGNED NOT NULL, > > interestmsid BIGINT(20) UNSIGNED NOT NULL, > > targetmid BIGINT(20) UNSIGNED NOT NULL, > > interestmid BIGINT(20) UNSIGNED NOT NULL, > > PRIMARY KEY(targetmsid, interestmsid) > > ) > > > > > > > > si.targetmsid=101, the subquery and one part of the > serviceinterest primary key, should generate a list of > serviceinterests.> > > I want to return the one-to-one associated rstep1 > (RServiceInterestVO) for each of the those serviceinterests that > were generated. > > > > why don't you define a 1:1 relationship pointing from > ServiceInterest to > RServiceInterestVO. imo the relationship pointing in the other > direction > (RServiceInterestVO to ServiceInterest) should be a 1:n relationship. > > class="com.model.services.interest.RServiceInterestVO"table="rstep1"> > > name="memberServiceId" > column="msid" > jdbc-type="BIGINT" > primarykey="true" > /> > ... > name="serviceInterests" > > class-ref="com.model.memberservice.ServiceInterestVO" > auto-retrieve="true" > auto-update="false" > auto-delete="false"> > > > > > class="com.model.memberservice.ServiceInterestVO" > > table="serviceinterest"> > > name="targetMemberServiceId" >column="targetmsid" >jdbc-type="BIGINT" >primarykey="true" > /> > name="interestMemberServiceId" >column="interestmsid" >jdbc-type="BIGINT" >primarykey="true" > /> > ... > name="targetService" > > class-ref="com.model.memberservice.RServiceInterestVO" > auto-retrieve="true" > auto-update="false" > auto-delete="false"> > > > > > > > then it should be possible to query: > > Criteria crit = new Criteria(); > crit.addEqualTo("serviceInterests.targetMemberServiceId", 101); > Query query = new QueryByCriteria(RServiceInterestVO.class, crit); > broker.getCollectionByQuery(query); > > jakob > > > > > crit.addEqualTo("serviceInterest.targetMemberServiceId", 101); > > crit.addEqualToField("serviceInterest.interestMemberServiceId", > "memberServiceId");> > > > > Yes I am trying to join with this addEqualToField, but notice > onto the 2nd half of the primary key. > > > > > > I know my mapping is wrong, bit I don't know how to give a > correct mapping for this problem. That is where my problem lies. > In every other query I have done, there was a simple one to one > primary key mapping that INNER JOIN worked well on. Here, the > primary key is not fully used in the subquery and actually > prevents this from working. > > > > Hense I am asking for a new idea or direction. I don't know
Re: Still no luck with this query
Sorry for the confusion. I tried to abbreviate to make it easier to read. In the end, I want to do this query: SELECT r.msid, r.rtitle, r.brief FROM rstep1 r, serviceinterest si WHERE ((si.targetmsid = 101) AND (si.interestmsid = r.msid)) Based on these two tables and the repository I gave previously: CREATE TABLE rstep1 ( msid BIGINT(20) NOT NULL, rtitle VARCHAR(70) NOT NULL, brief VARCHAR(255) NULL, PRIMARY KEY(msid), ) CREATE TABLE serviceinterest ( targetmsid BIGINT(20) UNSIGNED NOT NULL, interestmsid BIGINT(20) UNSIGNED NOT NULL, targetmid BIGINT(20) UNSIGNED NOT NULL, interestmid BIGINT(20) UNSIGNED NOT NULL, PRIMARY KEY(targetmsid, interestmsid) ) si.targetmsid=101, the subquery and one part of the serviceinterest primary key, should generate a list of serviceinterests. I want to return the one-to-one associated rstep1 (RServiceInterestVO) for each of the those serviceinterests that were generated. crit.addEqualTo("serviceInterest.targetMemberServiceId", 101); crit.addEqualToField("serviceInterest.interestMemberServiceId", "memberServiceId"); Yes I am trying to join with this addEqualToField, but notice onto the 2nd half of the primary key. I know my mapping is wrong, bit I don't know how to give a correct mapping for this problem. That is where my problem lies. In every other query I have done, there was a simple one to one primary key mapping that INNER JOIN worked well on. Here, the primary key is not fully used in the subquery and actually prevents this from working. Hense I am asking for a new idea or direction. I don't know how to proceed. I am trying to learn. JohnE - Original Message - From: Jakob Braeuchi <[EMAIL PROTECTED]> Date: Thursday, March 11, 2004 1:17 pm Subject: Re: Still no luck with this query > hi john, > > you have a 1:1-relationship pointing from RServiceInterestVO to > ServiceInterestVO, is this correct ? a similar relationship can be > found in the > samples (ProductGroup to Article). > the pk of RServiceInterestVO is used as fk to ServiceInterestVO in > your > repository. but the comment says it's wrong. > > according to the repository each class has a single pk; but the > table > serviceinterest uses a combined pk ? and i cannot find a create > table for > rstep1. pk definition in create table and the repository must > match ! > > crit.addEqualTo("serviceInterest.targetMemberServiceId", jMsid); > crit.addEqualToField("serviceInterest.interestMemberServiceId", > "memberServiceId"); > dou you try to force a join with addEqualToField ? > > jakob > > [EMAIL PROTECTED] wrote: > > > Thank you for responding Jakob. > > > > Again this is the query I would like: > > > > SELECT r.msid, r.rtitle, r.brief > > FROM rstep1 r, serviceinterest si > > WHERE ((si.targetmsid = 101) > > AND (si.interestmsid = r.msid)) > > > > > > Below was my first of many attempts to solve this problem, but > it wouldn't work right using RC4 because it tries to form the > INNER JOIN from the memberServiceId to the first of two part > primary key in the second table. I had not tried this particular > method in RC5, but tried other methods using RC5. > > > > I know below is wrong, but I don't know the right strategy for > what I need. I can't seem to figure out how to handle subqueries > not off the primary key. > > > > > > I want a collection of these back: > > > > class="com.model.services.interest.RServiceInterestVO" table="rstep1"> > > > name="memberServiceId" > > column="msid" > > jdbc-type="BIGINT" > > primarykey="true" > > /> > > > name="rTitle" > > column="rtitle" > > jdbc-type="VARCHAR" > > /> > > > name="brief" > > column="brief" > > jdbc-type="VARCHAR" > > /> > > > > > > > > > > > name="serviceInterest" > > class-ref="com.model.memberservice.ServiceInterestVO" > > auto-retrieve="true" > > auto-update="false" > > auto-delete="false"> > > > > > > > > > > > > > > > > > > > > This is what the subquery table looks like: > > > > > > class="com.model.memberservice.ServiceInterestVO" table="serviceinterest"> > > > name="targetMemberServiceId" > > column="targetmsid" > > jdbc-type="BIGINT" > > primarykey="true" > > /> > > > name="targetMemberId" > > column="targetmid" > > jdbc-type="BIGINT" > > indexed="true" > > /> > > > name="interestMemberServiceId" > > column="interestmsid" > > jdbc-type="BIGINT" > > primarykey="true" > > /> > > > name="interestMemberId" > > column="interestm
Re: Still no luck with this query
Thank you for responding Jakob. Again this is the query I would like: SELECT r.msid, r.rtitle, r.brief FROM rstep1 r, serviceinterest si WHERE ((si.targetmsid = 101) AND (si.interestmsid = r.msid)) Below was my first of many attempts to solve this problem, but it wouldn't work right using RC4 because it tries to form the INNER JOIN from the memberServiceId to the first of two part primary key in the second table. I had not tried this particular method in RC5, but tried other methods using RC5. I know below is wrong, but I don't know the right strategy for what I need. I can't seem to figure out how to handle subqueries not off the primary key. I want a collection of these back: This is what the subquery table looks like: This failed as well as other things: crit.addEqualTo("serviceInterest.targetMemberServiceId", jMsid); crit.addEqualToField("serviceInterest.interestMemberServiceId", "memberServiceId"); Collection result = GenericDAO.getInstance().findCollectionByCriteria(objectClass, crit); - Original Message - From: Jakob Braeuchi <[EMAIL PROTECTED]> Date: Wednesday, March 10, 2004 1:25 pm Subject: Re: Still no luck with this query > hi john, > > you should at least provide some information about the repository > you use. > > jakob > > [EMAIL PROTECTED] wrote: > > > Dear all, > > > > Maybe I wasn't asking my question well because it had not gained > a response in about a week. Maybe I am missing something very > simple, but I am still pretty new to any kinda OR-mappings and I > have nobody who can help but this list. Rather then try to > explain the 4 different ways I tried to solve it again, how might > people with better understanding. I can not find an answer to > this in the mailing lists nor in the docs. If you have a > reference, please give me a pointer. > > > > I am trying to get a listing of all of the services ('aservice') > that are interested in my particular service (having id 101). > > > > // The query I would like agressively abreviated: > > SELECT r.msid, r.rtitle, r.brief > > FROM aservice r, serviceinterest si > > WHERE ((si.targetmsid = 101) > > AND (si.interestmsid = r.msid)) > > > > > > // I want a collection of these returned > > CREATE TABLE aservice ( > > msid BIGINT(20) NOT NULL, > > rtitle VARCHAR(70) NOT NULL, > > brief VARCHAR(255) NULL, > > PRIMARY KEY(msid), > > ) > > > > > > // Note a duo key that should not be referenced in whole by > aservice:> CREATE TABLE serviceinterest ( > > targetmsid BIGINT(20) UNSIGNED NOT NULL, > > interestmsid BIGINT(20) UNSIGNED NOT NULL, > > PRIMARY KEY(targetmsid, interestmsid) > > ) > > > > > > I have been having problems because of foreign keys and how > INNER JOIN seems to work with this query. > > > > > > Thank you if you can. I will gladly post more detailed > information or email the code as need be. > > > > JohnE > > [EMAIL PROTECTED] > > > > > > > > > > > > - > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --- > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Still no luck with this query
Dear all, Maybe I wasn't asking my question well because it had not gained a response in about a week. Maybe I am missing something very simple, but I am still pretty new to any kinda OR-mappings and I have nobody who can help but this list. Rather then try to explain the 4 different ways I tried to solve it again, how might people with better understanding. I can not find an answer to this in the mailing lists nor in the docs. If you have a reference, please give me a pointer. I am trying to get a listing of all of the services ('aservice') that are interested in my particular service (having id 101). // The query I would like agressively abreviated: SELECT r.msid, r.rtitle, r.brief FROM aservice r, serviceinterest si WHERE ((si.targetmsid = 101) AND (si.interestmsid = r.msid)) // I want a collection of these returned CREATE TABLE aservice ( msid BIGINT(20) NOT NULL, rtitle VARCHAR(70) NOT NULL, brief VARCHAR(255) NULL, PRIMARY KEY(msid), ) // Note a duo key that should not be referenced in whole by aservice: CREATE TABLE serviceinterest ( targetmsid BIGINT(20) UNSIGNED NOT NULL, interestmsid BIGINT(20) UNSIGNED NOT NULL, PRIMARY KEY(targetmsid, interestmsid) ) I have been having problems because of foreign keys and how INNER JOIN seems to work with this query. Thank you if you can. I will gladly post more detailed information or email the code as need be. JohnE [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Referencing tables not in return object
I have been working on this bug for like 4 days now. I have not been able to figure it out. Being the last big query of this project, it is kinda a bit harsh a bit late. What I have tried is to reform the query using: String query = "SELECT r.rTitle, r.brief FROM rstep1 r, si WHERE ((si.targetmsid = 20001025) AND (si.targetmid = 20001) AND (si.interestmsid = r.msid))" QueryBySQL qBySql = QueryFactory.newQuery(objectClass, query); Collection result = broker.getCollectionByQuery(qBySql); When I take the resulting query out of the log file and run it against the database, it works, but OJB returns nothing. I looked through the archives and saw bugs that might effect this so upgraded from RC4 to last night's nightly build. I still get nothing back from this query. I have no idea what to do now. JohnE - Original Message - From: [EMAIL PROTECTED] Date: Thursday, March 4, 2004 4:33 pm Subject: Referencing tables not in return object > > I am not sure how to do something and have tried a couple of > approaches without success. I could use some help. > > My problem comes down to the idea that I want to return a mapped > object but based on a complex query that gets messed up due to the > way OJB uses foreign keys. Is there a way to do a query on tables > not referenced in the object you seek to return? I want to > return rstep1 objects (A0), but I need to create a complex query > in other tables to get rstep1 objects. > > > What I would to have happened is something like: >SELECT A0.rTitle, A0.brief >FROM rstep1 A0, si A1 >WHERE ((A1.targetmsid = 20001025 ) >AND A1.targetmid = 20001 ) >AND interestmsid = A0.msid > > > What I do get through OJB's use of the foreign key is: >SELECT A0.rTitle, A0.brief >FROM rstep1 A0 >INNER JOIN si A1 ON A0.msid=A1.targetmsid >WHERE ((A1.targetmsid = 20001025 ) >AND A1.targetmid = 20001 ) >AND A1.interestmsid = A0.msid > > > Is there a way to create a query that returns a mapped object > where tables referened are not held within the object? I only > want to return values rstep1, but have to reference another table > only within the query. The query gets messed up because of the > foreign key used to generate the query. > > I have tried below without using a reference to the si table, but > si becomes ambigous. > >crit.addSql("si.targetmsid = " + jMsid); >crit.addSql("si.targetmid = " + jMid); >crit.addSql("si.interestmsid = rstep1.msid"); > > I have tried below with references to the si table and it creates > the 2nd query above with the incorrect INNER JOIN. > >crit.addEqualTo("si.targetmsid", jMsid); >crit.addEqualTo("si.targetmid", jMid); >crit.addEqualToField("si.interestmsid", "memberServiceId"); > >In this second case, if a reference is required, is there > a way that I can not have an INNER JOIN on the foreign key be created. > > > Thank you for any help. > > JohnE > > > > > > > > > --- > -- > 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]
Referencing tables not in return object
I am not sure how to do something and have tried a couple of approaches without success. I could use some help. My problem comes down to the idea that I want to return a mapped object but based on a complex query that gets messed up due to the way OJB uses foreign keys. Is there a way to do a query on tables not referenced in the object you seek to return? I want to return rstep1 objects (A0), but I need to create a complex query in other tables to get rstep1 objects. What I would to have happened is something like: SELECT A0.rTitle, A0.brief FROM rstep1 A0, si A1 WHERE ((A1.targetmsid = 20001025 ) AND A1.targetmid = 20001 ) AND interestmsid = A0.msid What I do get through OJB's use of the foreign key is: SELECT A0.rTitle, A0.brief FROM rstep1 A0 INNER JOIN si A1 ON A0.msid=A1.targetmsid WHERE ((A1.targetmsid = 20001025 ) AND A1.targetmid = 20001 ) AND A1.interestmsid = A0.msid Is there a way to create a query that returns a mapped object where tables referened are not held within the object? I only want to return values rstep1, but have to reference another table only within the query. The query gets messed up because of the foreign key used to generate the query. I have tried below without using a reference to the si table, but si becomes ambigous. crit.addSql("si.targetmsid = " + jMsid); crit.addSql("si.targetmid = " + jMid); crit.addSql("si.interestmsid = rstep1.msid"); I have tried below with references to the si table and it creates the 2nd query above with the incorrect INNER JOIN. crit.addEqualTo("si.targetmsid", jMsid); crit.addEqualTo("si.targetmid", jMid); crit.addEqualToField("si.interestmsid", "memberServiceId"); In this second case, if a reference is required, is there a way that I can not have an INNER JOIN on the foreign key be created. Thank you for any help. JohnE - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Date Comparisons
To start off, thank you who can help. I have looked through examples, docs, etc. The forum "almost" helped. The end problem is that I am doing a addLessThan on a datetime db field using the PB and it is failing likely because of a type casting problem. I am using Timestamp in my java code. Using this for my mapping into a DATETIME field in MySql. Data gets inserted correctly into MySQL or seems to, but when I do crit.addLessThan("offerends", new Timestamp(System.currentTimeMillis()); When I print out the query, I get: Query from class com.model.offer.OfferVO where [offerprice > 0.0, isdisabled = false, offerends < 2004-01-31 21:59:07.89, > offeredProducts.productid = 1000] It is the time aspect on this which is failing. The row should return back data, but is failing to do so. Thank you again for your help. John - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Still not understanding why getCollectionByQuery() is not getting sub-object.
Is anybody aware of anything in RC2 that would prevent getCollectionByQuery() from realizing sub-objects? I get N records using getCollectionByQuery() successfully, but this OfferVO subobject continues to not show its ugly head unless I manually get each sub-object. I have auto-retrieve="true" everywhere. I successfully get a different sub-reference on a different non-collection object. My mapping is correct in that manual retieval works. I thought sub-objects would be realized with getCollectionByQuery() unlike with getIteratorByQuery(). I am wondering if it could have something to do with the fact that the Collection of OrderItemVO has 3 primary keys or something to do with the below setting in the OJB.properties I needed to allow for '->' Single Table Aggregation. '->' was only allowed as far as I know in RC2 using this setting. I don't know if it was implemented in the default setting since. PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentNestedFieldMaxPerformanceImpl My repository.xml as it is today for the two important tables follows: - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RE: Another silly newbie mapping question
So, I iterated through the Collection of orderItems I had retrieved and extracted the offers attached by each manually and it worked. I guess I am to the point where I don't know why the getCollectionByQuery() won't pull automagically each Offer. Manual means work, but are very inefficient and I want to understand this just for the sake of understanding. JohnE - Original Message - From: [EMAIL PROTECTED] Date: Sunday, November 2, 2003 5:24 pm Subject: Re: RE: Another silly newbie mapping question > Still no clue on what is wrong with this. > > > > > - Original Message - > From: [EMAIL PROTECTED] > Date: Friday, October 31, 2003 3:19 pm > Subject: Re: RE: Another silly newbie mapping question > > > Thank you Robert, but Offers are permanent pieces of information > > in the database whereas OrderItems come and go. > > > > > > The site holds numerous Offers which are stored permanently in > the > > database. The customer has a shopping cart which is basically > an > > OrderItem based on those Offers. So when I get an OrderItem > from > > the database I just wanted to also be able to pull the > associated > > Offer though I would never want Offer to change. > > > > I have looked in the ojb's repository_junit.xml test cases which > > have always helped me in the past, but i think I am just missing > > something. The Collection of OrderItems pull, but not these > > attached Offer objects. I have verified the database, etc. > The > > messages don't seem to show it even attempting to pull the Offer. > > > > I have a similar reference for Member and Location that is > working > > so it is confusing to me. Thank you for any ideas as I am about > > plum out of them. > > > > JohnE > > > > > > > > > > > > > > > > - Original Message - > > From: Robert J Celestino <[EMAIL PROTECTED]> > > Date: Friday, October 31, 2003 10:11 am > > Subject: RE: Another silly newbie mapping question > > > > > Hello John, > > > > > > I think you want auto-update="true" instead of "false" here: > > > > > > > > > > > > > >name="offer" > > > > > >class- > > ref="com.jobbank.jobbank.model.offer.OfferVO"> > > > > > auto-retrieve="true" > > > > > >auto-update="false" > > > > > >auto-delete="false"> > > > > > > > > > > > > > > > > > > my thinking is that when you store the OrderItem the Offer is > > not > > > writen bacause auto-update is false. Then when reading the > > > OrderItem back out, the Offer is not there. > > > > > > Bob c > > > > > > > > > --- > - > > > Bob Celestino > > > SAS Research and Development > > > 919 - 531 - 9425 > > > [EMAIL PROTECTED] > > > > > > SAS - The Power to Know > > > > > > > > > > -Original Message- > > > > From: [EMAIL PROTECTED] [EMAIL PROTECTED] > > > > Sent: Friday, October 31, 2003 5:01 AM > > > > To: OJB Users List > > > > Subject: Re: Another silly newbie mapping question > > > > > > > > > > > > I give up for the night. BTW I am using Release Candidate 2. > > > > > > > > Not sure it matters, but I am using > > > > PersistentFieldClass=org.apache.ojb.broker.metadata.fieldacc > > > > ess.PersistentNestedFieldMaxPerformanceImpl so that I could > > > > use '->' Single Table Aggregation as it wasn't implemented > > > > in the default implementation. > > > > > > > > From the archives it seemed ok to map multiple primary keys > > > > to one primary key. > > > > > > > > > > > > - Original Message - > > > > From: [EMAIL PROTECTED] > > > > Date: Friday, October 31, 2003 2:49 am > > > > Subject: Re: Another silly newbie mapping question > > > > > > > > > Still no luck. I noticed that my primary key order might > have> > > > something to do with it so I switched the order > within the > > > > > OrderItemVO mapping, but it didn't seem to help. I > > > > realized that > > > > > based on the logging that OJB does not seem to even be > > > trying to > > > > > materialize the OfferVO object as no notice is printed > > about > > > it > > > > > trying. Here is my logging: > > > > > > > > > > > > > > > [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: > > > > > executeQuery : Query from class > > > > > com.jobbank.jobbank.model.order.OrderItemVO where > > > > > > > > > [EMAIL PROTECTED] > > > > oker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: > > > > SQL:SELECT A0.modified,A0.offerid,A0.disabled,A0.mid,A0.offerq > > > > > uantity,A0.orderid,A0.buylater,A0.added FROM orderitem A0 > > > WHERE > > > > > (mid = ? ) AND orderid = ? > > > > > [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: > > > > > executeQuery: [EMAIL PROTECTED]: > > > SELECT > > > > > > > > > A0.modified,A0.offerid,A0.disabled,A0.mid,A0.offerquantity,A > > > > 0.orderid,A0.buylater,A0.added FROM order
Re: RE: Another silly newbie mapping question
Still no clue on what is wrong with this. - Original Message - From: [EMAIL PROTECTED] Date: Friday, October 31, 2003 3:19 pm Subject: Re: RE: Another silly newbie mapping question > Thank you Robert, but Offers are permanent pieces of information > in the database whereas OrderItems come and go. > > > The site holds numerous Offers which are stored permanently in the > database. The customer has a shopping cart which is basically an > OrderItem based on those Offers. So when I get an OrderItem from > the database I just wanted to also be able to pull the associated > Offer though I would never want Offer to change. > > I have looked in the ojb's repository_junit.xml test cases which > have always helped me in the past, but i think I am just missing > something. The Collection of OrderItems pull, but not these > attached Offer objects. I have verified the database, etc. The > messages don't seem to show it even attempting to pull the Offer. > > I have a similar reference for Member and Location that is working > so it is confusing to me. Thank you for any ideas as I am about > plum out of them. > > JohnE > > > > > > > > - Original Message - > From: Robert J Celestino <[EMAIL PROTECTED]> > Date: Friday, October 31, 2003 10:11 am > Subject: RE: Another silly newbie mapping question > > > Hello John, > > > > I think you want auto-update="true" instead of "false" here: > > > > > > > > > > >name="offer" > > > > >class- > ref="com.jobbank.jobbank.model.offer.OfferVO"> > > > > auto-retrieve="true" > > > > >auto-update="false" > > > > >auto-delete="false"> > > > > > > > > > > > > > > my thinking is that when you store the OrderItem the Offer is > not > > writen bacause auto-update is false. Then when reading the > > OrderItem back out, the Offer is not there. > > > > Bob c > > > > > > > > Bob Celestino > > SAS Research and Development > > 919 - 531 - 9425 > > [EMAIL PROTECTED] > > > > SAS - The Power to Know > > > > > > > -Original Message- > > > From: [EMAIL PROTECTED] [EMAIL PROTECTED] > > > Sent: Friday, October 31, 2003 5:01 AM > > > To: OJB Users List > > > Subject: Re: Another silly newbie mapping question > > > > > > > > > I give up for the night. BTW I am using Release Candidate 2. > > > > > > Not sure it matters, but I am using > > > PersistentFieldClass=org.apache.ojb.broker.metadata.fieldacc > > > ess.PersistentNestedFieldMaxPerformanceImpl so that I could > > > use '->' Single Table Aggregation as it wasn't implemented > > > in the default implementation. > > > > > > From the archives it seemed ok to map multiple primary keys > > > to one primary key. > > > > > > > > > - Original Message - > > > From: [EMAIL PROTECTED] > > > Date: Friday, October 31, 2003 2:49 am > > > Subject: Re: Another silly newbie mapping question > > > > > > > Still no luck. I noticed that my primary key order might have > > > > something to do with it so I switched the order within the > > > > OrderItemVO mapping, but it didn't seem to help. I > > > realized that > > > > based on the logging that OJB does not seem to even be > > trying to > > > > materialize the OfferVO object as no notice is printed > about > > it > > > > trying. Here is my logging: > > > > > > > > > > > > [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: > > > > executeQuery : Query from class > > > > com.jobbank.jobbank.model.order.OrderItemVO where > > > > > > > [EMAIL PROTECTED] > > > oker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: > > > SQL:SELECT A0.modified,A0.offerid,A0.disabled,A0.mid,A0.offerq > > > > uantity,A0.orderid,A0.buylater,A0.added FROM orderitem A0 > > WHERE > > > > (mid = ? ) AND orderid = ? > > > > [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: > > > > executeQuery: [EMAIL PROTECTED]: > > SELECT > > > > > > > A0.modified,A0.offerid,A0.disabled,A0.mid,A0.offerquantity,A > > > 0.orderid,A0.buylater,A0.added FROM orderitem A0 WHERE (mid > > > = 2 ) AND orderid = 0 > > > > [org.apache.ojb.broker.accesslayer.RsIterator] DEBUG: > > > hasNext() -> > > > > true[org.apache.ojb.broker.accesslayer.RsIterator] DEBUG: > > > > hasNext() -> false > > > > [org.apache.ojb.broker.core.PersistenceBrokerImpl] DEBUG: > > > PB.close > > > > was called: > > [EMAIL PROTECTED] > > 8 > > > > TEST CartItem: [2|0|1|1|false|[2003-10-31 02:50:11.515|2003- > > 10-31 > > > > 02:50:11.515|false]|]WITH OFFER: null > > > > TEST: After ShoppingCartActions.populateMemberShoppingCart() > > > > > > > > > > > > > > > > > > > > > > > > > > > > - Original Message - > > > > From: [EMAIL PROTECTED] > > > > Date: Friday, October 31, 2003 1:56 am > > > > Subject: Another silly newbie mapping que
Re: RE: Another silly newbie mapping question
Thank you Robert, but Offers are permanent pieces of information in the database whereas OrderItems come and go. The site holds numerous Offers which are stored permanently in the database. The customer has a shopping cart which is basically an OrderItem based on those Offers. So when I get an OrderItem from the database I just wanted to also be able to pull the associated Offer though I would never want Offer to change. I have looked in the ojb's repository_junit.xml test cases which have always helped me in the past, but i think I am just missing something. The Collection of OrderItems pull, but not these attached Offer objects. I have verified the database, etc. The messages don't seem to show it even attempting to pull the Offer. I have a similar reference for Member and Location that is working so it is confusing to me. Thank you for any ideas as I am about plum out of them. JohnE - Original Message - From: Robert J Celestino <[EMAIL PROTECTED]> Date: Friday, October 31, 2003 10:11 am Subject: RE: Another silly newbie mapping question > Hello John, > > I think you want auto-update="true" instead of "false" here: > > > > > > > >name="offer" > > > >class-ref="com.jobbank.jobbank.model.offer.OfferVO" > > > >auto-retrieve="true" > > > >auto-update="false" > > > >auto-delete="false"> > > > > > > > > > > my thinking is that when you store the OrderItem the Offer is not > writen bacause auto-update is false. Then when reading the > OrderItem back out, the Offer is not there. > > Bob c > > > > Bob Celestino > SAS Research and Development > 919 - 531 - 9425 > [EMAIL PROTECTED] > > SAS - The Power to Know > > > > -Original Message- > > From: [EMAIL PROTECTED] [EMAIL PROTECTED] > > Sent: Friday, October 31, 2003 5:01 AM > > To: OJB Users List > > Subject: Re: Another silly newbie mapping question > > > > > > I give up for the night. BTW I am using Release Candidate 2. > > > > Not sure it matters, but I am using > > PersistentFieldClass=org.apache.ojb.broker.metadata.fieldacc > > ess.PersistentNestedFieldMaxPerformanceImpl so that I could > > use '->' Single Table Aggregation as it wasn't implemented > > in the default implementation. > > > > From the archives it seemed ok to map multiple primary keys > > to one primary key. > > > > > > - Original Message - > > From: [EMAIL PROTECTED] > > Date: Friday, October 31, 2003 2:49 am > > Subject: Re: Another silly newbie mapping question > > > > > Still no luck. I noticed that my primary key order might have > > > something to do with it so I switched the order within the > > > OrderItemVO mapping, but it didn't seem to help. I > > realized that > > > based on the logging that OJB does not seem to even be > trying to > > > materialize the OfferVO object as no notice is printed about > it > > > trying. Here is my logging: > > > > > > > > > [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: > > > executeQuery : Query from class > > > com.jobbank.jobbank.model.order.OrderItemVO where > > > > > [EMAIL PROTECTED] > > oker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: > > SQL:SELECT A0.modified,A0.offerid,A0.disabled,A0.mid,A0.offerq > > > uantity,A0.orderid,A0.buylater,A0.added FROM orderitem A0 > WHERE > > > (mid = ? ) AND orderid = ? > > > [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: > > > executeQuery: [EMAIL PROTECTED]: > SELECT > > > > > A0.modified,A0.offerid,A0.disabled,A0.mid,A0.offerquantity,A > > 0.orderid,A0.buylater,A0.added FROM orderitem A0 WHERE (mid > > = 2 ) AND orderid = 0 > > > [org.apache.ojb.broker.accesslayer.RsIterator] DEBUG: > > hasNext() -> > > > true[org.apache.ojb.broker.accesslayer.RsIterator] DEBUG: > > > hasNext() -> false > > > [org.apache.ojb.broker.core.PersistenceBrokerImpl] DEBUG: > > PB.close > > > was called: > [EMAIL PROTECTED] > > 8 > > > TEST CartItem: [2|0|1|1|false|[2003-10-31 02:50:11.515|2003- > 10-31 > > > 02:50:11.515|false]|]WITH OFFER: null > > > TEST: After ShoppingCartActions.populateMemberShoppingCart() > > > > > > > > > > > > > > > > > > > > > - Original Message - > > > From: [EMAIL PROTECTED] > > > Date: Friday, October 31, 2003 1:56 am > > > Subject: Another silly newbie mapping question > > > > > > > > > > > I have worked out much harder mapping problems then this, but > > > for > > > > some reason I am still a bit new on this stuff and making no > > > > headway. I would appreciate a more seasoned glance. > > > > > > > > Problem: OfferVO is not being materialized after succesfully > > > > retrieving the Collection of OrderItemVO by using > > > > getCollectionByQuery(query). Each OrderItemVO should have > > > exactly > > > > one Of
Re: Another silly newbie mapping question
I give up for the night. BTW I am using Release Candidate 2. Not sure it matters, but I am using PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentNestedFieldMaxPerformanceImpl so that I could use '->' Single Table Aggregation as it wasn't implemented in the default implementation. >From the archives it seemed ok to map multiple primary keys to one primary key. - Original Message - From: [EMAIL PROTECTED] Date: Friday, October 31, 2003 2:49 am Subject: Re: Another silly newbie mapping question > Still no luck. I noticed that my primary key order might have > something to do with it so I switched the order within the > OrderItemVO mapping, but it didn't seem to help. I realized that > based on the logging that OJB does not seem to even be trying to > materialize the OfferVO object as no notice is printed about it > trying. Here is my logging: > > > [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: > executeQuery : Query from class > com.jobbank.jobbank.model.order.OrderItemVO where > [EMAIL PROTECTED] DEBUG: SQL:SELECT > A0.modified,A0.offerid,A0.disabled,A0.mid,A0.offerq > uantity,A0.orderid,A0.buylater,A0.added FROM orderitem A0 WHERE > (mid = ? ) AND orderid = ? > [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: > executeQuery: [EMAIL PROTECTED]: SELECT > A0.modified,A0.offerid,A0.disabled,A0.mid,A0.offerquantity,A0.orderid,A0.buylater,A0.added > FROM orderitem A0 WHERE (mid = 2 ) AND orderid = 0 > [org.apache.ojb.broker.accesslayer.RsIterator] DEBUG: hasNext() -> > true[org.apache.ojb.broker.accesslayer.RsIterator] DEBUG: > hasNext() -> false > [org.apache.ojb.broker.core.PersistenceBrokerImpl] DEBUG: PB.close > was called: [EMAIL PROTECTED] > 8 > TEST CartItem: [2|0|1|1|false|[2003-10-31 02:50:11.515|2003-10-31 > 02:50:11.515|false]|]WITH OFFER: null > TEST: After ShoppingCartActions.populateMemberShoppingCart() > > > > > > > - Original Message - > From: [EMAIL PROTECTED] > Date: Friday, October 31, 2003 1:56 am > Subject: Another silly newbie mapping question > > > > > I have worked out much harder mapping problems then this, but > for > > some reason I am still a bit new on this stuff and making no > > headway. I would appreciate a more seasoned glance. > > > > Problem: OfferVO is not being materialized after succesfully > > retrieving the Collection of OrderItemVO by using > > getCollectionByQuery(query). Each OrderItemVO should have > exactly > > one OfferVO, but the reference to the OfferVO only returns null. > > > > > > > > > > > class="com.jobbank.jobbank.model.order.OrderItemVO" > table="orderitem">> >name="memberId" > >column="mid" > >jdbc-type="INTEGER" > >primarykey="true" > >/> > > >name="orderId" > >column="orderid" > >jdbc-type="INTEGER" > >primarykey="true" > >/> > > >name="offerId" > >column="offerid" > >jdbc-type="INTEGER" > >primarykey="true" > >/> > > >name="offer" > >class-ref="com.jobbank.jobbank.model.offer.OfferVO" > >auto-retrieve="true" > >auto-update="false" > >auto-delete="false"> > > > > > > > > > > > > > > > > > > class="com.jobbank.jobbank.model.offer.OfferVO" > > table="offer" auto-retrieve="true" auto- > > update="false" auto-delete="false"> > > >name="offerId" > >column="offerid" > >jdbc-type="INTEGER" > >primarykey="true" > >/> > > >name="name" > >column="name" > >jdbc-type="VARCHAR" > >/> > > >name="offerPrice" > >column="offerprice" > >jdbc-type="DOUBLE" > >/> > > >name="offeredProducts" > >element-class- > > ref="com.jobbank.jobbank.model.offer.OfferedProductVO" > > > proxy="true"> > > > > > > > > > > Thank you muchly, > > > > JohnE > > > > > > > > - > -- > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > --- > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Another silly newbie mapping question
Still no luck. I noticed that my primary key order might have something to do with it so I switched the order within the OrderItemVO mapping, but it didn't seem to help. I realized that based on the logging that OJB does not seem to even be trying to materialize the OfferVO object as no notice is printed about it trying. Here is my logging: [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeQuery : Query from class com.jobbank.jobbank.model.order.OrderItemVO where [EMAIL PROTECTED] [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.modified,A0.offerid,A0.disabled,A0.mid,A0.offerq uantity,A0.orderid,A0.buylater,A0.added FROM orderitem A0 WHERE (mid = ? ) AND orderid = ? [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeQuery: [EMAIL PROTECTED]: SELECT A0.modified, A0.offerid,A0.disabled,A0.mid,A0.offerquantity,A0.orderid,A0.buylater,A0.added FROM orderitem A0 WHERE (mid = 2 ) AND orderid = 0 [org.apache.ojb.broker.accesslayer.RsIterator] DEBUG: hasNext() -> true [org.apache.ojb.broker.accesslayer.RsIterator] DEBUG: hasNext() -> false [org.apache.ojb.broker.core.PersistenceBrokerImpl] DEBUG: PB.close was called: [EMAIL PROTECTED] 8 TEST CartItem: [2|0|1|1|false|[2003-10-31 02:50:11.515|2003-10-31 02:50:11.515|false]|] WITH OFFER: null TEST: After ShoppingCartActions.populateMemberShoppingCart() - Original Message - From: [EMAIL PROTECTED] Date: Friday, October 31, 2003 1:56 am Subject: Another silly newbie mapping question > > I have worked out much harder mapping problems then this, but for > some reason I am still a bit new on this stuff and making no > headway. I would appreciate a more seasoned glance. > > Problem: OfferVO is not being materialized after succesfully > retrieving the Collection of OrderItemVO by using > getCollectionByQuery(query). Each OrderItemVO should have exactly > one OfferVO, but the reference to the OfferVO only returns null. > > > > > class="com.jobbank.jobbank.model.order.OrderItemVO" table="orderitem"> >name="memberId" >column="mid" >jdbc-type="INTEGER" >primarykey="true" >/> >name="orderId" >column="orderid" >jdbc-type="INTEGER" >primarykey="true" >/> >name="offerId" >column="offerid" >jdbc-type="INTEGER" >primarykey="true" >/> >name="offer" >class-ref="com.jobbank.jobbank.model.offer.OfferVO" >auto-retrieve="true" >auto-update="false" >auto-delete="false"> > > > > > > > > > table="offer" auto-retrieve="true" auto- > update="false" auto-delete="false"> >name="offerId" >column="offerid" >jdbc-type="INTEGER" >primarykey="true" >/> >name="name" >column="name" >jdbc-type="VARCHAR" >/> >name="offerPrice" >column="offerprice" >jdbc-type="DOUBLE" >/> >name="offeredProducts" >element-class- > ref="com.jobbank.jobbank.model.offer.OfferedProductVO" > proxy="true"> > > > > > Thank you muchly, > > JohnE > > > > --- > -- > 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]
Another silly newbie mapping question
I have worked out much harder mapping problems then this, but for some reason I am still a bit new on this stuff and making no headway. I would appreciate a more seasoned glance. Problem: OfferVO is not being materialized after succesfully retrieving the Collection of OrderItemVO by using getCollectionByQuery(query). Each OrderItemVO should have exactly one OfferVO, but the reference to the OfferVO only returns null. Thank you muchly, JohnE - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Foreign Key column not getting updated
This is exactly the question I had posted below on "subobjects." I think I am missing an understanding, but when I populated the subobject first, it placed the id into the database. Otherwise I got within tracing: [org.apache.ojb.broker.core.PersistenceBrokerImpl] INFO: Cascade store for this reference (RegionVO) was set to false. JohnE - Original Message - From: Jason McKerr <[EMAIL PROTECTED]> Date: Wednesday, June 25, 2003 12:20 pm Subject: Foreign Key column not getting updated > Hey guys, > > I'm having a problem with a nullable foreign-key column not getting > updated. > > I've got a table (Acknowledgements) that has a foreign key to the > Project table. > > Now if I have all of the columns set for acknowledgements (including > projectID) all of the columns except projectID are getting set > when I > call store(). The projectID is getting set to null. > > If I comment out the reference call to Project from the > Acknowledgementtable in my repository, the column gets set normally. > > So the question is: Can I not just do an insert without a complete > object reference? I'm doing a lot of this over serialized XML so it's > not cool to have to pass an object graph just to do an isnert on a > minorrelated table. > > Jason > > > > > --- > -- > 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]
sub objects and a question on storing
Hey all, I am new to object relational bridges and I am trying to accomplish a fairly complex site. I have gotten pretty far I think looking through the demos and reading the a archives. Bows especially to Thomas for the helping hand he has given people for quite some time. Anyway, onto my two main questions. Question One: I am using PersistentNestedFieldMaxPerformanceImpl so that I can use "->" in the repository for nested objects. Are there plans to incorporate this in with other PersistentField Attribute implementations? Is the only difference between PersistentNestedFieldMaxPerformanceImpl and the default implementation that it accesses fields directly? Question Two: I have looked through the demos, but I am missing a piece of understanding about bridges. I have a simple reference-descriptor in my repository file as shown in the code below. I was trying to load a region based on a region id. I could not figure out how to auto-load a new RegionVO if regionId alone changed or was about to be inserted. This was "ok" as I knew I could manually load the new RegionVO object using a DAO. But here is the problem I was having: I would try to insert the LocationVO object before retrieving the RegionVO object. Instead of just inserting the populated regionId into the database, it would insert try to insert null and would null out the regionId during store().When I got the RegionVO first manually and populated it, regionId would be stored correctly. Why did I have to get the RegionVO first? The debug message I got about the field is just below: "[org.apache.ojb.broker.core.PersistenceBrokerImpl] INFO: Cascade store for this reference (RegionVO) was set to false." Thanks for your wisdom!!! JohnE - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]