Transactions with MySQL using non-transaction-capable tables
Hi does OJB manage transaction itself or is the transaction-layer from mysql (i.e. mysql innodb-tables) used? joerg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to use Transactions using ODMB but no OQL (PB instead)
Have a look at the FAQ, Section I don't like OQL, can I use the PersistenceBroker Queries within ODMG? code snippet is provided! -Original Message- From: Joerg Lensing [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 19, 2003 11:02 AM To: OJB Users List Subject: How to use Transactions using ODMB but no OQL (PB instead) hi, i want to use the transactioncapabilities from odmg, but queries should be constructed with the PersistenceBroker (easier to use - better performance). How can i do this? short examples welcome joerg - 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]
Persistence brokers and threads..(again)
Hi I asked this question a couple of days ago. Up to now I have been managing my own persistence broker/thread mapping; I noticed that there is a persitence broker thread mapping class in the distribution for RC1. From looking at the code I cant see how the roker/thread mapping works as the only reference to a persistence broker thread mapping is in PersistenceBrokerThreadMapping class, which is used in the PersistenceBrokerFactoryDefaultImpl class but only in the methods activateObject/passivateObject which is not called in any other code in the distribution. Questions are: - am I mistaken... - if so, does this all happen by default - or, should I still perform my own thread/broker management. Regards Mark Rowell Mark Rowell CreditTrade T: +44 (020) 7400 5078 M: mailto:[EMAIL PROTECTED] CreditTrade Limited is regulated by the FSA. (c) CreditTrade 2002. All rights reserved. The information and data contained in this email is provided for the information purposes of the addressee only and should not be reproduced and/or distributed to any other person. It is provided without any warranty whatsoever and unless stated otherwise consists purely of indicative market prices and other information. Any opinion or comments expressed or assumption made in association with the data or information provided in this email is a reflection of CreditTrades judgement at the time of compiling the data and is subject to change. CreditTrade hereby makes no representation and accepts no responsibility or liability as to the completeness or accuracy of this email. The content of this email is not intended as an offer or solicitation for, or recommendation of, the purchase or sale of any financial instrument, or as an official confirmation of any transaction, and should not be construed as investment advice. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem with the cache on OJB
Hello, I've got a problem with OJB's cache. In my program, I make two requests in SQL. I retrieve the two requests in the spy.log : select A.* from A, B WHERE A.column = B.COLUMN and A.etat = 'V' select A.* from A, B WHERE A.column = B.COLUMN and A.etat = 'E' The beans I retrieve are exactly the same (they have the same 'etat' which is 'V' in my example). My question is that I want to empty the cache between the calls of the two requests. How can I do this ? PS : I don't want to change 'ObjectCacheDefaultImpl' by 'ObjectCacheEmptyImpl' in my OJB.properties for the Object cache because I will have many problems with it for making joints. In fact, when I use this class, my problem is solved but I've got my joint which take a lot of time (it jumps from 0.8 sec to 6 sec), that's why I want to do this in my program. Olivier Hennebelle mail : [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to send a real SQL query to OJB
Hi Sylvain, see FAQ http://db.apache.org/ojb/faq.html topic Is it possible to perform my own sql-queries in OJB? + Can I directly obtain a java.sql.Connection within OJB? regards, Armin - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 19, 2003 4:05 PM Subject: how to send a real SQL query to OJB Hello, I have a String variable which contains a real SQL query like this: SELECT distinct(workstationName) FROM Workstation w, WntWorkstation t, Package p, Package_Workstation r WHERE (w.workstationName like '%' or w.workstationName is NULL) order by w.workstationName How can I send this query (as written above) to OJB? Thanks Sylvain - 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: addGreaterOrEqual
hi ismail, please post the sql. jakob Ismail Siddiqui wrote: Hey can some one tell me what is wrong with the following c.addGreaterOrEqualThan(initial_limit,new Integer(score)); c.addLessOrEqualThan(final_limit,new Integer(score)); QueryByCriteria query = new QueryByCriteria(Quizscore.class, c); Quizscore q = (Quizscore)broker.getObjectByQuery(query); broker.commitTransaction(); return q; its returning me a null object although I know the score I am passing exists in valid range. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OJB criteria fails with Oracle char field right filled with spaces
Hi Jakob, Thank you very much for your help. It worked. I did not know I could use trim right there. Any pointer to the OBJ documentation where I can read more about this? Best Regards, Gustavo. Jakob Braeuchi [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] .ch cc: Subject: Re: OJB criteria fails with Oracle char field right filled 19/03/2003with spaces 13:30 Please respond to OJB Users List hi gustavo, why can't you use trim or an equivalent oracle-function to get rid of the spaces ? mycrit.addEqualTo(trim(firstName), Gustavo); hth jakob [EMAIL PROTECTED] wrote: Hi all, We are using OJB, Oracle 9i. When trying to retrieve an object by criteria, OJB is not finding the requested object since the CHAR fields are right filled with spaces. Just an example: oracle table emp field name: FIRST_NAME(CHAR10) object Emp, attribute firstName Object/Record to to retrieve should have firstName = Gustavo (this was stored using OJB; Oracle fills with spaces to the right of the user inserted string in a CHAR field) This will work: OJB will return the object if criteria sets emp.firstName to Gustavo(note the 3 spaces at the right): Criteria mycrit = new Criteria(); mycrit.addEqualTo(firstName, Gustavo ); Query myquery = new QueryByCriteria(emp.class, mycrit); myemp= (Emp)broker.getObjectByQuery(myquery); This will not work: OJB will fail to return the object if criteria is set to emp.firstName = Gustavo (no spaces). Criteria mycrit = new Criteria(); mycrit.addEqualTo(firstName, Gustavo); Query myquery = new QueryByCriteria(emp.class, mycrit); myemp= (Emp)broker.getObjectByQuery(myquery); Problem here is that the java coder has to know the database field lenght in order to fill the string with the right number of spaces. It´s our understanding that OJB should take care of the the object.attribute == RDBMS mapping without requiring the programmer to take care of things like this. We´ve tested setting criteria to SQL string and it works, but again, this approach requires us to wire some database specific things like field names to our java code. Criteria mycrit = new Criteria(); crit.addSql(FIRST_NAME = 'Gustavo'); Query query = new QueryByCriteria(Usuario.class, crit); myemp = (Emp) broker.getObjectByQuery(query); Are we missing something here? Any ideas? Thanks in advance Gustavo Faerman Buenos Aires, Argentina. - 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: performance
So would over 2 minutes be considered acceptable/normal for OJB then? |-Original Message- |From: Ebersole, Steven [mailto:[EMAIL PROTECTED] |Sent: Tuesday, March 18, 2003 10:28 AM |To: 'OJB Users List' |Subject: RE: performance | | |I did I little more troubleshooting (hacking) and found |that, at least in |part, the problem is caused by the Contact's reference to |the Person class |and Company class. If I proxy those references or remove |them, the load |time goes from 2 minutes 5 seconds down to 30 seconds for |the company with |1524 employees. | |The problem with proxying the Person reference is that |there is never a time |when I would need the Contact without their name, which is |kept on the |PERSON table mapping to the Person class. | |Basically the concept I am trying to model here is a |person's relationship |to a company. Ideally, the Contact class would simply be |a sub-class of |Person with the company relation information on that |Contact concrete |subclass. Yet from what I have read OJB does not support |subclassing across |tables, aside from indirectly as I have modeled it. Is |there a better way |to map this relationship using OJB? Or maybe a way to |force OJB to perform |an outer join here since it is a single association going |from the Contact |to the Person? Maybe a custom RowReader impl? | |I also verified (as I think Cristian was trying to imply) |that the queries |themselves are pretty quick, at least through Oracle's sqlplus. | | |Anyway, any help would be great. | | | |-Original Message- |From: Malinescu, Cristian [mailto:[EMAIL PROTECTED] |Sent: Tuesday, March 18, 2003 8:43 AM |To: 'OJB Users List' |Subject: RE: performance | | |Hi, surprising how much similarity, we are doing also some CRM |and we used some commercial appsrv( like t3://myserver:7001 ;-) ) |till we become very piss off because of entity ejb performance |and now we will migrate to tomcat and ojb ( currently |4.1.18/1.0rc1 ) |and our performance test are till now very satisfactory ... |Regards, |Cristian | |-Original Message- |From: Ebersole, Steven [mailto:[EMAIL PROTECTED] |Sent: Dienstag, 18. März 2003 15:30 |To: 'OJB Users List' |Subject: RE: performance | | |Thanks for the response. | |First the database schema is completely normalized. And |unfortunately I |cant work with just 15 tables; this is the begining of a |CRM app and phase |one alone has over 300 tables. All PK and FK are also set |up as indexes. |Not that it (should) matter much, but we also use Oracle 8i. | |As for the source code, this is just a simple test class |(code below) and as |such, there is only one PB instance. This is not yet even |incurring the |overhead of the EJB calls. | | |public class TestCompanyMappings |{ |private static final Logger log = Logger.getRootLogger(); | |public TestCompanyMappings() |{ |System.setProperty( OJB.properties, |properties/OJB.properties |); |System.setProperty( Context.PROVIDER_URL, |t3://myserver:7001 ); |System.setProperty( Context.INITIAL_CONTEXT_FACTORY, |weblogic.jndi.WLInitialContextFactory ); |} | |public static void main( String[] args ) |{ |TestCompanyMappings me = new TestCompanyMappings(); |me.execute(); |} | |private void execute() |{ |PersistenceBroker broker = null; |Criteria crit = null; |crit = new Criteria(); |crit.addEqualTo( id, new Integer(1) ); |Query query = new QueryByCriteria( Company.class, crit ); | |try |{ |broker = |PersistenceBrokerFactory.defaultPersistenceBroker(); |log.debug( Starting query ); |java.util.Collection extent = |broker.getCollectionByQuery( query |); |log.debug( Done query; iterating ); |java.util.Iterator iter = extent.iterator(); |while (iter.hasNext()) |{ |display( (Company)iter.next() ); |} |log.debug( Done iterating ); |} |catch( Throwable t ) |{ |log.error( Error occurred, t ); |} |finally |{ |if (broker != null) |{ |try |{ |broker.close(); |} |catch( Throwable t ) |{} |
m:n Question
I've got an m:n association that's causing me a problem. Let's say I have two Java classes, A and B, that have underlying database tables and an m:n association between them. Both A and B have members of type java.util.Collection that maintain references to the other. I have a constructor for A that allows me to create an empty collection of B references. When I test creating and storing an instance of class A with an empty collection of B references OJB throws a java.util.NoSuchElementException: Thrown by the nextElement method of an Enumeration to indicate that there are no more elements in the enumeration. Does OJB not allow me to persist an instance of class A which has no references to class B, or have I made another newbie mistake? Thank you. - MOD __ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: performance
I would love to. Unfortunately the system architect for this project refuses to budge on these types of issues. Phase one of this project has been in production for just about a year (plus a lot of imported data) and there are exactly zero occurences where a person is mapped to more than one company in the system, but he refuses to concede this point. Thats where my frustration is and sorry if it came across as frustration towards anyone on this list. But if a hear the word flexible one more time in relation to DB schema design I am going to scream ;-) At any rate, no it is not possible to merge this data. The thing that confuses me is that running this in sqlplus (manually opening a cursor over the 1524 employee records and iterating over them in a loop while loading there associated person record inside the loop) takes no time at all (like .4 seconds). Of course that all happens server-side. So to try to add more load, I added output statements inside the loop (which Oracle can't handle really well), but the looping still just took around 4 seconds. I have been pushing OJB over our current O/R tool (Castor) for the last year, and have finally gotten the go ahead to migrate to something other than Castor. But it will be hard to justify when loading (what seems like) simple object graphs takes this long. I'll have a further look at the RowReader usage to see how it might best be used. -Original Message- From: Matthew Baird [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 19, 2003 3:52 PM To: OJB Users List Subject: RE: performance I can sense your frustration that your question was not answered in the time frame you had hoped. the answer would be no this is neither normal or acceptable. I believe there was some work done to support subclassing across tables, and I will look into that. You could use a fast mapping that just brings the name into the object world vs a big complex object. A custom rowreader could probably also do this. there is no way you can put both the person and contact mapped to one table? I know that works nicely and is quick. cheers, Matthew -Original Message- From: Ebersole, Steven [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 19, 2003 10:52 AM To: 'OJB Users List' Subject: RE: performance So would over 2 minutes be considered acceptable/normal for OJB then? |-Original Message- |From: Ebersole, Steven [mailto:[EMAIL PROTECTED] |Sent: Tuesday, March 18, 2003 10:28 AM |To: 'OJB Users List' |Subject: RE: performance | | |I did I little more troubleshooting (hacking) and found |that, at least in |part, the problem is caused by the Contact's reference to |the Person class |and Company class. If I proxy those references or remove |them, the load |time goes from 2 minutes 5 seconds down to 30 seconds for |the company with |1524 employees. | |The problem with proxying the Person reference is that |there is never a time |when I would need the Contact without their name, which is |kept on the |PERSON table mapping to the Person class. | |Basically the concept I am trying to model here is a |person's relationship |to a company. Ideally, the Contact class would simply be |a sub-class of |Person with the company relation information on that |Contact concrete |subclass. Yet from what I have read OJB does not support |subclassing across |tables, aside from indirectly as I have modeled it. Is |there a better way |to map this relationship using OJB? Or maybe a way to |force OJB to perform |an outer join here since it is a single association going |from the Contact |to the Person? Maybe a custom RowReader impl? | |I also verified (as I think Cristian was trying to imply) |that the queries |themselves are pretty quick, at least through Oracle's sqlplus. | | |Anyway, any help would be great. | | | |-Original Message- |From: Malinescu, Cristian [mailto:[EMAIL PROTECTED] |Sent: Tuesday, March 18, 2003 8:43 AM |To: 'OJB Users List' |Subject: RE: performance | | |Hi, surprising how much similarity, we are doing also some CRM |and we used some commercial appsrv( like t3://myserver:7001 ;-) ) |till we become very piss off because of entity ejb performance |and now we will migrate to tomcat and ojb ( currently |4.1.18/1.0rc1 ) |and our performance test are till now very satisfactory ... |Regards, |Cristian | |-Original Message- |From: Ebersole, Steven [mailto:[EMAIL PROTECTED] |Sent: Dienstag, 18. März 2003 15:30 |To: 'OJB Users List' |Subject: RE: performance | | |Thanks for the response. | |First the database schema is completely normalized. And |unfortunately I |cant work with just 15 tables; this is the begining of a
0.9.8 - 1.0 upgrade issue - Instantiating of current set RowReaderfailed
This exception is occurring on a PersistenceBrokerFactory.defaultPersistenceBroker() Has there been some change to the way the default row-reader should be specified? It looks like there is no matching constructor wherever the default RowReader one is supposed to be. Useful bits of the stack trace follow: Could not read repository class descriptor data, using repository: repository.xml: Instantiating of current set RowReader failed java.lang.NoSuchMethodException at java.lang.Class.getConstructor0(Class.java:1755) at java.lang.Class.getConstructor(Class.java:990) at org.apache.ojb.broker.util.ClassHelper.newInstance(Unknown Source) at org.apache.ojb.broker.util.ClassHelper.newInstance(Unknown Source) at org.apache.ojb.broker.util.ClassHelper.newInstance(Unknown Source) at org.apache.ojb.broker.metadata.ClassDescriptor.setRowReader(Unknown Source) at org.apache.ojb.broker.metadata.RepositoryXmlHandler.startElement(Unknown Source) rethrown as org.apache.ojb.broker.metadata.MetadataException: Instantiating of current set RowReader failed at org.apache.ojb.broker.metadata.ClassDescriptor.setRowReader(Unknown Source) at org.apache.ojb.broker.metadata.RepositoryXmlHandler.startElement(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:454) -- --- Gareth Cronin Analyst/Programmer Kiwiplan NZ Ltd www.kiwiplan.com Ph 2727622 x854 --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Query on composite pattern
Hi Jakob, b. IMHO this solution is not good because you don't know which a extent class to choose. What if name of a descriptor is the same for many extent? a. IMHO this is solution. I think that a path could use a cast operator like in OQL. For 2 case it could be: // (TestSuite)test.(TestCase)test.caseName crit.addEqualTo( (+TestSuite.class.getName()+)test.(+TestCase.class.getName()+)test.caseName, test 3); but it is not readable for me so may be like this: crit.addEqualTo(($1)test.($2)test.caseName, test 3); crit.addPathClass (TestSuite.class); crit.addPathClass (TestCase.class); ??? regards, Dariusz Kies --- Jakob Braeuchi [EMAIL PROTECTED] wrote: hi dariusz, i'm thinking of the following solution to this problem: a.) pass the hints to getAttributeDescriptorsForPath b.) in getAttributeDescriptorsForPath i'd like to scan the extents if a descriptor can't be found in the class. what do you think ? jakob Dariusz Kies wrote: Hi, Here is the sql for 3: [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL: SELECT A0.ID,A0.ID_TEST FROM FI.T_FOO A0,FI.T_TEST_SUITE A1 WHERE A0.ID_TEST=A1.ID AND (caseName = ? ) Notice that there isn't the column name for the caseName attribute and there isn't join with FI.T_TEST_CASE. I debug a little and I found that a problem is in the class org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement, method getTableAlias and call descriptors = getRoot().cld.getAttributeDescriptorsForPath(aPath); // line 655 This call return only one element:[EMAIL PROTECTED] delete=false,cascade retrieve=true,cascade store=false,is lazy=false,class of Items=class Test]] It should return three descriptors: TestSuite, TestCase and caseName. Method getAttributeDescriptorsForPath don't consider the addPathClass that's way it can't return the good descriptors. Thanks for help Dariusz Kies --- Jakob Braeuchi [EMAIL PROTECTED] wrote: hi dariusz, what is the problem with sample 3 ? can you pleas post the sql or an error message ? jakob Dariusz Kies wrote: Hi, I have a problem to query on composite pattern in OJB (db-ojb-1.0.rc1). Let's assume that I have Test composite pattern from JUnit in OJB: class-descriptor class=Test ... extent-class class-ref=TestCase / extent-class class-ref=TestSuite / field-descriptor name=id primarykey=true autoincrement=true ... / field-descriptor name=idTest ... / /class-descriptor class-descriptor class=TestCase ... field-descriptor name=id primarykey=true autoincrement=true ... / field-descriptor name=idTest ... / field-descriptor name=caseName jdbc-type=VARCHAR ... / /class-descriptor class-descriptor class=TestSuite ... field-descriptor name=id primarykey=true autoincrement=true ... / field-descriptor name=idTest ... / field-descriptor name=suiteName jdbc-type=VARCHAR ... / collection-descriptor name=test element-class-ref=Test ... inverse-foreignkey field-ref=idTest/ /collection-descriptor /class-descriptor class-descriptor class=Foo ... field-descriptor name=id primarykey=true autoincrement=true ... / field-descriptor name=idTest ... / reference-descriptor name=test class-ref=Test ... foreignkey field-ref=idTest/ /reference-descriptor /class-descriptor 1. This works ok: Criteria crit = new Criteria(); crit.addEqualTo(test.caseName, test 1); Query query = QueryFactory.newQuery(Foo.class, crit); query.addPathClass(test, TestCase.class); Collection results = broker.getCollectionByQuery(query); 2. This don't work: Criteria crit = new Criteria(); crit.addEqualTo(test.test.caseName, test 2); Query query = QueryFactory.newQuery(Foo.class, crit); query.addPathClass(test, TestSuite.class); // first test query.addPathClass(test, TestCase.class); // second test Collection results = broker.getCollectionByQuery(query); 3. Still doesn't work: class-descriptor class=Foo ... field-descriptor name=id primarykey=true autoincrement=true ... / reference-descriptor name=aTest class-ref=Test ... foreignkey field-ref=idTest/ /reference-descriptor /class-descriptor Criteria crit = new Criteria(); crit.addEqualTo(aTest.test.caseName, test 3); Query query = QueryFactory.newQuery(Foo.class, crit); query.addPathClass(aTest, TestSuite.class); query.addPathClass(test, TestCase.class); Collection results = broker.getCollectionByQuery(query); Can I query on composite pattern in OJB? Thanks for help Dariusz Kies __ Do you Yahoo!? Yahoo! Web Hosting - establish your business online http://webhosting.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL
Trouble with 1:n relationships!?...
Greetings all... I'm trying to set up a simple 1:n relationship where object A contains a Vector of object Bs. I've read through the documentation, and as far as I can tell, I've set everything up correctly: - Object A contains a Vector called objectBs (hypothetically). - Object B contains an aId attribute. This is an int. - I've created the two tables in the database... The B table contains a a_id field. This is an INTEGER (I'm using PostgreSQL by the way). I've populated both tables, and have confirmed that the data is, in fact, there (by running the appropriate SQL statements manually). - I've set up repository_user.xml as follows: class-descriptor class=com.foo.A table=A ... !-- Comment -- collection-descriptor... A m:n relationship that is working fine goes here /collection-descriptor !-- Another comment -- collection-descriptor name=objectBs element-class-ref=com.foo.B inverse-foreignkey field-ref=aId/ /collection-descriptor /class-descriptor class-descriptor class=com.foo.B table=B ... field-descriptor id=2 name=aId column=a_id jdbc_type=INTEGER/ ... /class-descriptor Having done this, no B-related data comes back! As I said, if I execute select * from b where a_id = whatever, I get data back. Additionally, the rest of object A comes back fine. I've tried to look through the mailing list archives, but the archives/search capability seems to be down. Any suggestions would be greatly appreciated... My level of frustration is high! Particualrly as I've managed to implement all the multi-level m:n relationships that I need without any problems... Now I'm stuck getting a silly 1:n relationship to work... :-/ Cheers... Davide Bruzzone - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
resetting an object to persistence store state.
What is the best way to reset an object to reflect its persisted state? Yuji Shinozaki Computer Systems Senior Engineer [EMAIL PROTECTED] Advanced Technologies Group (804)924-7171 Information Technology Communication http://www.people.virginia.edu/~ys2nUniversity of Virginia - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how to send a real SQL query to OJB
Hi Armin, I have seen the FAQ. Thanks. But it doesn't work for me. My SQL query is select workstationName from Workstation. From my database query analyzer, this query retrieves 36 rows. In OJB I try: code String sql = select workstationName from Workstation; Query query = QueryFactory.newQuery(Workstation.class, sql); try { broker.beginTransaction(); Collection col = broker.getCollectionByQuery(query); int size = col.size(); System.out.println(size); broker.commitTransaction(); } catch (Throwable t) { broker.abortTransaction(); t.printStackTrace(); } code The problem is that the size of the collection is 0! OJB doesn't retrieve anything! But if I try the query select * from Workstation, it works!! Have you an idea what's the problem? I'm using OJB 0.9.5. Thanks Sylvain -Message d'origine- De: Armin Waibel [mailto:[EMAIL PROTECTED] Date: mercredi, 19. mars 2003 16:12 À: OJB Users List Objet: Re: how to send a real SQL query to OJB Hi Sylvain, see FAQ http://db.apache.org/ojb/faq.html topic Is it possible to perform my own sql-queries in OJB? + Can I directly obtain a java.sql.Connection within OJB? regards, Armin - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 19, 2003 4:05 PM Subject: how to send a real SQL query to OJB Hello, I have a String variable which contains a real SQL query like this: SELECT distinct(workstationName) FROM Workstation w, WntWorkstation t, Package p, Package_Workstation r WHERE (w.workstationName like '%' or w.workstationName is NULL) order by w.workstationName How can I send this query (as written above) to OJB? Thanks Sylvain - 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]