PB error when the browser is stoped
Hello, I'using PB intances to retrieve info from my database. When the time to search information is too long you can press the stop button on the browser. But when I restart my application there is a TransactionNotInProgress exception. Maybe the PB instance isn't closed when I stop the transaction!?? How could I close the PB intansce when I stop the browser? How could I manage this? Is someone has an experience? Thanks Sylvain - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: PB error when the browser is stoped
Hi Sylvain, [EMAIL PROTECTED] wrote: Hello, I'using PB intances to retrieve info from my database. When the time to search information is too long you can press the stop button on the browser. But when I restart my application there is a TransactionNotInProgress exception. Maybe the PB instance isn't closed when I stop the transaction!?? How could I close the PB intansce when I stop the browser? How could I manage this? Is someone has an experience? Can you describe more detailed, some pseudo code? Which version do you use? regards, Armin 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: PB error when the browser is stoped
Hi, [EMAIL PROTECTED] wrote: Hello Armin, I'm using OJB 0.9.5. uuh! a real oldtimer ;-) The code is below. The stop button is pressed during the execution time of this method below. I think that there something wrong because after I press stop and refresh the page, a TransactionNotInProgressException occured. Have you an idea? Thanks Sylvain **code** public void searchPerson(String lastName) { Criteria crit = new Criteria(); crit.addLike(lastName, % + lastName + %); Query query = new QueryByCriteria(Person.class, crit); try { broker is a field in your class? here you get a new instance, what about the previous referenced PB instance? Do multiple threads access class instance? broker = PersistenceBrokerFactory.defaultPersistenceBroker(); recommened to use PersistenceBroker pb = PersistenceBrokerFactory in your methods broker.beginTransaction(); Iterator iter = broker.getIteratorByQuery(query); while (iter.hasNext()) { Person person = (Person) iter.next(); appResps.put(person.getPersonId(), person.getPersonName()); } broker.commitTransaction(); } catch (PersistenceBrokerException t) { broker.abortTransaction(); t.printStackTrace(); } finally { broker.close(); } hmm, I'm not familiar with webserver internals, but think if you press 'stop' on the browser your method will be pass through anyway. StackTrace of the exception on refresh? Caused by 'broker.abortTransaction()'? If yes, I think it's a thread problem. regards, Armin } **code** -Message d'origine- De: Armin Waibel [mailto:[EMAIL PROTECTED] Date: mercredi, 5. novembre 2003 10:22 À: OJB Users List Objet: Re: PB error when the browser is stoped Hi Sylvain, [EMAIL PROTECTED] wrote: Hello, I'using PB intances to retrieve info from my database. When the time to search information is too long you can press the stop button on the browser. But when I restart my application there is a TransactionNotInProgress exception. Maybe the PB instance isn't closed when I stop the transaction!?? How could I close the PB intansce when I stop the browser? How could I manage this? Is someone has an experience? Can you describe more detailed, some pseudo code? Which version do you use? regards, Armin 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: PB error when the browser is stoped
Hi, -Message d'origine- De: Armin Waibel [mailto:[EMAIL PROTECTED] Date: mercredi, 5. novembre 2003 11:46 À: OJB Users List Objet: Re: PB error when the browser is stoped Hi, [EMAIL PROTECTED] wrote: Hello Armin, I'm using OJB 0.9.5. uuh! a real oldtimer ;-) The code is below. The stop button is pressed during the execution time of this method below. I think that there something wrong because after I press stop and refresh the page, a TransactionNotInProgressException occured. Have you an idea? Thanks Sylvain **code** public void searchPerson(String lastName) { Criteria crit = new Criteria(); crit.addLike(lastName, % + lastName + %); Query query = new QueryByCriteria(Person.class, crit); try { broker is a field in your class? Yes it is. here you get a new instance, what about the previous referenced PB instance? Do multiple threads access class instance? What do you mean? Do you mean that if I declare only one class field (broker) I could have threads problems? broker = PersistenceBrokerFactory.defaultPersistenceBroker(); recommened to use PersistenceBroker pb = PersistenceBrokerFactory in your methods broker.beginTransaction(); Iterator iter = broker.getIteratorByQuery(query); while (iter.hasNext()) { Person person = (Person) iter.next(); appResps.put(person.getPersonId(), person.getPersonName()); } broker.commitTransaction(); } catch (PersistenceBrokerException t) { broker.abortTransaction(); t.printStackTrace(); } finally { broker.close(); } hmm, I'm not familiar with webserver internals, but think if you press 'stop' on the browser your method will be pass through anyway. StackTrace of the exception on refresh? Caused by 'broker.abortTransaction()'? If yes, I think it's a thread problem. How could I test it? Regards Sylvain regards, Armin } **code** -Message d'origine- De: Armin Waibel [mailto:[EMAIL PROTECTED] Date: mercredi, 5. novembre 2003 10:22 À: OJB Users List Objet: Re: PB error when the browser is stoped Hi Sylvain, [EMAIL PROTECTED] wrote: Hello, I'using PB intances to retrieve info from my database. When the time to search information is too long you can press the stop button on the browser. But when I restart my application there is a TransactionNotInProgress exception. Maybe the PB instance isn't closed when I stop the transaction!?? How could I close the PB intansce when I stop the browser? How could I manage this? Is someone has an experience? Can you describe more detailed, some pseudo code? Which version do you use? regards, Armin 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] - 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]
Stored Procedure Question ? ( from newbies )
Hello All I'm new to ojb and i'm currently trying to implement the method describe in the HowTo Stored Procedure with Ojb. And i have a few questions First : Is the code for this Howto available somewhere ? Even if i know that the code is a bit specific, i just want to have for validating my own implementation ( on missing method description such as getObjectFromStatement ... ) My second question is -the howto describe a method which is extending the StatementManager , is it possible for avoiding this to use the a StatementFactory which is allocating a CallableStatementForClass is the class has stored procedure or an other ( StatementsForClassImpl ) if the class descriptor hasn't. Instead of registring OutParameters in the StatementManger can we do it in the StatementForClass implementation. Tks Thierry Hanot
Re: PB error when the browser is stoped
Hi again, [EMAIL PROTECTED] wrote: ... here you get a new instance, what about the previous referenced PB instance? Do multiple threads access class instance? What do you mean? Do you mean that if I declare only one class field (broker) I could have threads problems? Exactly! If different threads share/use the same class instance. broker = PersistenceBrokerFactory.defaultPersistenceBroker(); recommened to use PersistenceBroker pb = PersistenceBrokerFactory in your methods broker.beginTransaction(); Iterator iter = broker.getIteratorByQuery(query); while (iter.hasNext()) { Person person = (Person) iter.next(); appResps.put(person.getPersonId(), person.getPersonName()); } broker.commitTransaction(); } catch (PersistenceBrokerException t) { broker.abortTransaction(); t.printStackTrace(); } finally { broker.close(); } hmm, I'm not familiar with webserver internals, but think if you press 'stop' on the browser your method will be pass through anyway. StackTrace of the exception on refresh? Caused by 'broker.abortTransaction()'? If yes, I think it's a thread problem. How could I test it? If the exception really caused by broker.abort in searchPerson(String lastName), don't use the class field broker in your search method recommened to use PersistenceBroker pb = PersistenceBrokerFactory in your methods and repeat your test. regards, Armin Regards Sylvain regards, Armin } **code** -Message d'origine- De: Armin Waibel [mailto:[EMAIL PROTECTED] Date: mercredi, 5. novembre 2003 10:22 À: OJB Users List Objet: Re: PB error when the browser is stoped Hi Sylvain, [EMAIL PROTECTED] wrote: Hello, I'using PB intances to retrieve info from my database. When the time to search information is too long you can press the stop button on the browser. But when I restart my application there is a TransactionNotInProgress exception. Maybe the PB instance isn't closed when I stop the transaction!?? How could I close the PB intansce when I stop the browser? How could I manage this? Is someone has an experience? Can you describe more detailed, some pseudo code? Which version do you use? regards, Armin 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] - 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: PB error when the browser is stoped
Hi again Armin -Message d'origine- De: Armin Waibel [mailto:[EMAIL PROTECTED] Date: mercredi, 5. novembre 2003 12:22 À: OJB Users List Objet: Re: PB error when the browser is stoped Hi again, [EMAIL PROTECTED] wrote: ... here you get a new instance, what about the previous referenced PB instance? Do multiple threads access class instance? What do you mean? Do you mean that if I declare only one class field (broker) I could have threads problems? Exactly! If different threads share/use the same class instance. Just some question to be sure to understand: How could you define a thread in this case? Do you say that all threads use the same class instance? If I declare each time a new PB instance, is this solution thread safe? Thanks Sylvain broker = PersistenceBrokerFactory.defaultPersistenceBroker(); recommened to use PersistenceBroker pb = PersistenceBrokerFactory in your methods broker.beginTransaction(); Iterator iter = broker.getIteratorByQuery(query); while (iter.hasNext()) { Person person = (Person) iter.next(); appResps.put(person.getPersonId(), person.getPersonName()); } broker.commitTransaction(); } catch (PersistenceBrokerException t) { broker.abortTransaction(); t.printStackTrace(); } finally { broker.close(); } hmm, I'm not familiar with webserver internals, but think if you press 'stop' on the browser your method will be pass through anyway. StackTrace of the exception on refresh? Caused by 'broker.abortTransaction()'? If yes, I think it's a thread problem. How could I test it? If the exception really caused by broker.abort in searchPerson(String lastName), don't use the class field broker in your search method recommened to use PersistenceBroker pb = PersistenceBrokerFactory in your methods and repeat your test. regards, Armin Regards Sylvain regards, Armin } **code** -Message d'origine- De: Armin Waibel [mailto:[EMAIL PROTECTED] Date: mercredi, 5. novembre 2003 10:22 À: OJB Users List Objet: Re: PB error when the browser is stoped Hi Sylvain, [EMAIL PROTECTED] wrote: Hello, I'using PB intances to retrieve info from my database. When the time to search information is too long you can press the stop button on the browser. But when I restart my application there is a TransactionNotInProgress exception. Maybe the PB instance isn't closed when I stop the transaction!?? How could I close the PB intansce when I stop the browser? How could I manage this? Is someone has an experience? Can you describe more detailed, some pseudo code? Which version do you use? regards, Armin 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] - 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: PB error when the browser is stoped
Hi Sylvain, snip Just some question to be sure to understand: How could you define a thread in this case? The servlet engine uses parallel WorkerThreads to handle all incoming requests. So you have to make sure that parallel servlet threads don't access the broker variable without proper synchronization. Do you say that all threads use the same class instance? If you mean Class object then yes, If you mean instance of a class then no. If I declare each time a new PB instance, is this solution thread safe? You have to make sure that each thread (also servlet engine threads) always work with their only broker instance and not with a shared instance. The most simple way to achieve this is to use a new PB instance in each call. Of course it's important to close the PB imediately after the unit of work is completed cheers, Thomas Thanks Sylvain broker = PersistenceBrokerFactory.defaultPersistenceBroker(); recommened to use PersistenceBroker pb = PersistenceBrokerFactory in your methods broker.beginTransaction(); Iterator iter = broker.getIteratorByQuery(query); while (iter.hasNext()) { Person person = (Person) iter.next(); appResps.put(person.getPersonId(), person.getPersonName()); } broker.commitTransaction(); } catch (PersistenceBrokerException t) { broker.abortTransaction(); t.printStackTrace(); } finally { broker.close(); } hmm, I'm not familiar with webserver internals, but think if you press 'stop' on the browser your method will be pass through anyway. StackTrace of the exception on refresh? Caused by 'broker.abortTransaction()'? If yes, I think it's a thread problem. How could I test it? If the exception really caused by broker.abort in searchPerson(String lastName), don't use the class field broker in your search method recommened to use PersistenceBroker pb = PersistenceBrokerFactory in your methods and repeat your test. regards, Armin Regards Sylvain regards, Armin } **code** -Message d'origine- De: Armin Waibel [mailto:[EMAIL PROTECTED] Date: mercredi, 5. novembre 2003 10:22 À: OJB Users List Objet: Re: PB error when the browser is stoped Hi Sylvain, [EMAIL PROTECTED] wrote: Hello, I'using PB intances to retrieve info from my database. When the time to search information is too long you can press the stop button on the browser. But when I restart my application there is a TransactionNotInProgress exception. Maybe the PB instance isn't closed when I stop the transaction!?? How could I close the PB intansce when I stop the browser? How could I manage this? Is someone has an experience? Can you describe more detailed, some pseudo code? Which version do you use? regards, Armin 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] - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Stored Procedure Question ? ( from newbies )
Thierry -- Support for using stored procedures for insert, update and delete operations has been incorporated into the 'internals' of the PB api, so there's no longer any need to implement the extensions that are described in the HOWTO Work With Stored Procedures document. I apologize for not getting around to updating the 'how to' documentation to reflect this capability. The repository.dtd file has been updated with some basic information about the various descriptors that you need to include in your repository. Just search on 'procedure' and you'll find all of the relevant information. I'll try to get the 'how to' documentation updated over the next few days. In the meantime, if you have any questions, just post them to the mailing lists and I'll answer them as best I can. Ron Gallagher Atlanta, GA [EMAIL PROTECTED] -Original Message- From: Thierry Hanot [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 05, 2003 6:02 AM To: [EMAIL PROTECTED] Subject: Stored Procedure Question ? ( from newbies ) Hello All I'm new to ojb and i'm currently trying to implement the method describe in the HowTo Stored Procedure with Ojb. And i have a few questions First : Is the code for this Howto available somewhere ? Even if i know that the code is a bit specific, i just want to have for validating my own implementation ( on missing method description such as getObjectFromStatement ... ) My second question is -the howto describe a method which is extending the StatementManager , is it possible for avoiding this to use the a StatementFactory which is allocating a CallableStatementForClass is the class has stored procedure or an other ( StatementsForClassImpl ) if the class descriptor hasn't. Instead of registring OutParameters in the StatementManger can we do it in the StatementForClass implementation. Tks Thierry Hanot - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem on insert
Hi, I have the following problem: I am using the PB API and I want to ensure that when an object is stored in base, it is not possible to insert it twice (ie to insert an object with the same PK value) Until now, the second insert is in fact an update!! But what I want is an Exception that tells me This object already exists or something like that Thanks Vincent ARBONA Architecte Logiciel Sopra Group Espace Performance 3 Bâtiment P 35760 Saint Grégoire [EMAIL PROTECTED] tel : 02-23-25-25-73 fax : 02-23-25-25-26
RE: PB error when the browser is stoped
Hi Thomas, -Message d'origine- De: Mahler Thomas [mailto:[EMAIL PROTECTED] Date: mercredi, 5. novembre 2003 14:17 À: 'OJB Users List' Objet: RE: PB error when the browser is stoped Hi Sylvain, snip Just some question to be sure to understand: How could you define a thread in this case? The servlet engine uses parallel WorkerThreads to handle all incoming requests. So you have to make sure that parallel servlet threads don't access the broker variable without proper synchronization. How could I be sure? How do you mean about proper synchronization? Do you say that all threads use the same class instance? If you mean Class object then yes, If you mean instance of a class then no. I don't understand what you mean? What's the difference between a Class object and an instance of a Class? If I declare each time a new PB instance, is this solution thread safe? You have to make sure that each thread (also servlet engine threads) always work with their only broker instance and not with a shared instance. The most simple way to achieve this is to use a new PB instance in each call. OK. You declare eache time a new PB instance like: PersistenceBroker pb = PersistenceBrokerFactory Thanks Sylvain Of course it's important to close the PB imediately after the unit of work is completed cheers, Thomas Thanks Sylvain broker = PersistenceBrokerFactory.defaultPersistenceBroker(); recommened to use PersistenceBroker pb = PersistenceBrokerFactory in your methods broker.beginTransaction(); Iterator iter = broker.getIteratorByQuery(query); while (iter.hasNext()) { Person person = (Person) iter.next(); appResps.put(person.getPersonId(), person.getPersonName()); } broker.commitTransaction(); } catch (PersistenceBrokerException t) { broker.abortTransaction(); t.printStackTrace(); } finally { broker.close(); } hmm, I'm not familiar with webserver internals, but think if you press 'stop' on the browser your method will be pass through anyway. StackTrace of the exception on refresh? Caused by 'broker.abortTransaction()'? If yes, I think it's a thread problem. How could I test it? If the exception really caused by broker.abort in searchPerson(String lastName), don't use the class field broker in your search method recommened to use PersistenceBroker pb = PersistenceBrokerFactory in your methods and repeat your test. regards, Armin Regards Sylvain regards, Armin } **code** -Message d'origine- De: Armin Waibel [mailto:[EMAIL PROTECTED] Date: mercredi, 5. novembre 2003 10:22 À: OJB Users List Objet: Re: PB error when the browser is stoped Hi Sylvain, [EMAIL PROTECTED] wrote: Hello, I'using PB intances to retrieve info from my database. When the time to search information is too long you can press the stop button on the browser. But when I restart my application there is a TransactionNotInProgress exception. Maybe the PB instance isn't closed when I stop the transaction!?? How could I close the PB intansce when I stop the browser? How could I manage this? Is someone has an experience? Can you describe more detailed, some pseudo code? Which version do you use? regards, Armin 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] - 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
RE: Problem on insert
Vincent -- The PersistenceBroker interface defines two methods for storing an object: public void store(Object) public void store(Object,ObjectModification) If you use the first 'store' method, OJB will run a query against the database to determine if the Object that is being stored already exists. If the record exists, then OJB will update that record. If the record doesn't exist, then OJB will insert a new record. Based on the description of your problem, you're using the first 'store' method. To change this behavior, just use the second method and pass either ObjectModificationDefaultImpl.INSERT or ObjectModificationDefaultImpl.UPDATE as the second argument. Ron Gallagher Atlanta, GA [EMAIL PROTECTED] -Original Message- From: Arbona Vincent [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 05, 2003 8:36 AM To: [EMAIL PROTECTED] Subject: Problem on insert Hi, I have the following problem: I am using the PB API and I want to ensure that when an object is stored in base, it is not possible to insert it twice (ie to insert an object with the same PK value) Until now, the second insert is in fact an update!! But what I want is an Exception that tells me This object already exists or something like that Thanks Vincent ARBONA Architecte Logiciel Sopra Group Espace Performance 3 Bâtiment P 35760 Saint Grégoire [EMAIL PROTECTED] tel : 02-23-25-25-73 fax : 02-23-25-25-26 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Stored Procedure Question ? ( from newbies )
May be I have the wrong version but there is nothing about the procedure in the dtd. ( Not even in the code I think ,there is only Some CallableStatement in SequenceManagerStoredProcedure implementation I think ) My version is the 1.0RC4. May be I need to download a new version from the cvs repository ??? B.R Thierry -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 05, 2003 2:33 PM To: [EMAIL PROTECTED] Subject: RE: Stored Procedure Question ? ( from newbies ) Thierry -- Support for using stored procedures for insert, update and delete operations has been incorporated into the 'internals' of the PB api, so there's no longer any need to implement the extensions that are described in the HOWTO Work With Stored Procedures document. I apologize for not getting around to updating the 'how to' documentation to reflect this capability. The repository.dtd file has been updated with some basic information about the various descriptors that you need to include in your repository. Just search on 'procedure' and you'll find all of the relevant information. I'll try to get the 'how to' documentation updated over the next few days. In the meantime, if you have any questions, just post them to the mailing lists and I'll answer them as best I can. Ron Gallagher Atlanta, GA [EMAIL PROTECTED] -Original Message- From: Thierry Hanot [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 05, 2003 6:02 AM To: [EMAIL PROTECTED] Subject: Stored Procedure Question ? ( from newbies ) Hello All I'm new to ojb and i'm currently trying to implement the method describe in the HowTo Stored Procedure with Ojb. And i have a few questions First : Is the code for this Howto available somewhere ? Even if i know that the code is a bit specific, i just want to have for validating my own implementation ( on missing method description such as getObjectFromStatement ... ) My second question is -the howto describe a method which is extending the StatementManager , is it possible for avoiding this to use the a StatementFactory which is allocating a CallableStatementForClass is the class has stored procedure or an other ( StatementsForClassImpl ) if the class descriptor hasn't. Instead of registring OutParameters in the StatementManger can we do it in the StatementForClass implementation. Tks Thierry Hanot - 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: Stored Procedure Question ? ( from newbies )
Yes, I think you may need the CVS version for this. -Original Message- From: Thierry Hanot [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 05, 2003 8:04 AM To: 'OJB Users List' Subject: RE: Stored Procedure Question ? ( from newbies ) May be I have the wrong version but there is nothing about the procedure in the dtd. ( Not even in the code I think ,there is only Some CallableStatement in SequenceManagerStoredProcedure implementation I think ) My version is the 1.0RC4. May be I need to download a new version from the cvs repository ??? B.R Thierry -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 05, 2003 2:33 PM To: [EMAIL PROTECTED] Subject: RE: Stored Procedure Question ? ( from newbies ) Thierry -- Support for using stored procedures for insert, update and delete operations has been incorporated into the 'internals' of the PB api, so there's no longer any need to implement the extensions that are described in the HOWTO Work With Stored Procedures document. I apologize for not getting around to updating the 'how to' documentation to reflect this capability. The repository.dtd file has been updated with some basic information about the various descriptors that you need to include in your repository. Just search on 'procedure' and you'll find all of the relevant information. I'll try to get the 'how to' documentation updated over the next few days. In the meantime, if you have any questions, just post them to the mailing lists and I'll answer them as best I can. Ron Gallagher Atlanta, GA [EMAIL PROTECTED] -Original Message- From: Thierry Hanot [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 05, 2003 6:02 AM To: [EMAIL PROTECTED] Subject: Stored Procedure Question ? ( from newbies ) Hello All I'm new to ojb and i'm currently trying to implement the method describe in the HowTo Stored Procedure with Ojb. And i have a few questions First : Is the code for this Howto available somewhere ? Even if i know that the code is a bit specific, i just want to have for validating my own implementation ( on missing method description such as getObjectFromStatement ... ) My second question is -the howto describe a method which is extending the StatementManager , is it possible for avoiding this to use the a StatementFactory which is allocating a CallableStatementForClass is the class has stored procedure or an other ( StatementsForClassImpl ) if the class descriptor hasn't. Instead of registring OutParameters in the StatementManger can we do it in the StatementForClass implementation. Tks Thierry Hanot - 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: Loading an object
Hello Florin, thank you very much for your investigations. Your information may be very helpful to improve OJB, and we probabably would not have made such detailed comparison ourselves. -Original Message- From: Florin Pop [mailto:[EMAIL PROTECTED] [..] 1. If I set the attribute auto-retrieve=true all the loads work slower. If I set it to false then there is a speed up but when I try to access the Collection of the counties I receive NullPointerException. How do I init the collection? I do not consider the setting auto-retrieve=false very useful, because in that case, you have to fill that collection yourself. Is it mandatory to use proxy for County? I would recommend to use a proxy for the collection. Then the materialization of the collection is deferred until the application code accesses it for the first time, but it is done transparently. You can see how this works in any junit test that uses org.apache.ojb.broker.ProductGroupWithCollectionProxy, e.g. org.apache.ojb.broker.ProxyExamples 2. In the County class, initially I wanted to have no id_country field, the country field contains also an id; But I was unable to map the country object without introducing that field. How can I overcome this situation? There is a new feature called anonymous key. See http://db.apache.org/ojb/howto-use-anonymous-keys.html 3. Once again thank you for your patience. Thank you for your effort and valuable comparison! Olli - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
FieldConversion with ReportQuery???
hi, when using reportQueries, the conversion class is not used. Is there a simple way to use this feature with reportQueries? joerg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FieldConversion with ReportQuery???
hi joerg, the problem is that the columns may not correspond with the fields and thus no fieldcenversion is available. in reportqueries you can retrieve columns like 'upper(firstname)', 'allArticlesInGroup.articleName' where as in ordinary queries you always read columns of one class. hth jakob Joerg Lensing wrote: hi, when using reportQueries, the conversion class is not used. Is there a simple way to use this feature with reportQueries? 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]
Re: Oracle Auto-Increment
Oh... What stupid I am!!! really, I was using java.util.Date... I change it to java.sql.Date and all works very fine!!! Thanks for the support!!! Specially thanks to you Danilo for all. []´s Ronald - Original Message - From: Danilo Tommasina [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Tuesday, November 04, 2003 12:16 PM Subject: Re: Oracle Auto-Increment Uhm, I guess this has nothing to do with the sequence/auto-increment features... I think the problem is with the DATE field: field-descriptor name=nascimento column=DATA jdbc-type=DATE / It is probably a conversion problem, are you using java.util.Date or java.sql.Date in your persistent class? i personally never use SQL Date type, i always use GMT time (java.util.Date.getTime()) to store dates in db, it makes the db entries less readable but better portable (same Date precision on all db plattforms) bye danilo Hi again... I´m using it behind a Jetspeed portal (I don´t know if it matter... ). My Stack Trace is here: / java.lang.ClassCastException at oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedSt atement.java:2832) at oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedSt atement.java:2905) at org.apache.ojb.broker.platforms.PlatformDefaultImpl.setObjectForState ment(Unknown Source) at org.apache.ojb.broker.platforms.PlatformOracleImpl.setObjectForStatem ent(Unknown Source) at org.apache.ojb.broker.accesslayer.StatementManager.bindInsert(Unknown Source) at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeInsert(Unknow n Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(Unknown So urce) at org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown Source ) at org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown Source ) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown Source) at com.audaces.portal.modules.actions.core.aniversarios.AniversarianteAd minJspPortletAction.doSave(AniversarianteAdminJspPortletAction.java:78) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.jetspeed.modules.actions.portlets.PortletActionEvent.fireE vent(PortletActionEvent.java:215) at org.apache.jetspeed.modules.actions.portlets.PortletActionEvent.execu teEvents(PortletActionEvent.java:176) at org.apache.jetspeed.modules.actions.portlets.GenericMVCAction.perform (GenericMVCAction.java:148) at org.apache.turbine.modules.ActionLoader.exec(ActionLoader.java:122) at org.apache.turbine.modules.pages.DefaultPage.doBuild(DefaultPage.java :143) at org.apache.turbine.modules.Page.build(Page.java:90) at org.apache.turbine.modules.PageLoader.exec(PageLoader.java:123) at org.apache.turbine.Turbine.doGet(Turbine.java:563) at org.apache.turbine.Turbine.doPost(Turbine.java:658) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl icationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF ilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV alve.java:256) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex t.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav a:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV alve.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex t.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav a:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java: 2415) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j ava:180) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
RE: ODMG and Updating collections, more information
Added more information in tis case i need to make a few changed to the master set, FLEX_FIELD and completely replace the list of details. here is what i have so far. i would like to do this in the scope of a single transaction locking the records while it is being commited. The last debug statement has all the correct values in the felxFieldBO object but of course it never gets commited to the database. ** disclaimer ** Everything i know about OJB was gleened from totorials and examples. if theres an easier way of doing this i would love to be pointed in the correct direction. Transaction tx = null; tx = odmg.newTransaction(); tx.begin(); String queryStr = select STUFF from + FlexField.class.getName(); String whereClause = where FLEX_FIELD_NAME=$1; logger.debug(queryStr + whereClause); OQLQuery query = this.createQuery( queryStr + whereClause ); // select a row by primary key value query.bind( view.getFlexFieldName()); List list= (List) query.execute(); if ( list != null list.size() 0 ){ FlexField flexFieldBO = (FlexField)list.get(0); tx.lock(flexFieldBO, Transaction.WRITE); flexFieldBO.setFlexFieldEnabled(view.isEnabled()); flexFieldBO.setFlexFieldLabel(view.getFlexFieldLabel()); flexFieldBO.setFlexFieldRequired(view.isRequired()); if (view.getFlexFieldType().equals(Constants.FLEXTYPE_LIST)) { Vector listBO = flexFieldBO.getFlexFieldList(); Iterator iterList = listBO.iterator(); // delete the old list, this works and deletes records from the database while(iterList.hasNext()) { FlexFieldList flexFieldListBO = (FlexFieldList) iterList.next(); db.deletePersistent(flexFieldListBO); } ArrayList viewList = view.getFlexFieldValues(); Iterator iter = viewList.iterator(); //build and set a new list Vector fieldList = new Vector(); while (iter.hasNext()) { String value = (String)iter.next(); FlexFieldList flexFieldList = new FlexFieldList(); flexFieldList.setFlexFieldListValue(value); flexFieldList.setFlexFieldName(view.getFlexFieldName()); flexFieldList.setFlexField(flexFieldBO); flexFieldBO.addListValue(flexFieldList); } logger.debug(** ); logger.debug(flexFieldBO); logger.debug(** ); } tx.commit(); } else{ throw new DataNotFound(Flex field record missing); } -Original Message- From: Stephan Jones [mailto:[EMAIL PROTECTED] Sent: November 5, 2003 5:48 PM To: [EMAIL PROTECTED] Subject: ODMG and Updating collections Importance: High does anyone have a simple example using ODMG and 1:n mappings I can get a cascading inserts and Delets to work. I can not get any updates into the Many portion (FlexFieldList) of the my mapping. if someone could give me a few lines of code to properly update the 2 tables. I'm not sure if I have to select the row first, ect. Any help would be great. Here is the Mapping class-descriptor class=com.redpillconsulting.eca.businessobjects.FlexField table=FLEX_FIELD_T isolation-level=read-uncommitted field-descriptor column=FLEX_FIELD_NAME id=1 jdbc-type=CHAR name=flexFieldName primarykey=true/ field-descriptor column=FLEX_FIELD_LABEL id=2 jdbc-type=VARCHAR name=flexFieldLabel nullable=false/ field-descriptor column=FLEX_FIELD_REQUIRED id=3 jdbc-type=INTEGER conversion=org.apache.ojb.broker.accesslayer.conversions.Boolean2IntFieldCo nversion name=flexFieldRequired nullable=false/ field-descriptor column=FLEX_FIELD_ENABLED id=4 jdbc-type=INTEGER conversion=org.apache.ojb.broker.accesslayer.conversions.Boolean2IntFieldCo nversion name=flexFieldEnabled nullable=false/ field-descriptor column=FLEX_FIELD_TYPE id=5 jdbc-type=CHAR name=flexFieldType nullable=false/ field-descriptor column=FLEX_FIELD_CATEGORY id=6 jdbc-type=CHAR name=flexFieldCategory nullable=false/ collection-descriptor name=flexFieldList element-class-ref=com.redpillconsulting.eca.businessobjects.FlexFieldList inverse-foreignkey field-id-ref=2/ /collection-descriptor