OQLQuery
i all i create a oqlQuery like this OQLQuery query = odmg.newOQLQuery(); // 2. set the OQL select statement query.create(select * from table where id=null) when i try this i got this message : line 1:120: unexpected token: null what is wrong? Thank remi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OQLQuery
when i put (select * from table where id is null) i got this message : line 1:107: unexpected token: id Remi - Original Message - From: Rémi Bars [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 11:44 AM Subject: OQLQuery i all i create a oqlQuery like this OQLQuery query = odmg.newOQLQuery(); // 2. set the OQL select statement query.create(select * from table where id=null) when i try this i got this message : line 1:120: unexpected token: null what is wrong? Thank remi - 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: OQLQuery
OQL queries are different from sql. You need to do something more like: query.create(select ANYTHING from + YOURCLASS.class.getName() + where id=null); ANYTHING is ignored as far as I can tell so you really can put anything! YOURCLASS is the name of the class you are querying (NOT THE TABLE!!!). I'm not exactly sure of how to check for nulls in OQL, so field=null may not work. Hope this helps, Daniel. -Original Message- From: Rémi Bars [mailto:[EMAIL PROTECTED] Sent: 25 February 2004 11:05 To: OJB Users List Subject: Re: OQLQuery when i put (select * from table where id is null) i got this message : line 1:107: unexpected token: id Remi - Original Message - From: Rémi Bars [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 11:44 AM Subject: OQLQuery i all i create a oqlQuery like this OQLQuery query = odmg.newOQLQuery(); // 2. set the OQL select statement query.create(select * from table where id=null) when i try this i got this message : line 1:120: unexpected token: null what is wrong? Thank remi - 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: Borrow broker from pool failed
Hi Anthony, OJB use a PersistenceBroker instances pool and if enabled a connection pool. In your case the PB-pool seems to be exhausted. This is surprisingly, because per default PB-pool size was 100 and connection-pool size was 20. If you do an query/insert/... operation each PB use a connection, so I would expect that the connection pool will be exhausted before the PB-pool, except somewhere you ask for a PB instance, do not use any DB operation method and forget to close the instance (or use more than 100 concurrent). I also call broker.close() in the finally clause of every try/catch block of my data access objects. Should I be calling broker.close() right after the transaction in the try clause instead of the finally clause? Using a finally is best practices I'm using Oracle 8i and only see one active connection to the database, so the max number of connections are not being exceeded. This is surprisingly again. Is there anyway to log how many PersistenceBrokers are in the pool and if they are being released properly? Active PB instances can be checked by (undocumented) PersistenceBrokerFactoryFactory.instance().activePersistenceBroker() If it helps, every time I reload my webapp, the memory usage goes up and never gets reclaimed. If I get close to the maximum heap, the program will run out of memory. hmm, don't know if this is caused by OJB. Did your webApp reload all OJB classes and used libraries or only your web classes? regards, Armin Anthony Carlos wrote: Hello OJB gurus: I'm running up against this error message: java.util.NoSuchElementException at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(Generic KeyedObjectPool.java:770) at org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.createPer sistenceBroker(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.defaultPe rsistenceBroker(Unknown Source) at org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker( Unknown Source) at com.digitalphenom.common.ServiceLocator.findBroker(ServiceLocator.java: 33) ... I found the previous posts regarding this in the following article: http://www.mail-archive.com/[EMAIL PROTECTED]/msg05670.html As the article predicts, I am using ConnectionFactoryPooledImpl and whenExhaustedAction=0 in my OJB.properties file. I also call broker.close() in the finally clause of every try/catch block of my data access objects. Should I be calling broker.close() right after the transaction in the try clause instead of the finally clause? I'm using Oracle 8i and only see one active connection to the database, so the max number of connections are not being exceeded. Is there anyway to log how many PersistenceBrokers are in the pool and if they are being released properly? If it helps, every time I reload my webapp, the memory usage goes up and never gets reclaimed. If I get close to the maximum heap, the program will run out of memory. Thus, I believe that connections are not being released properly. Thanks, -Anthony Carlos - 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: how to keep repository-user.xml mappings separate from ojb.sar?
Hi Michael, Michael Mogley wrote: Hi all, I'm trying to deploy an application on JBoss 3.2.3 using latest OJB. I've followed the steps to create an ojb.sar in the deployment dir. I would like to keep the xml mapping definitions and DAOs local to the specific .ear I'm deploying. Is this possible? Or must I keep all the mappings for all applications in one repository-user.xml in the ojb.sar? Don't use .sar file in this case (AFAIK it's JBoss specific and shared among the deployed application), try to include all OJB jar (with used libraries) + beans in each application .ear file? (Don't ask for details ;-)) regards, Armin Thanks for any help/advice. Michael - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Inheritance Problem.
Folks, we need to map an abstract class and it's implementation to two different tables we tried the following : abstract class A { private id private valueA protected ojbConcreteClass } class B extends A{ private id2 private valueB } the repository file: class-descriptor class=A table=A_TABLE field-descriptor name=id column=ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor name=valueA column=VALUE jdbc-type=INTEGER / /class-descriptor class-descriptor class=B table=B_TABLE field-descriptor name=id2 column=ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor name=valueB column=VALUE jdbc-type=INTEGER / field-descriptor name=ojbConcreteClass column=CLASS_NAME jdbc-type=VARCHAR / reference-descriptor name=super class-ref=A auto-update=true foreignkey field-ref=id2/ /reference-descriptor /class-descriptor we encounter in the following error: org.apache.ojb.broker.PersistenceBrokerException: org.apache.ojb.broker.metadata.MetadataException: java.lang.Instantiat ionException what are we doing wrong ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to keep repository-user.xml mappings separate from ojb.sar?
Hi Armin, So in this case, how would I access the broker? I assume through JNDI somehow? Would I have to setup the PersistenceBrokerFactory as a resource adaptor? How would I do that? Michael - Original Message - From: Armin Waibel [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 5:21 AM Subject: Re: how to keep repository-user.xml mappings separate from ojb.sar? Hi Michael, Michael Mogley wrote: Hi all, I'm trying to deploy an application on JBoss 3.2.3 using latest OJB. I've followed the steps to create an ojb.sar in the deployment dir. I would like to keep the xml mapping definitions and DAOs local to the specific .ear I'm deploying. Is this possible? Or must I keep all the mappings for all applications in one repository-user.xml in the ojb.sar? Don't use .sar file in this case (AFAIK it's JBoss specific and shared among the deployed application), try to include all OJB jar (with used libraries) + beans in each application .ear file? (Don't ask for details ;-)) regards, Armin Thanks for any help/advice. Michael - 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: how to keep repository-user.xml mappings separate from ojb.sar?
Hi, Michael Mogley wrote: Hi Armin, So in this case, how would I access the broker? I assume through JNDI somehow? Would I have to setup the PersistenceBrokerFactory as a resource adaptor? How would I do that? Think it is possible to include a .sar file in an .ear file. Let the OJB jar and all used libraries in the .sar file (+ jboss-service file). I'm not sure what to do with the ejb-beans.jar - stay in .sar file?. Sorry I can't help more. Please let me know about your experience (to include this in deployment doc). regards, Armin Michael - Original Message - From: Armin Waibel [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 5:21 AM Subject: Re: how to keep repository-user.xml mappings separate from ojb.sar? Hi Michael, Michael Mogley wrote: Hi all, I'm trying to deploy an application on JBoss 3.2.3 using latest OJB. I've followed the steps to create an ojb.sar in the deployment dir. I would like to keep the xml mapping definitions and DAOs local to the specific .ear I'm deploying. Is this possible? Or must I keep all the mappings for all applications in one repository-user.xml in the ojb.sar? Don't use .sar file in this case (AFAIK it's JBoss specific and shared among the deployed application), try to include all OJB jar (with used libraries) + beans in each application .ear file? (Don't ask for details ;-)) regards, Armin Thanks for any help/advice. Michael - 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: how to keep repository-user.xml mappings separate from ojb.sar?
OK, I'll try to get it to work and let you know. Thanks. Michael - Original Message - From: Armin Waibel [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 10:10 AM Subject: Re: how to keep repository-user.xml mappings separate from ojb.sar? Hi, Michael Mogley wrote: Hi Armin, So in this case, how would I access the broker? I assume through JNDI somehow? Would I have to setup the PersistenceBrokerFactory as a resource adaptor? How would I do that? Think it is possible to include a .sar file in an .ear file. Let the OJB jar and all used libraries in the .sar file (+ jboss-service file). I'm not sure what to do with the ejb-beans.jar - stay in .sar file?. Sorry I can't help more. Please let me know about your experience (to include this in deployment doc). regards, Armin Michael - Original Message - From: Armin Waibel [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 5:21 AM Subject: Re: how to keep repository-user.xml mappings separate from ojb.sar? Hi Michael, Michael Mogley wrote: Hi all, I'm trying to deploy an application on JBoss 3.2.3 using latest OJB. I've followed the steps to create an ojb.sar in the deployment dir. I would like to keep the xml mapping definitions and DAOs local to the specific .ear I'm deploying. Is this possible? Or must I keep all the mappings for all applications in one repository-user.xml in the ojb.sar? Don't use .sar file in this case (AFAIK it's JBoss specific and shared among the deployed application), try to include all OJB jar (with used libraries) + beans in each application .ear file? (Don't ask for details ;-)) regards, Armin Thanks for any help/advice. Michael - 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: how to keep repository-user.xml mappings separate from ojb.sar?
There really is no reason to deploy OJB as a SAR (I would love to hear from anyone else that can tell what a good use case would be deploying it as a SAR). Just create a facade EJB that will create your PersistenceBroker and do your work find/save work there. Your client app's will not access the broker, but instead the EJB's methods. In that case, your EAR will contain your EJB-JAR's, probably with your DAO's, and then you can include the repository files in the root of that EAR -- works like a charm. You know have one self-contained application, with it's own OJB 'space'. You can even leverage the EJB examples that OJB ships with as your pass-through EJB. Let me know if this answers your problem, or if you have more questions. I have a current deployment that is doing exactly this right now. BTW, yes, this means that each EAR has it's own OJB version -- but if you have a unified data model, you really only want one Persistence layer across an enterprise. -Andrew -Original Message- From: Michael Mogley [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 12:47 PM To: OJB Users List Subject: Re: how to keep repository-user.xml mappings separate from ojb.sar? Hi Armin, So in this case, how would I access the broker? I assume through JNDI somehow? Would I have to setup the PersistenceBrokerFactory as a resource adaptor? How would I do that? Michael - Original Message - From: Armin Waibel [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 5:21 AM Subject: Re: how to keep repository-user.xml mappings separate from ojb.sar? Hi Michael, Michael Mogley wrote: Hi all, I'm trying to deploy an application on JBoss 3.2.3 using latest OJB. I've followed the steps to create an ojb.sar in the deployment dir. I would like to keep the xml mapping definitions and DAOs local to the specific .ear I'm deploying. Is this possible? Or must I keep all the mappings for all applications in one repository-user.xml in the ojb.sar? Don't use .sar file in this case (AFAIK it's JBoss specific and shared among the deployed application), try to include all OJB jar (with used libraries) + beans in each application .ear file? (Don't ask for details ;-)) regards, Armin Thanks for any help/advice. Michael - 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: Full Stack for : Can not init Identity for given object
Hi Armin thanks for aswer, lower is the full stack trace : br.com.fernandoqueiroz.exceptions.ParameterException: org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException: Can not init Identity for given object [EMAIL PROTECTED] at br.com.fernandoqueiroz.sgbd.persistencia.OJBDaoFactory.insere(OJBDaoFactory.java:163) at br.com.fernandoqueiroz.Teste.main(Teste.java:52) Caused by: org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException: Can not init Identity for given object [EMAIL PROTECTED] at org.apache.ojb.broker.Identity.init(Unknown Source) at org.apache.ojb.broker.Identity.init(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 br.com.fernandoqueiroz.sgbd.persistencia.OJBDaoFactory.insere(OJBDaoFactory.java:158) ... 1 more Caused by: org.apache.ojb.broker.PersistenceBrokerException: Could not get key value at org.apache.ojb.broker.util.BrokerHelper.getAutoIncrementValue(Unknown Source) at org.apache.ojb.broker.util.BrokerHelper.getValuesForObject(Unknown Source) at org.apache.ojb.broker.util.BrokerHelper.getKeyValues(Unknown Source) ... 7 more Caused by: org.apache.ojb.broker.util.sequence.SequenceManagerException: Can't build new sequence at org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.getSequence(Unknown Source) at org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.getUniqueLong(Unknown Source) at org.apache.ojb.broker.util.sequence.AbstractSequenceManager.getUniqueValue(Unknown Source) ... 10 more Caused by: org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException: org.apache.ojb.broker.util.sequence.HighLowSequence not found in OJB Repository at org.apache.ojb.broker.metadata.DescriptorRepository.getDescriptorFor(Unknown Source) at org.apache.ojb.broker.metadata.DescriptorRepository.getDescriptorFor(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getClassDescriptor(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown Source) at org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.lookupStoreSequence(Unknown Source) ... 13 more - Original Message - From: Armin Waibel [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Tuesday, February 24, 2004 5:58 AM Subject: Re: Error : Can not init Identity for given object Hi Fernando, is this the whole stack trace? If not please post the complete one. regards, Armin Fernando Queiroz Fonseca wrote: Hi. I made download of ojb and I installed, I create the archives of repositories and I configured following tables in the archive repository_user.xml !-- Please keep user defined mappings in this file only to avoid mixing user defined and system mappings. -- !-- Mapping of User defined classes starts here -- !-- The mappings for the tutorial classes are placed here to make it easier to find them for OJB newbies. Please remove them if you don't need them in your environment. -- class-descriptor class=br.com.fernandoqueiroz.sgbd.negocio.Usuario table=TUSUARIO field-descriptor sequence-name=MAX name=id_usuario column=id_usuario jdbc-type=INTEGER primarykey=true autoincrement=true/ field-descriptor name=usuario column=usuario jdbc-type=VARCHAR/ field-descriptor name=senha column=senha jdbc-type=VARCHAR/ field-descriptor name=email column=email jdbc-type=VARCHAR/ field-descriptor name=cpf column=cpf jdbc-type=VARCHAR/ /class-descriptor class-descriptor class=br.com.fernandoqueiroz.sgbd.negocio.GrandeArea table=C_TGRANDE_AREA field-descriptor name=id_grande_area column=id_grande_area jdbc-type=INTEGER primarykey=true autoincrement=true/ field-descriptor name=nome_grande_area column=nome_grande_area jdbc-type=VARCHAR/ /class-descriptor class-descriptor class=br.com.fernandoqueiroz.sgbd.negocio.DadoPessoal table=TDADO_PESSOAL field-descriptor name=id column=ID_DADO_PESSOAL jdbc-type=INTEGER primarykey=true autoincrement=true/ field-descriptor name=nome column=nome jdbc-type=VARCHAR/ field-descriptor name=sobrenome column=sobrenome jdbc-type=VARCHAR/ field-descriptor name=nacionalidade column=nacionalidade jdbc-type=VARCHAR/ field-descriptor name=cidade_nascimento column=CIDADE_NASCIMENTO jdbc-type=VARCHAR/ field-descriptor name=cpf
Re: how to keep repository-user.xml mappings separate from ojb.sar?
Hi Andrew, Yeah, using a SessionBean as a facade to the underlying DAOs is exactly how I'm envisioning it. My only question is how to get access to the broker in the first place. Are you using JNDI to get at the broker factory? Or just calling the static getFactory method directly? I would like to avoid using the sar since this does not seem portable, but on the other hand, that IS the documented way in the howto. It almost sounds like the PersistenceBrokerFactory is really like a Datasource and the PersistenceBroker like a Connection - which would seem to indicate OJB should be deployed as a rar. But would I then have to put the DAOs/xml mappings into the rar as well? Or could keep them as a separate jar in the ear? It would be nice to have an abstract OJB service available to all apps, with each app telling the service about its specific descriptors on startup. Am I really just making this way too complicated? Incidentally, using different versions of OJB for different ears is not a requirement. Also, dynamically unloading the app without restarting the server isn't important to me either (I've heard that could be a problem). Would you mind giving a detailed directory structure of your ear? Appreciate your help. Michael - Original Message - From: Clute, Andrew [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 10:47 AM Subject: RE: how to keep repository-user.xml mappings separate from ojb.sar? There really is no reason to deploy OJB as a SAR (I would love to hear from anyone else that can tell what a good use case would be deploying it as a SAR). Just create a facade EJB that will create your PersistenceBroker and do your work find/save work there. Your client app's will not access the broker, but instead the EJB's methods. In that case, your EAR will contain your EJB-JAR's, probably with your DAO's, and then you can include the repository files in the root of that EAR -- works like a charm. You know have one self-contained application, with it's own OJB 'space'. You can even leverage the EJB examples that OJB ships with as your pass-through EJB. Let me know if this answers your problem, or if you have more questions. I have a current deployment that is doing exactly this right now. BTW, yes, this means that each EAR has it's own OJB version -- but if you have a unified data model, you really only want one Persistence layer across an enterprise. -Andrew -Original Message- From: Michael Mogley [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 12:47 PM To: OJB Users List Subject: Re: how to keep repository-user.xml mappings separate from ojb.sar? Hi Armin, So in this case, how would I access the broker? I assume through JNDI somehow? Would I have to setup the PersistenceBrokerFactory as a resource adaptor? How would I do that? Michael - Original Message - From: Armin Waibel [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 5:21 AM Subject: Re: how to keep repository-user.xml mappings separate from ojb.sar? Hi Michael, Michael Mogley wrote: Hi all, I'm trying to deploy an application on JBoss 3.2.3 using latest OJB. I've followed the steps to create an ojb.sar in the deployment dir. I would like to keep the xml mapping definitions and DAOs local to the specific .ear I'm deploying. Is this possible? Or must I keep all the mappings for all applications in one repository-user.xml in the ojb.sar? Don't use .sar file in this case (AFAIK it's JBoss specific and shared among the deployed application), try to include all OJB jar (with used libraries) + beans in each application .ear file? (Don't ask for details ;-)) regards, Armin Thanks for any help/advice. Michael - 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: Clob : Coonection reset (??)
Emmanuel DUPONT wrote: Since we have put some Clob datatype column in our project we have the error below. We are using a quit important transaction with many Clob in columns. Our Clob datas are not so important (Max = 6000 characters in the same column). It is quite weird. We are under Oracle 9i, OjbRc5. The connection reset without any explanation.. [...] java.sql.SQLException: Exception d'E/S: Connection reset at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:334) at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2150) This is seen with Oracle thin driver and CLOB/BLOB values larger than 4kB. OJB 1.0RC5 will try to do a direct insert of the value in the Locator Object (LOB)-column, which is not supported by the Oracle thin driver. The LOB is supposed to be a pointer to the LOB-storage containing the value, but you can squeeze up to 4000 bytes of data into this pointer. You have two options to work around this: 1. Use Oracle OCI (if you have an Oracle Client installation on the machine running OJB) 2. Update to OJB from CVS HEAD and use the new Oracle9i platform which supports Oracle-style inserts of large LOB values with the thin driver. If you switch to this platform both thin and OCI will work, but only OCI will support batch-mode=true. -- Martin Kalén Curalia AB Web: http://www.curalia.se Orrspelsvägen 2BMail: [EMAIL PROTECTED] SE-182 79 StocksundTel: +46-8-410 064 40 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to keep repository-user.xml mappings separate from ojb.sar?
Hi Michael, I would like to avoid using the sar since this does not seem portable, but on the other hand, that IS the documented way in the howto. you are right, but this doesn't mean it is best practice ;-) When I started writing the ejb-examples my first priority was to make it work in some way. I would appreciate any help to rewrite the jboss deployment, ejb-examples section - Michael, Andy? ;-) It almost sounds like the PersistenceBrokerFactory is really like a Datasource and the PersistenceBroker like a Connection - which would seem to indicate OJB should be deployed as a rar. yes, some time ago Matthew started to write a JCA implemention and I do locally too. But it isn't as simple as it seems (but it's on the roadmap for 1.1 without guarantee). regards, Armin Michael Mogley wrote: Hi Andrew, Yeah, using a SessionBean as a facade to the underlying DAOs is exactly how I'm envisioning it. My only question is how to get access to the broker in the first place. Are you using JNDI to get at the broker factory? Or just calling the static getFactory method directly? I would like to avoid using the sar since this does not seem portable, but on the other hand, that IS the documented way in the howto. It almost sounds like the PersistenceBrokerFactory is really like a Datasource and the PersistenceBroker like a Connection - which would seem to indicate OJB should be deployed as a rar. But would I then have to put the DAOs/xml mappings into the rar as well? Or could keep them as a separate jar in the ear? It would be nice to have an abstract OJB service available to all apps, with each app telling the service about its specific descriptors on startup. Am I really just making this way too complicated? Incidentally, using different versions of OJB for different ears is not a requirement. Also, dynamically unloading the app without restarting the server isn't important to me either (I've heard that could be a problem). Would you mind giving a detailed directory structure of your ear? Appreciate your help. Michael - Original Message - From: Clute, Andrew [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 10:47 AM Subject: RE: how to keep repository-user.xml mappings separate from ojb.sar? There really is no reason to deploy OJB as a SAR (I would love to hear from anyone else that can tell what a good use case would be deploying it as a SAR). Just create a facade EJB that will create your PersistenceBroker and do your work find/save work there. Your client app's will not access the broker, but instead the EJB's methods. In that case, your EAR will contain your EJB-JAR's, probably with your DAO's, and then you can include the repository files in the root of that EAR -- works like a charm. You know have one self-contained application, with it's own OJB 'space'. You can even leverage the EJB examples that OJB ships with as your pass-through EJB. Let me know if this answers your problem, or if you have more questions. I have a current deployment that is doing exactly this right now. BTW, yes, this means that each EAR has it's own OJB version -- but if you have a unified data model, you really only want one Persistence layer across an enterprise. -Andrew -Original Message- From: Michael Mogley [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 12:47 PM To: OJB Users List Subject: Re: how to keep repository-user.xml mappings separate from ojb.sar? Hi Armin, So in this case, how would I access the broker? I assume through JNDI somehow? Would I have to setup the PersistenceBrokerFactory as a resource adaptor? How would I do that? Michael - Original Message - From: Armin Waibel [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 5:21 AM Subject: Re: how to keep repository-user.xml mappings separate from ojb.sar? Hi Michael, Michael Mogley wrote: Hi all, I'm trying to deploy an application on JBoss 3.2.3 using latest OJB. I've followed the steps to create an ojb.sar in the deployment dir. I would like to keep the xml mapping definitions and DAOs local to the specific .ear I'm deploying. Is this possible? Or must I keep all the mappings for all applications in one repository-user.xml in the ojb.sar? Don't use .sar file in this case (AFAIK it's JBoss specific and shared among the deployed application), try to include all OJB jar (with used libraries) + beans in each application .ear file? (Don't ask for details ;-)) regards, Armin Thanks for any help/advice. Michael - 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: Full Stack for : Can not init Identity for given object
Hi Fernando, the exception message says what's going wrong Caused by: org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException: org.apache.ojb.broker.util.sequence.HighLowSequence not found in OJB Repository If you use the SequenceManagerHighLowImpl for key generation, you need: a) org.apache.ojb.broker.util.sequence.HighLowSequence class-descriptor in your repository file b) an table CREATE TABLE OJB_HL_SEQ ( TABLENAME VARCHAR (175), FIELDNAME VARCHAR (70), MAX_KEY BIGINT, GRAB_SIZE integer, VERSION integer, PRIMARY KEY(TABLENAME,FIELDNAME) ); in DB regards, Armin Fernando Queiroz Fonseca wrote: Hi Armin thanks for aswer, lower is the full stack trace : br.com.fernandoqueiroz.exceptions.ParameterException: org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException: Can not init Identity for given object [EMAIL PROTECTED] at br.com.fernandoqueiroz.sgbd.persistencia.OJBDaoFactory.insere(OJBDaoFactory.java:163) at br.com.fernandoqueiroz.Teste.main(Teste.java:52) Caused by: org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException: Can not init Identity for given object [EMAIL PROTECTED] at org.apache.ojb.broker.Identity.init(Unknown Source) at org.apache.ojb.broker.Identity.init(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 br.com.fernandoqueiroz.sgbd.persistencia.OJBDaoFactory.insere(OJBDaoFactory.java:158) ... 1 more Caused by: org.apache.ojb.broker.PersistenceBrokerException: Could not get key value at org.apache.ojb.broker.util.BrokerHelper.getAutoIncrementValue(Unknown Source) at org.apache.ojb.broker.util.BrokerHelper.getValuesForObject(Unknown Source) at org.apache.ojb.broker.util.BrokerHelper.getKeyValues(Unknown Source) ... 7 more Caused by: org.apache.ojb.broker.util.sequence.SequenceManagerException: Can't build new sequence at org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.getSequence(Unknown Source) at org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.getUniqueLong(Unknown Source) at org.apache.ojb.broker.util.sequence.AbstractSequenceManager.getUniqueValue(Unknown Source) ... 10 more Caused by: org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException: org.apache.ojb.broker.util.sequence.HighLowSequence not found in OJB Repository at org.apache.ojb.broker.metadata.DescriptorRepository.getDescriptorFor(Unknown Source) at org.apache.ojb.broker.metadata.DescriptorRepository.getDescriptorFor(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getClassDescriptor(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown Source) at org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl.lookupStoreSequence(Unknown Source) ... 13 more - Original Message - From: Armin Waibel [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Tuesday, February 24, 2004 5:58 AM Subject: Re: Error : Can not init Identity for given object Hi Fernando, is this the whole stack trace? If not please post the complete one. regards, Armin Fernando Queiroz Fonseca wrote: Hi. I made download of ojb and I installed, I create the archives of repositories and I configured following tables in the archive repository_user.xml !-- Please keep user defined mappings in this file only to avoid mixing user defined and system mappings. -- !-- Mapping of User defined classes starts here -- !-- The mappings for the tutorial classes are placed here to make it easier to find them for OJB newbies. Please remove them if you don't need them in your environment. -- class-descriptor class=br.com.fernandoqueiroz.sgbd.negocio.Usuario table=TUSUARIO field-descriptor sequence-name=MAX name=id_usuario column=id_usuario jdbc-type=INTEGER primarykey=true autoincrement=true/ field-descriptor name=usuario column=usuario jdbc-type=VARCHAR/ field-descriptor name=senha column=senha jdbc-type=VARCHAR/ field-descriptor name=email column=email jdbc-type=VARCHAR/ field-descriptor name=cpf column=cpf jdbc-type=VARCHAR/ /class-descriptor class-descriptor class=br.com.fernandoqueiroz.sgbd.negocio.GrandeArea table=C_TGRANDE_AREA field-descriptor name=id_grande_area column=id_grande_area jdbc-type=INTEGER primarykey=true autoincrement=true/ field-descriptor name=nome_grande_area column=nome_grande_area jdbc-type=VARCHAR/ /class-descriptor
Re: how to keep repository-user.xml mappings separate from ojb.sar?
Hi Armin, Hi Michael, I would like to avoid using the sar since this does not seem portable, but on the other hand, that IS the documented way in the howto. you are right, but this doesn't mean it is best practice ;-) When I started writing the ejb-examples my first priority was to make it work in some way. Understood. I would appreciate any help to rewrite the jboss deployment, ejb-examples section - Michael, Andy? ;-) If I succeed in getting this to work in a portable modular way, I would be happy to rewrite that section. It almost sounds like the PersistenceBrokerFactory is really like a Datasource and the PersistenceBroker like a Connection - which would seem to indicate OJB should be deployed as a rar. yes, some time ago Matthew started to write a JCA implemention and I do locally too. But it isn't as simple as it seems (but it's on the roadmap for 1.1 without guarantee). I will look into this. Perhaps, it's not so complex. On the JCA, could you or Matthew give me what you have so far? So I don't have to start from scratch. Cheers, Michael regards, Armin Michael Mogley wrote: Hi Andrew, Yeah, using a SessionBean as a facade to the underlying DAOs is exactly how I'm envisioning it. My only question is how to get access to the broker in the first place. Are you using JNDI to get at the broker factory? Or just calling the static getFactory method directly? I would like to avoid using the sar since this does not seem portable, but on the other hand, that IS the documented way in the howto. It almost sounds like the PersistenceBrokerFactory is really like a Datasource and the PersistenceBroker like a Connection - which would seem to indicate OJB should be deployed as a rar. But would I then have to put the DAOs/xml mappings into the rar as well? Or could keep them as a separate jar in the ear? It would be nice to have an abstract OJB service available to all apps, with each app telling the service about its specific descriptors on startup. Am I really just making this way too complicated? Incidentally, using different versions of OJB for different ears is not a requirement. Also, dynamically unloading the app without restarting the server isn't important to me either (I've heard that could be a problem). Would you mind giving a detailed directory structure of your ear? Appreciate your help. Michael - Original Message - From: Clute, Andrew [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 10:47 AM Subject: RE: how to keep repository-user.xml mappings separate from ojb.sar? There really is no reason to deploy OJB as a SAR (I would love to hear from anyone else that can tell what a good use case would be deploying it as a SAR). Just create a facade EJB that will create your PersistenceBroker and do your work find/save work there. Your client app's will not access the broker, but instead the EJB's methods. In that case, your EAR will contain your EJB-JAR's, probably with your DAO's, and then you can include the repository files in the root of that EAR -- works like a charm. You know have one self-contained application, with it's own OJB 'space'. You can even leverage the EJB examples that OJB ships with as your pass-through EJB. Let me know if this answers your problem, or if you have more questions. I have a current deployment that is doing exactly this right now. BTW, yes, this means that each EAR has it's own OJB version -- but if you have a unified data model, you really only want one Persistence layer across an enterprise. -Andrew -Original Message- From: Michael Mogley [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 12:47 PM To: OJB Users List Subject: Re: how to keep repository-user.xml mappings separate from ojb.sar? Hi Armin, So in this case, how would I access the broker? I assume through JNDI somehow? Would I have to setup the PersistenceBrokerFactory as a resource adaptor? How would I do that? Michael - Original Message - From: Armin Waibel [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 5:21 AM Subject: Re: how to keep repository-user.xml mappings separate from ojb.sar? Hi Michael, Michael Mogley wrote: Hi all, I'm trying to deploy an application on JBoss 3.2.3 using latest OJB. I've followed the steps to create an ojb.sar in the deployment dir. I would like to keep the xml mapping definitions and DAOs local to the specific .ear I'm deploying. Is this possible? Or must I keep all the mappings for all applications in one repository-user.xml in the ojb.sar? Don't use .sar file in this case (AFAIK it's JBoss specific and shared among the deployed application), try to include all OJB jar (with used libraries) + beans
Re: Sanity Check on Sharing PersistenceBroker
Robert S. Sfeir wrote: McCaffrey, John G. wrote: You may want to have your getBroker() method return a new instance Yup, this is why I'm asking to see if the gurus on this list know whether this is necessary of it PB is smart enough to deal with it correctly. If you by simultaneous mean that multiple threads will use the same PB instance, I would definately recommend that your DAO layer implements one method for getting a broker and another one for releasing it after use. The underlying JDBC connection-pool will take care of pooling DB-connections even if you change to this short-lived PersistenceBroker-strategy. There are no synchronizations in the default PB implementation, so you would have a race condition that could hit broker.beginTransaction() multiple times before commit/abort. Also, with default cache-strategies and a share broker: objects in the cache updated by store-calls from one thread will be visible by other threads even before commit (sic!). This can of course be changed by turning off the cache or changing cache strategy. Note that multiple brokers as per my suggestion do not change this, you need per-broker-cache if you don't like this behaviour. (A two-level cache has been in the works for some time, and my bet is that you will see one in OJB 1.1). However; I don't consider myself as one of the gurus so feel free to disregard all of the above. :-D -- Martin Kalén Curalia AB Web: http://www.curalia.se Orrspelsvägen 2BMail: [EMAIL PROTECTED] SE-182 79 StocksundTel: +46-8-410 064 40 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem ClassCastException for addThisListenerTo
Reda Benzair wrote: Hi All I have problem for the classCastException in my repository file I use collections all my collection-descriptor use the proxy=true ! [...] why this error , my repository ? my application ? It's neither - it's actually your OJB version and the proxy-prefetching feature that has been playing up a bit at times. I assume you are using a CVS snapshot from around the 1.0RC5 release? Just update from CVS head and a lot of problems using proxies (including yours) have been solved. (If you can't change your OJB version, try turning off proxy prefetching by changing the proxy-prefetching-limit to a value =0 in your repository -- typically on the collection-descriptor causing problems.) -- Martin Kalén Curalia AB Web: http://www.curalia.se Orrspelsvägen 2BMail: [EMAIL PROTECTED] SE-182 79 StocksundTel: +46-8-410 064 40 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
many-to-one relation : help
Hi Armin thank's for the previous aid, now functions, using to advantage the email would like to know as it makes to inside map an object of a class-descriptor, I until then used hibernate and in it it used the following code in the describer: many-to-one name=usuario class=br.com.fernandoqueiroz.sgbd.negocio.Usuario not-null=true column name=id_usuario/ /many-to-one I am thankful since already Obliged ! - Original Message - From: Armin Waibel [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 9:05 PM Subject: Re: Full Stack for : Can not init Identity for given object Hi Fernando, the exception message says what's going wrong Caused by: org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException: org.apache.ojb.broker.util.sequence.HighLowSequence not found in OJB Repository If you use the SequenceManagerHighLowImpl for key generation, you need: a) org.apache.ojb.broker.util.sequence.HighLowSequence class-descriptor in your repository file b) an table CREATE TABLE OJB_HL_SEQ ( TABLENAME VARCHAR (175), FIELDNAME VARCHAR (70), MAX_KEY BIGINT, GRAB_SIZE integer, VERSION integer, PRIMARY KEY(TABLENAME,FIELDNAME) ); !-- The mappings for the tutorial classes are placed here to make it easier to find them for OJB newbies. Please remove them if you don't need them in your environment. -- class-descriptor class=br.com.fernandoqueiroz.sgbd.negocio.Usuario table=TUSUARIO field-descriptor sequence-name=MAX name=id_usuario column=id_usuario jdbc-type=INTEGER primarykey=true autoincrement=true/ field-descriptor name=usuario column=usuario jdbc-type=VARCHAR/ field-descriptor name=senha column=senha jdbc-type=VARCHAR/ field-descriptor name=email column=email jdbc-type=VARCHAR/ field-descriptor name=cpf column=cpf jdbc-type=VARCHAR/ /class-descriptor class-descriptor class=br.com.fernandoqueiroz.sgbd.negocio.DadoPessoal table=TDADO_PESSOAL field-descriptor name=id column=ID_DADO_PESSOAL jdbc-type=INTEGER primarykey=true autoincrement=true/ field-descriptor name=nome column=nome jdbc-type=VARCHAR/ field-descriptor name=sobrenome column=sobrenome jdbc-type=VARCHAR/ field-descriptor name=nacionalidade column=nacionalidade jdbc-type=VARCHAR/ field-descriptor name=cidade_nascimento column=CIDADE_NASCIMENTO jdbc-type=VARCHAR/ field-descriptor name=cpf column=cpf jdbc-type=VARCHAR/ field-descriptor name=data_nascimento column=data_nascimento jdbc-type=VARCHAR/ field-descriptor name=sexo column=sexo jdbc-type=VARCHAR/ field-descriptor name=rg column=rg jdbc-type=VARCHAR/ field-descriptor name=rg_orgao column=rg_orgao jdbc-type=VARCHAR/ field-descriptor name=rg_uf column=rg_uf jdbc-type=VARCHAR/ field-descriptor name=rg_data_emissao column=rg_data_emissao jdbc-type=VARCHAR/ field-descriptor name=nro_passaporte column=nro_passaporte jdbc-type=VARCHAR/ field-descriptor name=nome_pai column=nome_pai jdbc-type=VARCHAR/ field-descriptor name=nome_mae column=nome_mae jdbc-type=VARCHAR/ field-descriptor name=titulo_eleitor column=titulo_eleitor jdbc-type=VARCHAR/ field-descriptor name=secao_eleitor column=secao_eleitor jdbc-type=VARCHAR/ field-descriptor name=zona_eleitor column=zona_eleitor jdbc-type=VARCHAR/ field-descriptor name=nome_citacao column=NOME_CITACAO jdbc-type=VARCHAR/ reference-descriptor name=usuario class-ref=br.com.fernandoqueiroz.sgbd.negocio.Usuario foreignkey field-ref=id_usuario/ /reference-descriptor /class-descriptor --- Fernando Queiroz Fonseca Analista e Programador Java/J2EE Uberlândia - MG - Brasil +55-0xx34-8801-9072 www.fernandoqueiroz.com.br [EMAIL PROTECTED] --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
OJB + MSSQL sp_executesql problem
Hello everyone ! I have been using OJB for the last several months in several projects and have had no problems at all - great product ! However, in the last project, I am having problems with the sp_executesql statement that is generated by OJB in the queries. It apparently is a problem with my mssql installation, but I am looking for a workaround without having to do anything major with the database. A couple of lines about my db setup: 1. OJB rc5, jdk 1.4.2 2. mssql database - the table that I am having a problem with is quite large - 60 million rows. The problem is that it takes about 20 seconds to run a query to retrieve a record from the database. When I look at the generated code, the query is of the form 'sp_executesql SELECT ... from ... WHERE DCN=..'. If I run the query directly in the MSSQL query analyzer, it takes just as long (so apparently the problem is not with anything in OJB). However, if I take the query out of the 'sp_executesql..' statement, and run it as a regular select query (e.g. only SELECT ... from ... WHERE DCN=..), it takes less than a second to run. I investigated my set up and it appears that for some reason mssql messes up the indexes on the table - instead of using the clustered index that is specified on the field on which I specify the WHERE condition (e.g. 'DCN' in the sample query snippet above), it uses the index on the primary key (e.g. the Id field). When the query is run as a literal (second example below) - everything works like a charm and mssql selects the correct index. As you can see below, I thought that if I indicated in the repository that the DCN column was indexed, it would resolve the issue; however, the indexed=true property does not seem to change the generated sp_executesql statement in any way. So, my question is, is there a way to make mssql use the right index with some property in the configuration (e.g. that would possibly pass an index hint to the query) ? Has anyone else encountered similar behaviour ? Sample code: The repository-user.xml ... class-descriptor class=com.divintech.cigna.printrejects.valueobjects.ScanClaimVO table=Claim_Export_Summary field-descriptor id=1 name=id column=ID jdbc-type=INTEGER access=readonly autoincrement=true primarykey=true/ field-descriptor id=2 name=dcn column=DCN jdbc-type=CHAR access=readonly indexed=true / field-descriptor id=3 name=batchName column=Batch_Name_IA jdbc-type=VARCHAR access=readonly / field-descriptor id=4 name=exportDate column=CreateDate jdbc-type=DATE access=readonly/ field-descriptor id=5 name=boxNumber column=Box_No jdbc-type=VARCHAR access=readonly/ /class-descriptor The generated query (runs for about 15 - 20 seconds): exec sp_executesql N'SELECT A0.DCN,A0.Batch_Name_IA,A0.CreateDate,A0.Box_No,A0.ID FROM Claim_Export_Summary A0 WHERE A0.DCN = @P1 ', N'@P1 nvarchar(4000) ', N'0121110452' Literal query (runs for less than a second): SELECT A0.DCN,A0.Batch_Name_IA,A0.CreateDate,A0.Box_No,A0.ID FROM Claim_Export_Summary A0 WHERE A0.DCN = '0121110452' Regards, Alex Kotchnev Developer / Systems Analyst Diversified Information Technologies CONFIDENTIALITY NOTICE: If you have received this e-mail in error, please immediately notify the sender by e-mail at the address shown. This e-mail transmission may contain confidential information. This information is intended only for the use of the individual(s) or entity to whom it is intended even if addressed incorrectly. Please delete it from your files if you are not the intended recipient. Thank you for your compliance.
explain code switching?
I'm getting a ClassCastException when OJB tries to bind objects into my insert statement. By way of debugging, I can't seem to get any information of which is the erroneous column or what values are causing the problem. I've tried to add in logging statements in StatementManager and PlatformDefaultImpl and when I compile, my code just disappears! I assume this has something to do with the code-switcher piece of the build. Is there an easy way around this? Thanks, Joe -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Imagine if every Thursday your shoes exploded if you tied them the usual way. This happens to us all the time with computers, and nobody thinks of complaining. -- Jef Raskin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Proxy collection and persistence broker
If there is a class which returns a collection that is defined as a proxy collection in repository.xml, should it return this collection after persistence broker is closed (by pb.close() ). I have a class Role and there is a method getUsers(). getUsers() returns a collection and I define it as a proxy collection in repository.xml, After querying and displaying role name by role.getName() I close persistent broker. After that I try to get user by getUsers() and it still returns the collection. ?? Should not it give exception because persistence broker is closed or released this call needs a connection to materialize the collection ?? Thank you, Muhammad Aamir Senior Software Engineer Karachi International Container Terminal E-mail: [EMAIL PROTECTED] Website: http://www.kictl.com
Re: Inheritance Problem.
Hello Ziv, In persisting the parent class OJB has to instantiate it (using log4j you see the exact position if you set the logging to DEBUG in theOJB.properties). Since this can't be done with an abstract class, the described error occurs. Working around the same error we decided to make the abstract class concrete and have a log entry in the constructor, so we can check it`s instantiations. Another way would be to map each implementation to a different table, thus treating the abstact class like an interface. Perhaps there should be a warning in tutorial 3 (Advanced O/R) about this restriction. Regards, Birgitta Ziv Yankowitz wrote: Folks, we need to map an abstract class and it's implementation to two different tables we tried the following : abstract class A { private id private valueA protected ojbConcreteClass } class B extends A{ private id2 private valueB } the repository file: class-descriptor class=A table=A_TABLE field-descriptor name=id column=ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor name=valueA column=VALUE jdbc-type=INTEGER / /class-descriptor class-descriptor class=B table=B_TABLE field-descriptor name=id2 column=ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor name=valueB column=VALUE jdbc-type=INTEGER / field-descriptor name=ojbConcreteClass column=CLASS_NAME jdbc-type=VARCHAR / reference-descriptor name=super class-ref=A auto-update=true foreignkey field-ref=id2/ /reference-descriptor /class-descriptor we encounter in the following error: org.apache.ojb.broker.PersistenceBrokerException: org.apache.ojb.broker.metadata.MetadataException: java.lang.Instantiat ionException what are we doing wrong ?
RE: Inheritance Problem.
Thanks for the response. If I understand correctly there is no way we can map the abstract class to it's own table. Thanks again for the response. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 8:52 AM To: OJB Users List Subject: Re: Inheritance Problem. Hello Ziv, In persisting the parent class OJB has to instantiate it (using log4j you see the exact position if you set the logging to DEBUG in theOJB.properties). Since this can't be done with an abstract class, the described error occurs. Working around the same error we decided to make the abstract class concrete and have a log entry in the constructor, so we can check it`s instantiations. Another way would be to map each implementation to a different table, thus treating the abstact class like an interface. Perhaps there should be a warning in tutorial 3 (Advanced O/R) about this restriction. Regards, Birgitta Ziv Yankowitz wrote: Folks, we need to map an abstract class and it's implementation to two different tables we tried the following : abstract class A { private id private valueA protected ojbConcreteClass } class B extends A{ private id2 private valueB } the repository file: class-descriptor class=A table=A_TABLE field-descriptor name=id column=ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor name=valueA column=VALUE jdbc-type=INTEGER / /class-descriptor class-descriptor class=B table=B_TABLE field-descriptor name=id2 column=ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor name=valueB column=VALUE jdbc-type=INTEGER / field-descriptor name=ojbConcreteClass column=CLASS_NAME jdbc-type=VARCHAR / reference-descriptor name=super class-ref=A auto-update=true foreignkey field-ref=id2/ /reference-descriptor /class-descriptor we encounter in the following error: org.apache.ojb.broker.PersistenceBrokerException: org.apache.ojb.broker.metadata.MetadataException: java.lang.Instantiat ionException what are we doing wrong ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]