FW: [pdi]RE: [detail] reload Object ? ? (Problem Cache)
I think your extent-class declaration cause the problem (Or OJB's handling of extent clases). EmployeeRhBr is an interface that extends Employee interface? EmployeeRhBrImpl is an extent of Employee AND EmployeeRhBr. Why? Maybe this cause the problem. Of course this causes the problem : When I call new Identity(employee505, pb), the detected top level class is not Employee but EmployeeRhBr. In my repository every class-descriptor looks like Repository.xml: class-descriptor class=dummy.Name extent-class class-ref=dummy.NameImpl/ /class-descriptor class-descriptor class=dummy.NameImpl table=DUMMY_TABLE !-- .. -- /class-descriptor Name.java: package dummy; public interface Name { //. } NameImpl.java package dummy; public class NameImpl implements Name { //. } The interface is there to allow proxies. It works great except when it comes to extents. In this case, *EmployeeRhBr extends Employee = How should I reflect this in the repository mapping? Do I make some mistake somewhere? Thank you for all the time you spend on my question! :) -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: lundi 29 décembre 2003 16:14 To: OJB Users List Subject: Re: [detail] reload Object ? ? (Problem Cache) Hi, How can I force refreshing an object? Typically is there a method like PB.refreshObject(Object o)? -I know of course this one doesn't exist...- yes, you only can perform a refresh operation on the references. If you remove an object from the cache, next time you lookup the same object (same Identity/PK) OJB materialize a new object instance. Reda Benzair wrote: You're right. Sorry. The third line is the one I get after I call pb.clearCache(). And it's the one I would rather get instead of line 2. I add a similar test case to test suite (see ...broker.ObjectCacheTest#testObjectCacheDefaultImpl in CVS). This test pass without any problems. If the object was removed from cache, the object was read from the DB. Something I noticed since I posted this message : This sample code works great if the query concerns classical classes instead of Employee : Employee is an extent. hmm, seems to be an Identity problem. In OJB Identity class two objects are equals a) if they had the same TopLevelClass (in your case interface Employee) b) and the same PK values (don't know what the PK fields of your Employee implementation classes are) I think your extent-class declaration cause the problem (Or OJB's handling of extent clases). EmployeeRhBr is an interface that extends Employee interface? EmployeeRhBrImpl is an extent of Employee AND EmployeeRhBr. Why? Maybe this cause the problem. regards, Armin class-descriptor class=sj.employee.bean.Employee extent-class class-ref=sj.employee.bean.EmployeeImpl/ extent-class class-ref=sj.employeeRh.bean.EmployeeRhImpl/ extent-class class-ref=sj.employeeBr.bean.EmployeeBrImpl/ extent-class class-ref=sj.employeeRhBr.bean.EmployeeRhBrImpl/ /class-descriptor class-descriptor class=sj.employee.bean.EmployeeImpl table=EMPLOYEE !-- .. -- /class-descriptor !-- .. -- class-descriptor class=sj.employee.bean.EmployeeRhBr extent-class class-ref=sj.employeeRhBr.bean.EmployeeRhBrImpl/ /class-descriptor class-descriptor class=sj.employee.bean.EmployeeRhBrImpl table=EMPLOYEE !-- .. -- /class-descriptor = If I create a new Identity(employee505, pb), the resulting object does not match (.equals + .hascode) the one that already exists in the cache : removeFromCache has no effect, wich explains the strange behaviour above. As a workaround, I have removed all extents from my repository but it's a shame... What should I do? -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: mardi 23 décembre 2003 01:42 To: OJB Users List Subject: Re: reload Object ? ? (Problem Cache) Hi, in your example only 2 System.out.println(..) lines performed, but 3 lines are printed?! Do you forget one println() statement? regards, Armin Reda Benzair wrote: Hi all, I have a -simple?- question about OJB cache: How can I force refreshing an object? Typically is there a method like PB.refreshObject(Object o)? -I know of course this one doesn't exist...- To be more precise, I have someting like this: PersistenceBroker pb = PersistenceBrokerFactory.createPersistenceBroker(jcd, user, pass); Criteria crit = new Criteria(); crit.addEqualTo(Id, new Integer(505)); Employee employee505 = (Employee) pb.getObjectByQuery(new QueryByCriteria(Employee.class, crit)); System.out.println(ID 505 = + employee505.getName() + + employee505); employee505.setName(MODIFIED + employee505.getName()); // modified but not stored... should be erased by remove + reload? pb.removeFromCache(employee505); employee505 = (Employee) pb.getObjectByQuery(new
Bug using insert procedures with include-all-fields flag
Hello, I'm using OJB R5 and would like to use the support for using stored procedures. I'm using the following declaration in my class descriptor insert-procedure name=vmojb.insInstance include-all-fields=true /insert-procedure It looks like the code doesn't take any parameters into account when the include-all-fields flag is set. Tracing the code, we get into the InsertProcedureDescriptor constructor which does this.includeAllFields = includeAllFields; if (this.includeAllFields) { this.addArguments(this.getClassDescriptor().getFieldDescriptions()); } But the addArgument just does nothing if the include-all-fields flag is set : public final void addArgument(ArgumentDescriptor argument) { if (!this.getIncludeAllFields()) { super.addArgument(argument); } } I guess the constructor code should set the flag after calling addArguments rather than before. Thanks, -Alex
Re: FW: [pdi]RE: [detail] reload Object ? ? (Problem Cache)
Hi, It works great except when it comes to extents. In this case, *EmployeeRhBr extends Employee = How should I reflect this in the repository mapping? Do I make some mistake somewhere? Add EmployeeRhBr as extent to Employee class-descriptor. Additional you can refactoring your extent handling: class-descriptor class=sj.employee.bean.Employee extent-class class-ref=sj.employeeRh.bean.EmployeeImpl/ extent-class class-ref=sj.employeeRh.bean.EmployeeRh/ extent-class class-ref=*more extended Interface*/ ... /class-descriptor class-descriptor class=sj.employee.bean.EmployeeRhBr extent-class class-ref=sj.employeeRhBr.bean.EmployeeRhBrImpl/ /class-descriptor class-descriptor class=dummy.Name extent-class class-ref=dummy.NameImpl/ /class-descriptor only declare EmplyeeImpl and all extended interfaces of Employee, because you declare all NameImpl classes in the dummy.Name class-descriptor again. Hope this will work for you - good luck ;-) regards, Armin Reda Benzair wrote: I think your extent-class declaration cause the problem (Or OJB's handling of extent clases). EmployeeRhBr is an interface that extends Employee interface? EmployeeRhBrImpl is an extent of Employee AND EmployeeRhBr. Why? Maybe this cause the problem. Of course this causes the problem : When I call new Identity(employee505, pb), the detected top level class is not Employee but EmployeeRhBr. In my repository every class-descriptor looks like Repository.xml: class-descriptor class=dummy.Name extent-class class-ref=dummy.NameImpl/ /class-descriptor class-descriptor class=dummy.NameImpl table=DUMMY_TABLE !-- .. -- /class-descriptor Name.java: package dummy; public interface Name { //. } NameImpl.java package dummy; public class NameImpl implements Name { //. } The interface is there to allow proxies. It works great except when it comes to extents. In this case, *EmployeeRhBr extends Employee = How should I reflect this in the repository mapping? Do I make some mistake somewhere? Thank you for all the time you spend on my question! :) -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: lundi 29 décembre 2003 16:14 To: OJB Users List Subject: Re: [detail] reload Object ? ? (Problem Cache) Hi, How can I force refreshing an object? Typically is there a method like PB.refreshObject(Object o)? -I know of course this one doesn't exist...- yes, you only can perform a refresh operation on the references. If you remove an object from the cache, next time you lookup the same object (same Identity/PK) OJB materialize a new object instance. Reda Benzair wrote: You're right. Sorry. The third line is the one I get after I call pb.clearCache(). And it's the one I would rather get instead of line 2. I add a similar test case to test suite (see ...broker.ObjectCacheTest#testObjectCacheDefaultImpl in CVS). This test pass without any problems. If the object was removed from cache, the object was read from the DB. Something I noticed since I posted this message : This sample code works great if the query concerns classical classes instead of Employee : Employee is an extent. hmm, seems to be an Identity problem. In OJB Identity class two objects are equals a) if they had the same TopLevelClass (in your case interface Employee) b) and the same PK values (don't know what the PK fields of your Employee implementation classes are) I think your extent-class declaration cause the problem (Or OJB's handling of extent clases). EmployeeRhBr is an interface that extends Employee interface? EmployeeRhBrImpl is an extent of Employee AND EmployeeRhBr. Why? Maybe this cause the problem. regards, Armin class-descriptor class=sj.employee.bean.Employee extent-class class-ref=sj.employee.bean.EmployeeImpl/ extent-class class-ref=sj.employeeRh.bean.EmployeeRhImpl/ extent-class class-ref=sj.employeeBr.bean.EmployeeBrImpl/ extent-class class-ref=sj.employeeRhBr.bean.EmployeeRhBrImpl/ /class-descriptor class-descriptor class=sj.employee.bean.EmployeeImpl table=EMPLOYEE !-- .. -- /class-descriptor !-- .. -- class-descriptor class=sj.employee.bean.EmployeeRhBr extent-class class-ref=sj.employeeRhBr.bean.EmployeeRhBrImpl/ /class-descriptor class-descriptor class=sj.employee.bean.EmployeeRhBrImpl table=EMPLOYEE !-- .. -- /class-descriptor = If I create a new Identity(employee505, pb), the resulting object does not match (.equals + .hascode) the one that already exists in the cache : removeFromCache has no effect, wich explains the strange behaviour above. As a workaround, I have removed all extents from my repository but it's a shame... What should I do? -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: mardi 23 décembre 2003 01:42 To: OJB Users List Subject: Re: reload Object ? ? (Problem Cache) Hi, in your example only
Re: Optimistic Locking - simple question
Hi Luis, Luis Cruz wrote: Hello, To use the Optimistic Locking feature provided by OJB does the ACKOPTLOCK column have to be added to every table, or just the ones defined in the user mapping? You have to add a version column only for those classes that have an optimistic locking attribute (= column in the db table). There is no need to modify OJB system tables. My question is due to the presence indirection tables not defined in the user mapping. As the such transparent indirection tables only have columns that are part of the primary key, there is no need to have version columns on them. cu, Thomas Thanks in advance, Luis Cruz - 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]
ClassPersistenceNotCapableException: java.lang.Integer not found ...
Hi, Can someone tell me how to set a reference-descriptor for a foreign key? Below is an excerpt of my repository-user.xml file. I always get the error message: ClassPersistenceNotCapableException: java.lang.Integer not found in repository.xml ... I have no clue what to do. Thx, Dirk class-descriptor class=de.activity.entity.ActivityModel table=TPACTIVITY field-descriptor id=1 name=intActivityId column=ACTIVITY_ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor id=2 name=strActivityName column=ACTIVITY_NAME jdbc-type=CHAR / /class-descriptor class-descriptor class=de.activity.entity.ModuleModel table=TMODULE field-descriptor id=1 name=intModuleAssignedId column=MODUL_ASSIGNED_ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor id=2 name=intModuleId column=MODUL_ID jdbc-type=INTEGER / field-descriptor id=3 name=strModuleExclusive column=SIMULTAN_WORK jdbc-type=CHAR / field-descriptor id=4 name=intActivityIdFK column=ACTIVITY_ID jdbc-type=INTEGER / reference-descriptor name=intActivityIdFK class-ref=de.premiere.plato.app.activity.entity.ActivityModel refresh=true auto-retrieve=true foreignkey field-id-ref=4 / /reference-descriptor /class-descriptor - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Reloading/Refreshing attributes of an persistent object
Since, all discussions on reloading/refreshing an persistent object somehow ended up on different topics. Therefore I'm trying to formulate it as simple as possible: What are the exact steps to refresh the attributes of a single persistent object without generating a new instance? - What settings have to be made in the class descriptor. - What methods of the persistence broker needs to be called. - Is it possible at all? - If it is not possible right now, will there be an option in the future and what could be a workaround for the moment. Thanks in advance, Sebastian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ClassPersistenceNotCapableException: java.lang.Integer not found ...
I think your problem is in the name of the reference-descriptor it has the same name that field 4. Try to change the name and I think it will work fine. -Original Message- From: Dirk Manske (Service Respond) [mailto:[EMAIL PROTECTED] Sent: segunda-feira, 29 de Dezembro de 2003 18:43 To: [EMAIL PROTECTED] Subject: ClassPersistenceNotCapableException: java.lang.Integer not found ... Sensitivity: Personal Hi, Can someone tell me how to set a reference-descriptor for a foreign key? Below is an excerpt of my repository-user.xml file. I always get the error message: ClassPersistenceNotCapableException: java.lang.Integer not found in repository.xml ... I have no clue what to do. Thx, Dirk class-descriptor class=de.activity.entity.ActivityModel table=TPACTIVITY field-descriptor id=1 name=intActivityId column=ACTIVITY_ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor id=2 name=strActivityName column=ACTIVITY_NAME jdbc-type=CHAR / /class-descriptor class-descriptor class=de.activity.entity.ModuleModel table=TMODULE field-descriptor id=1 name=intModuleAssignedId column=MODUL_ASSIGNED_ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor id=2 name=intModuleId column=MODUL_ID jdbc-type=INTEGER / field-descriptor id=3 name=strModuleExclusive column=SIMULTAN_WORK jdbc-type=CHAR / field-descriptor id=4 name=intActivityIdFK column=ACTIVITY_ID jdbc-type=INTEGER / reference-descriptor name=intActivityIdFK class-ref=de.premiere.plato.app.activity.entity.ActivityModel refresh=true auto-retrieve=true foreignkey field-id-ref=4 / /reference-descriptor /class-descriptor - 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]
AW: ClassPersistenceNotCapableException: java.lang.Integer not found ...
Thanks for your answer. When I change the reference name to I get a MetadataException which states that it can't find a member in de.plato.app.activity.entity.ModuleModel. Of course there is no member in this class since I declared all attributes already in the class-descriptor. Any idea? Dirk -Ursprüngliche Nachricht- Von: João Vieira da Luz [mailto:[EMAIL PROTECTED] Gesendet: Montag, 29. Dezember 2003 19:51 An: 'OJB Users List' Betreff: RE: ClassPersistenceNotCapableException: java.lang.Integer not found ... Vertraulichkeit: Persönlich I think your problem is in the name of the reference-descriptor it has the same name that field 4. Try to change the name and I think it will work fine. -Original Message- From: Dirk Manske (Service Respond) [mailto:[EMAIL PROTECTED] Sent: segunda-feira, 29 de Dezembro de 2003 18:43 To: [EMAIL PROTECTED] Subject: ClassPersistenceNotCapableException: java.lang.Integer not found ... Sensitivity: Personal Hi, Can someone tell me how to set a reference-descriptor for a foreign key? Below is an excerpt of my repository-user.xml file. I always get the error message: ClassPersistenceNotCapableException: java.lang.Integer not found in repository.xml ... I have no clue what to do. Thx, Dirk class-descriptor class=de.activity.entity.ActivityModel table=TPACTIVITY field-descriptor id=1 name=intActivityId column=ACTIVITY_ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor id=2 name=strActivityName column=ACTIVITY_NAME jdbc-type=CHAR / /class-descriptor class-descriptor class=de.activity.entity.ModuleModel table=TMODULE field-descriptor id=1 name=intModuleAssignedId column=MODUL_ASSIGNED_ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor id=2 name=intModuleId column=MODUL_ID jdbc-type=INTEGER / field-descriptor id=3 name=strModuleExclusive column=SIMULTAN_WORK jdbc-type=CHAR / field-descriptor id=4 name=intActivityIdFK column=ACTIVITY_ID jdbc-type=INTEGER / reference-descriptor name=intActivityIdFK class-ref=de.premiere.plato.app.activity.entity.ActivityModel refresh=true auto-retrieve=true foreignkey field-id-ref=4 / /reference-descriptor /class-descriptor - 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]
Ojb samples
Please, Can anyone send to me some resource.xml source code fragment where is declared the jdbc-connection-descriptor for a postgresql jdbc? I am a newbie and my bigest problems is to start to use it on my Web application. I couldnt find any samples how to use it on Web Applications. Some codes of config files and servlets using the ojb framework for inserts or queries would be fine. Thanks. -- Fabiano F. Souza Tecnologia da Informação Estudar Soluções em Treinamento Corporativo. (31) 32849294 - [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Ojb samples
I assume you mean repository.xml If so: jdbc-connection-descriptor jcd-alias=test-database default-connection=true platform=PostgreSQL jdbc-level=2.0 driver=org.postgresql.Driver protocol=jdbc subprotocol=postgresql dbalias=//testserver.auckland.ac.nz/test-database username=dbusername password=password sequence-manager className= org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl attribute attribute-name=autoNaming attribute-value=false/ /sequence-manager /jdbc-connection-descriptor This uses Postgre's sequences to generate keys for different extents. See the tutorial docs and the sequence manager docs for more information. Thanks, Rob :) -Original Message- From: Fabiano Fernandes de Souza [mailto:[EMAIL PROTECTED] Sent: Tuesday, 30 December 2003 10:22 a.m. To: [EMAIL PROTECTED] Subject: Ojb samples Please, Can anyone send to me some resource.xml source code fragment where is declared the jdbc-connection-descriptor for a postgresql jdbc? I am a newbie and my bigest problems is to start to use it on my Web application. I couldnt find any samples how to use it on Web Applications. Some codes of config files and servlets using the ojb framework for inserts or queries would be fine. Thanks. -- Fabiano F. Souza Tecnologia da Informação Estudar Soluções em Treinamento Corporativo. (31) 32849294 - [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: Reloading/Refreshing attributes of an persistent object
Sebastian wrote: Since, all discussions on reloading/refreshing an persistent object somehow ended up on different topics. Therefore I'm trying to formulate it as simple as possible: What are the exact steps to refresh the attributes of a single persistent object without generating a new instance? - What settings have to be made in the class descriptor. - What methods of the persistence broker needs to be called. - Is it possible at all? - If it is not possible right now, will there be an option in the future and what could be a workaround for the moment. Thanks in advance, Sebastian The following seems to work, but I have no clue if it's the best way to reload an object: public void reload(Object obj) { ClassDescriptor cld = pb.getClassDescriptor(obj.getClass()); cld.setAlwaysRefresh(true); pb.getObjectByQuery(new QueryByIdentity(obj)); } Any comments? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AW: ClassPersistenceNotCapableException: java.lang.Integer not found ...
Look, as you defined field-descriptor id=4 name=intActivityIdFK column=ACTIVITY_ID jdbc-type=INTEGER / you can't have (or you will always get ClassCastException!!!) reference-descriptor name=intActivityIdFK class-ref=de.premiere.plato.app.activity.entity.ActivityModel refresh=true auto-retrieve=true foreignkey field-id-ref=4 / /reference-descriptor But you can create an attribute intActivityIdFk (of type int) AND activityFk (of type ActivityModel) in your beean, and your class descriptor should be like (and this should work fine) class-descriptor class=de.activity.entity.ModuleModel table=TMODULE field-descriptor id=1 name=intModuleAssignedId column=MODUL_ASSIGNED_ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor id=2 name=intModuleId column=MODUL_ID jdbc-type=INTEGER / field-descriptor id=3 name=strModuleExclusive column=SIMULTAN_WORK jdbc-type=CHAR / field-descriptor id=4 name=intActivityIdFK column=ACTIVITY_ID jdbc-type=INTEGER / reference-descriptor name=activityFK class-ref=de.premiere.plato.app.activity.entity.ActivityModel refresh=true auto-retrieve=true foreignkey field-id-ref=intActivityIdFk / /reference-descriptor /class-descriptor Best regards, Edson Richter Thanks for your answer. When I change the reference name to I get a MetadataException which states that it can't find a member in de.plato.app.activity.entity.ModuleModel. Of course there is no member in this class since I declared all attributes already in the class-descriptor. Any idea? Dirk -Ursprüngliche Nachricht- Von: João Vieira da Luz [mailto:[EMAIL PROTECTED] Gesendet: Montag, 29. Dezember 2003 19:51 An: 'OJB Users List' Betreff: RE: ClassPersistenceNotCapableException: java.lang.Integer not found ... Vertraulichkeit: Persönlich I think your problem is in the name of the reference-descriptor it has the same name that field 4. Try to change the name and I think it will work fine. -Original Message- From: Dirk Manske (Service Respond) [mailto:[EMAIL PROTECTED] Sent: segunda-feira, 29 de Dezembro de 2003 18:43 To: [EMAIL PROTECTED] Subject: ClassPersistenceNotCapableException: java.lang.Integer not found ... Sensitivity: Personal Hi, Can someone tell me how to set a reference-descriptor for a foreign key? Below is an excerpt of my repository-user.xml file. I always get the error message: ClassPersistenceNotCapableException: java.lang.Integer not found in repository.xml ... I have no clue what to do. Thx, Dirk class-descriptor class=de.activity.entity.ActivityModel table=TPACTIVITY field-descriptor id=1 name=intActivityId column=ACTIVITY_ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor id=2 name=strActivityName column=ACTIVITY_NAME jdbc-type=CHAR / /class-descriptor class-descriptor class=de.activity.entity.ModuleModel table=TMODULE field-descriptor id=1 name=intModuleAssignedId column=MODUL_ASSIGNED_ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor id=2 name=intModuleId column=MODUL_ID jdbc-type=INTEGER / field-descriptor id=3 name=strModuleExclusive column=SIMULTAN_WORK jdbc-type=CHAR / field-descriptor id=4 name=intActivityIdFK column=ACTIVITY_ID jdbc-type=INTEGER / reference-descriptor name=intActivityIdFK class-ref=de.premiere.plato.app.activity.entity.ActivityModel refresh=true auto-retrieve=true foreignkey field-id-ref=4 / /reference-descriptor /class-descriptor - 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: Reloading/Refreshing attributes of an persistent object
Sebastian wrote: The following seems to work, but I have no clue if it's the best way to reload an object: public void reload(Object obj) { ClassDescriptor cld = pb.getClassDescriptor(obj.getClass()); cld.setAlwaysRefresh(true); pb.getObjectByQuery(new QueryByIdentity(obj)); } Any comments? pb.retrieveAllReferences(obj); needs to be added ... that's what I'm using now: public void reload(Object ojb) { ClassDescriptor cld = pb.getClassDescriptor(rechnung.getClass()); synchronized (cld) { boolean refresh = cld.isAlwaysRefresh(); cld.setAlwaysRefresh(true); pb.getObjectByQuery(new QueryByIdentity(obj)); pb.retrieveAllReferences(obj); cld.setAlwaysRefresh(refresh); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ClassPersistenceNotCapableException: java.lang.Integer not found ...
Hi Dirk, ModuleModel should have an attribute of type ActivityModel. This is the attribute name the reference descriptor is looking for. It also appears that your package names do not correspond de.premiere.plato.app.activity.entity.ActivityModel != de.activity.entity.ActivityModel I assume this is a CP oversight. Public class ModuleModel { Integer intActivityIdFK; ActivityModel activity; ... } reference-descriptor name=activity class-ref=de.activity.entity.ActivityModel refresh=true auto-retrieve=true foreignkey field-ref=intActivityIdFK / /reference-descriptor Hope this helps. Wally -Original Message- From: Dirk Manske (Service Respond) [mailto:[EMAIL PROTECTED] On Behalf Of Dirk Manske Sent: Monday, December 29, 2003 1:14 PM To: 'OJB Users List' Subject: AW: ClassPersistenceNotCapableException: java.lang.Integer not found ... Sensitivity: Personal Thanks for your answer. When I change the reference name to I get a MetadataException which states that it can't find a member in de.plato.app.activity.entity.ModuleModel. Of course there is no member in this class since I declared all attributes already in the class-descriptor. Any idea? Dirk -Ursprüngliche Nachricht- Von: João Vieira da Luz [mailto:[EMAIL PROTECTED] Gesendet: Montag, 29. Dezember 2003 19:51 An: 'OJB Users List' Betreff: RE: ClassPersistenceNotCapableException: java.lang.Integer not found ... Vertraulichkeit: Persönlich I think your problem is in the name of the reference-descriptor it has the same name that field 4. Try to change the name and I think it will work fine. -Original Message- From: Dirk Manske (Service Respond) [mailto:[EMAIL PROTECTED] Sent: segunda-feira, 29 de Dezembro de 2003 18:43 To: [EMAIL PROTECTED] Subject: ClassPersistenceNotCapableException: java.lang.Integer not found ... Sensitivity: Personal Hi, Can someone tell me how to set a reference-descriptor for a foreign key? Below is an excerpt of my repository-user.xml file. I always get the error message: ClassPersistenceNotCapableException: java.lang.Integer not found in repository.xml ... I have no clue what to do. Thx, Dirk class-descriptor class=de.activity.entity.ActivityModel table=TPACTIVITY field-descriptor id=1 name=intActivityId column=ACTIVITY_ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor id=2 name=strActivityName column=ACTIVITY_NAME jdbc-type=CHAR / /class-descriptor class-descriptor class=de.activity.entity.ModuleModel table=TMODULE field-descriptor id=1 name=intModuleAssignedId column=MODUL_ASSIGNED_ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor id=2 name=intModuleId column=MODUL_ID jdbc-type=INTEGER / field-descriptor id=3 name=strModuleExclusive column=SIMULTAN_WORK jdbc-type=CHAR / field-descriptor id=4 name=intActivityIdFK column=ACTIVITY_ID jdbc-type=INTEGER / reference-descriptor name=intActivityIdFK class-ref=de.premiere.plato.app.activity.entity.ActivityModel refresh=true auto-retrieve=true foreignkey field-id-ref=4 / /reference-descriptor /class-descriptor - 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]
AW: AW: ClassPersistenceNotCapableException: java.lang.Integer not found ...
Hi Edson, this information was exactly what I have been looking for. Now it is working. Thanks a lot. Dirk -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Gesendet: Montag, 29. Dezember 2003 20:59 An: OJB Users List Betreff: Re: AW: ClassPersistenceNotCapableException: java.lang.Integer not found ... Look, as you defined field-descriptor id=4 name=intActivityIdFK column=ACTIVITY_ID jdbc-type=INTEGER / you can't have (or you will always get ClassCastException!!!) reference-descriptor name=intActivityIdFK class-ref=de.premiere.plato.app.activity.entity.ActivityModel refresh=true auto-retrieve=true foreignkey field-id-ref=4 / /reference-descriptor But you can create an attribute intActivityIdFk (of type int) AND activityFk (of type ActivityModel) in your beean, and your class descriptor should be like (and this should work fine) class-descriptor class=de.activity.entity.ModuleModel table=TMODULE field-descriptor id=1 name=intModuleAssignedId column=MODUL_ASSIGNED_ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor id=2 name=intModuleId column=MODUL_ID jdbc-type=INTEGER / field-descriptor id=3 name=strModuleExclusive column=SIMULTAN_WORK jdbc-type=CHAR / field-descriptor id=4 name=intActivityIdFK column=ACTIVITY_ID jdbc-type=INTEGER / reference-descriptor name=activityFK class-ref=de.premiere.plato.app.activity.entity.ActivityModel refresh=true auto-retrieve=true foreignkey field-id-ref=intActivityIdFk / /reference-descriptor /class-descriptor Best regards, Edson Richter Thanks for your answer. When I change the reference name to I get a MetadataException which states that it can't find a member in de.plato.app.activity.entity.ModuleModel. Of course there is no member in this class since I declared all attributes already in the class-descriptor. Any idea? Dirk -Ursprüngliche Nachricht- Von: João Vieira da Luz [mailto:[EMAIL PROTECTED] Gesendet: Montag, 29. Dezember 2003 19:51 An: 'OJB Users List' Betreff: RE: ClassPersistenceNotCapableException: java.lang.Integer not found ... Vertraulichkeit: Persönlich I think your problem is in the name of the reference-descriptor it has the same name that field 4. Try to change the name and I think it will work fine. -Original Message- From: Dirk Manske (Service Respond) [mailto:[EMAIL PROTECTED] Sent: segunda-feira, 29 de Dezembro de 2003 18:43 To: [EMAIL PROTECTED] Subject: ClassPersistenceNotCapableException: java.lang.Integer not found ... Sensitivity: Personal Hi, Can someone tell me how to set a reference-descriptor for a foreign key? Below is an excerpt of my repository-user.xml file. I always get the error message: ClassPersistenceNotCapableException: java.lang.Integer not found in repository.xml ... I have no clue what to do. Thx, Dirk class-descriptor class=de.activity.entity.ActivityModel table=TPACTIVITY field-descriptor id=1 name=intActivityId column=ACTIVITY_ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor id=2 name=strActivityName column=ACTIVITY_NAME jdbc-type=CHAR / /class-descriptor class-descriptor class=de.activity.entity.ModuleModel table=TMODULE field-descriptor id=1 name=intModuleAssignedId column=MODUL_ASSIGNED_ID jdbc-type=INTEGER primarykey=true autoincrement=true / field-descriptor id=2 name=intModuleId column=MODUL_ID jdbc-type=INTEGER / field-descriptor id=3 name=strModuleExclusive column=SIMULTAN_WORK jdbc-type=CHAR / field-descriptor id=4 name=intActivityIdFK column=ACTIVITY_ID jdbc-type=INTEGER / reference-descriptor name=intActivityIdFK class-ref=de.premiere.plato.app.activity.entity.ActivityModel refresh=true auto-retrieve=true foreignkey field-id-ref=4 / /reference-descriptor /class-descriptor - 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]
OQLQuery being cached? [orb newbie]
Hi, I am executing the following code: OQLQuery query = impl.newOQLQuery(); query.create( [THEQUERY] ); DList results = (DList)query.execute(); Iterator iterator = results.iterator(); If I change some column with an external tool and then execute the code, the updated column is not reflected in the orb objects. Is there a config value or a runtime parameter that I need to change? What is going on behind the scenes here? Thanks for your help, K. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OQLQuery being cached? [orb newbie]
Are you working with DefaultCacheImpl or EmptyCacheImpl? If you are working with DefaultCacheImpl, take a look at config parameters. Otherwise, are there any exceptions (stack trace), messages (they can be very usefull if you enable higher level of logging as DEBUG). Best regards, Edson Richter Hi, I am executing the following code: OQLQuery query = impl.newOQLQuery(); query.create( [THEQUERY] ); DList results = (DList)query.execute(); Iterator iterator = results.iterator(); If I change some column with an external tool and then execute the code, the updated column is not reflected in the orb objects. Is there a config value or a runtime parameter that I need to change? What is going on behind the scenes here? Thanks for your help, K. - 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 being cached? [orb newbie]
Thanks for your quick answer, I cheched the OJB.properties file an I was using DefaultCacheImpl I change it to ObjectCacheEmptyImpl and now it is working as I was expecting. Now just to learn the reasons for the previous behaviour: A comment in OJB.properties: # The ObjectCacheClass entry tells OJB which concrete ObjectCache # implementation is to be used as standard cache. # Its also possible to override this entry adding object-cache elements # on jdbc-connection-descriptor level and # per class-descriptor in repository file In my repository_internal.xml I have the following line: object-cache class=org.apache.ojb.broker.cache.ObjectCacheEmptyImpl /object-cache Why it wasn't working as I was expecting? Where is the documentation about the config parameters for the cache implementations? Thanks for your help, K. [EMAIL PROTECTED] wrote: Are you working with DefaultCacheImpl or EmptyCacheImpl? If you are working with DefaultCacheImpl, take a look at config parameters. Otherwise, are there any exceptions (stack trace), messages (they can be very usefull if you enable higher level of logging as DEBUG). Best regards, Edson Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OQLQuery being cached? [orb newbie]
In real, I'm not an specialist in caches ;), but I've used with success object-cache .. tag inside class-descriptor, no elsewhere. I think I've read somewhere that is possible to configure the object-cache for the connection (or the alias), but I never reade more, and now I'm not sure. Give a try to DTD doc. Is the first place I look when in doubt. Best regards, Edson Richter Thanks for your quick answer, I cheched the OJB.properties file an I was using DefaultCacheImpl I change it to ObjectCacheEmptyImpl and now it is working as I was expecting. Now just to learn the reasons for the previous behaviour: A comment in OJB.properties: # The ObjectCacheClass entry tells OJB which concrete ObjectCache # implementation is to be used as standard cache. # Its also possible to override this entry adding object-cache elements # on jdbc-connection-descriptor level and # per class-descriptor in repository file In my repository_internal.xml I have the following line: object-cache class=org.apache.ojb.broker.cache.ObjectCacheEmptyImpl /object-cache Why it wasn't working as I was expecting? Where is the documentation about the config parameters for the cache implementations? Thanks for your help, K. [EMAIL PROTECTED] wrote: Are you working with DefaultCacheImpl or EmptyCacheImpl? If you are working with DefaultCacheImpl, take a look at config parameters. Otherwise, are there any exceptions (stack trace), messages (they can be very usefull if you enable higher level of logging as DEBUG). Best regards, Edson Richter - 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]