Re: insert object, and don't specify a value for one of the fields
Hi all, I agree that it would be nice to have a declaration of initial and default values, etc. in the repository.xml. So we would need a little "sub language" that allows you to specify the semantics you want. For simple cases it will be only constant of arbitrary java types. For other cases user want to perform some computations. SO the "sub language" will tend to grow and to become a full fledged programming language. So instead instead of embarking on this adventure of creating an expression evaluator language I strongly recommend to use user defined ConversionStrategies. You can do any computation in a ConversionStrategy and it can be defined on a per field basis. See http://db.apache.org/ojb/jdbc-types.html for a docuemntation of this feature. cheers, Thomas Larry V. Streepy, Jr. wrote: If use of default database values on insert is a common use case, it would seem reasonable to submit an enhancement request to support some specification in the class descriptor to support control of this semantic. I don't know enough databases to know if this will be a problem in implementing the DB specific handling or not. But it sounds like a useful feature. Manukyan, Sergey wrote: Maybe I should give you my manager's phone number and you will explain it to him ... ;) I think in anyway we should have a mechanism to control what fields take part in operations. Regards. Sergey. -Original Message- From: Andy Malakov [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 04, 2004 2:24 PM To: OJB Users List Subject: Re: insert object, and don't specify a value for one of the fields Simplest solution may be to change business logic. Since you want it to be writable from OJB side, who said "dateChanged" should be initially set by database? Sorry :-) - Original Message - From: "Manukyan, Sergey" <[EMAIL PROTECTED]> To: "'OJB Users List'" <[EMAIL PROTECTED]> Sent: Wednesday, February 04, 2004 1:31 PM Subject: RE: insert object, and don't specify a value for one of the fields Hi Armin, If I declare this field as readonly, then it will be always readonly, but I need to update on UPDATE operations, and omit on INSERT operations. I guess the possible solution I am seeking for could be to declare something like this: Or can I somehow dynamically exclude this field from participating in operation, whatever this operation might be? Similar to ObjectModification class mechanism, but that will exclude this field from operation only for this Broker? I know I can dynamically change the class descriptor and set this field to anonymous and then revert it back to normal, but I am afraid this will impact other Brokers operations with this class, -Sergey -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 04, 2004 11:30 AM To: OJB Users List Subject: Re: insert object, and don't specify a value for one of the fields Hi Sergey, Manukyan, Sergey wrote: Folks, The thing is I need to insert a record where for one of the fields I want to omit value, not specify at all, not even null, nothing. So that in INSERT operation it will not be present at all and will be populated by the default value from database. Is there a way how I can do that? you can try to declare field as access="readonly". regards, Armin Thank you, -Sergey ** ** LEGAL DISCLAIMER ** ** This E-mail message and any attachments may contain legally privileged, confidential or proprietary information. If you are not the intended recipient(s), or the employee or agent responsible for delivery of this message to the intended recipient(s), you are hereby notified that any dissemination, distribution or copying of this E-mail message is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete this E-mail message from your computer. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FW: FW: setStartAtIndex/setEndAtIndex for a very large result set
Hi, This is a repost. Could anybody help me on that? Thanks, Zhe --- Zhe Liu <[EMAIL PROTECTED]> wrote: > > > -Original Message- > From: ZZZ Liu [mailto:[EMAIL PROTECTED] > Sent: Tuesday, February 03, 2004 3:46 PM > To: [EMAIL PROTECTED] > Subject: Re: FW: setStartAtIndex/setEndAtIndex for a > very large result > set > > > After more investigation by looking into OJB code, I > found that the out of memory problem occurs in > org.apache.ojb.broker.accesslayer.RsIterator.size() > method. In that method, there are two ways to get > size: > 1) count > 2) .last .getRow > > I found that 2) will give me out of memory error.I > tried that with pure JDBC and also got out of memory > error. However, if I force to use 1), it works fine. > I > am using Oracle 9i. I am worndering whether there is > any way to solve this problem. Currently I have to > set > jdbc-level="1.0" instead of "2.0" to force 1) is > used. > > Thanks, > Zhe > > > > > > -Original Message- > > From: ZZZ Liu [mailto:[EMAIL PROTECTED] > > Sent: Monday, February 02, 2004 9:01 PM > > To: [EMAIL PROTECTED] > > Subject: setStartAtIndex/setEndAtIndex for a very > > large result set > > > > > > Hi, All > > > > I am trying to do a simple query against a very > > large > > table with over 200,000 records. I use > > QueryByCriteria > > without any criteria, but settiing > > setStartAtIndex(1) > > and setEndAtIndex(2). Then I use > getIteratorByQuery > > to > > get the result. However, I got OutOfMemory error. > > > > I tried the same thing on a relatively small table > > (about 100 records) and it works fine. > > > > Could anybody shed some light on this? > > > > Thanks, > > Zhe > > > > __ > > Do you Yahoo!? > > Yahoo! SiteBuilder - Free web site building tool. > > Try it! > > http://webhosting.yahoo.com/ps/sb/ > > > > > - > > To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > For additional commands, e-mail: > > [EMAIL PROTECTED] > > > > > > > __ > Do you Yahoo!? > Yahoo! SiteBuilder - Free web site building tool. > Try it! > http://webhosting.yahoo.com/ps/sb/ > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > __ Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! http://webhosting.yahoo.com/ps/sb/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
IllegarlArgumentException Error
Hi, Everything is all right now, it seems that the test program was unable to find the repository. Bye - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: patch for org.apache.ojb.broker.util.SqlHelper class
hi andrew, thanks for the patch. i commited the fix to the repository. jakob Andrew Geery wrote: I recently upgraded from 1.0.rc4 to 1.0.rc5. This broke some code I had written that used the method org.apache.ojb.broker.query.Criteria.addSql(String). The SQL I added was of the form: soundex(value) = soundex(column). This resulted in an java.lang.ArrayIndexOutOfBoundsException being thrown by the org.apache.ojb.broker.util.SqlHelper.splitPath(String) method because the braceBegin variable was greater than the braceEnd variable. In addition to the check that both braceEnd and braceBegin are at least zero, there should be a check that braceEnd is, in fact, bigger than braceBegin. The patch is below. Thanks Andrew Index: SqlHelper.java === RCS file: /home/cvspublic/db-ojb/src/java/org/apache/ojb/broker/util/SqlHelper.java,v retrieving revision 1.21 diff -u -r1.21 SqlHelper.java --- SqlHelper.java12 Dec 2003 16:30:37 -1.21 +++ SqlHelper.java3 Feb 2004 14:23:44 - @@ -122,7 +122,7 @@ int braceBegin = aPath.lastIndexOf("("); int braceEnd = aPath.indexOf(")"); -if (braceBegin >= 0 && braceEnd >= 0) +if (braceBegin >= 0 && braceEnd >= 0 && braceEnd > braceBegin) { int colBegin; int colEnd; - 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: insert object, and don't specify a value for one of the fields
If use of default database values on insert is a common use case, it would seem reasonable to submit an enhancement request to support some specification in the class descriptor to support control of this semantic. I don't know enough databases to know if this will be a problem in implementing the DB specific handling or not. But it sounds like a useful feature. Manukyan, Sergey wrote: Maybe I should give you my manager's phone number and you will explain it to him ... ;) I think in anyway we should have a mechanism to control what fields take part in operations. Regards. Sergey. -Original Message- From: Andy Malakov [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 04, 2004 2:24 PM To: OJB Users List Subject: Re: insert object, and don't specify a value for one of the fields Simplest solution may be to change business logic. Since you want it to be writable from OJB side, who said "dateChanged" should be initially set by database? Sorry :-) - Original Message - From: "Manukyan, Sergey" <[EMAIL PROTECTED]> To: "'OJB Users List'" <[EMAIL PROTECTED]> Sent: Wednesday, February 04, 2004 1:31 PM Subject: RE: insert object, and don't specify a value for one of the fields Hi Armin, If I declare this field as readonly, then it will be always readonly, but I need to update on UPDATE operations, and omit on INSERT operations. I guess the possible solution I am seeking for could be to declare something like this: Or can I somehow dynamically exclude this field from participating in operation, whatever this operation might be? Similar to ObjectModification class mechanism, but that will exclude this field from operation only for this Broker? I know I can dynamically change the class descriptor and set this field to anonymous and then revert it back to normal, but I am afraid this will impact other Brokers operations with this class, -Sergey -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 04, 2004 11:30 AM To: OJB Users List Subject: Re: insert object, and don't specify a value for one of the fields Hi Sergey, Manukyan, Sergey wrote: Folks, The thing is I need to insert a record where for one of the fields I want to omit value, not specify at all, not even null, nothing. So that in INSERT operation it will not be present at all and will be populated by the default value from database. Is there a way how I can do that? you can try to declare field as access="readonly". regards, Armin Thank you, -Sergey ** ** LEGAL DISCLAIMER ** ** This E-mail message and any attachments may contain legally privileged, confidential or proprietary information. If you are not the intended recipient(s), or the employee or agent responsible for delivery of this message to the intended recipient(s), you are hereby notified that any dissemination, distribution or copying of this E-mail message is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete this E-mail message from your computer. - 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] -- Larry V. Streepy, Jr. Senior Vice President and CTO Health Language, Inc.
ProxyFactory
Right now Proxy instances for database objects are created in several places inside OJB and created instances are not customizable. It would be nice to be able to define my own ProxyFactory or IndirectionHandlerFactory somewhere in OJB.properties. For example: Some business methods can be dispatched based solely on object Identity available to Proxy handler (without object materialization). Thanks, Andy
RE: insert object, and don't specify a value for one of the fields
Unfortunately my boss is not OK with this solution. Thank you in any case, I will try to do per thread copying. One more solution could be to mimic the functionality of database on OJB level. That is to specify the default value that will be assigned to a field at creation of the object. I could have done it in the class's constructor but think this should be externalized in a class config file like init-value: -Sergey -Original Message- From: Andy Malakov [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 04, 2004 2:42 PM To: [EMAIL PROTECTED] Subject: Re: insert object, and don't specify a value for one of the fields That was friendly advise. At least in my case I found that my boss/our customers doesn't care of such details providing that their requirements are still OK. OJB is clearly missing fine-grained control here. Thus any workaround would be ugly. If all inserts happen in separated context you may also consider local patch to class registry (remove that attribute from per-thread copy of class metadata). - Original Message - From: "Manukyan, Sergey" <[EMAIL PROTECTED]> To: "'OJB Users List'" <[EMAIL PROTECTED]> Sent: Wednesday, February 04, 2004 2:22 PM Subject: RE: insert object, and don't specify a value for one of the fields > Maybe I should give you my manager's phone number and you will explain it to > him ... ;) I think in anyway we should have a mechanism to control what > fields take part in operations. > Regards. Sergey. > > > > -Original Message- > From: Andy Malakov [mailto:[EMAIL PROTECTED] > Sent: Wednesday, February 04, 2004 2:24 PM > To: OJB Users List > Subject: Re: insert object, and don't specify a value for one of the fields > > Simplest solution may be to change business logic. Since you want it to be > writable from OJB side, who said "dateChanged" should be > initially set by database? Sorry :-) > > - Original Message - > From: "Manukyan, Sergey" <[EMAIL PROTECTED]> > To: "'OJB Users List'" <[EMAIL PROTECTED]> > Sent: Wednesday, February 04, 2004 1:31 PM > Subject: RE: insert object, and don't specify a value for one of the fields > > > > Hi Armin, > > > > If I declare this field as readonly, then it will be always readonly, but > I > > need to update on UPDATE operations, and omit on INSERT operations. > > I guess the possible solution I am seeking for could be to declare > something > > like this: > > > > > name="dateChanged" > > column="DATECH" > > jdbc-type="DATE" > > use-database-default-if-null-on-insert-operations = "true" /> > > > > Or can I somehow dynamically exclude this field from participating in > > operation, whatever this operation might be? Similar to ObjectModification > > class mechanism, but that will exclude this field from operation only for > > this Broker? > > > > I know I can dynamically change the class descriptor and set this field to > > anonymous and then revert it back to normal, but I am afraid this will > > impact other Brokers operations with this class, > > > > -Sergey > > > > > > > > -Original Message- > > From: Armin Waibel [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, February 04, 2004 11:30 AM > > To: OJB Users List > > Subject: Re: insert object, and don't specify a value for one of the > fields > > > > Hi Sergey, > > > > Manukyan, Sergey wrote: > > > > > Folks, > > > > > > The thing is I need to insert a record where for one of the fields I > want > > to > > > omit value, not specify at all, not even null, nothing. So that in > INSERT > > > operation it will not be present at all and will be populated by the > > default > > > value from database. Is there a way how I can do that? > > > > > > > you can try to declare field as access="readonly". > > > > regards, > > Armin > > > > > Thank you, > > > -Sergey > > > > > > ** > > > ** LEGAL DISCLAIMER ** > > > ** > > > > > > This E-mail message and any attachments may contain > > > legally privileged, confidential or proprietary > > > information. If you are not the intended recipient(s), > > > or the employee or agent responsible for delivery of > > > this message to the intended recipient(s), you are > > > hereby notified that any dissemination, distribution > > > or copying of this E-mail message is strictly > > > prohibited. If you have received this message in > > > error, please immediately notify the sender and > > > delete this E-mail message from your computer. > > > > > > - > > > 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
RE: insert object, and don't specify a value for one of the fields
Thank you Axel, I was thinking doing that if there is no other solution, -Sergey -Original Message- From: Guerrero, Axel [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 04, 2004 2:04 PM To: OJB Users List Subject: RE: insert object, and don't specify a value for one of the fields Another thing you can try is declare a second object to the same table... So that in you code you need to check whether you want to use the default values then you use this second object. If you need to fill all columns you use the original object. I have a table for persons which includes a blob (a photo).. I created several objects mapped to the same table.. one object has all the columns (except photo). another object has pk and photo. some objects only fetch (and save) a subset of data. It works because the layout of my application is such that this is possible. Axel Guerrero -Original Message- From: Manukyan, Sergey [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 04, 2004 12:31 PM To: 'OJB Users List' Subject: RE: insert object, and don't specify a value for one of the fields Hi Armin, If I declare this field as readonly, then it will be always readonly, but I need to update on UPDATE operations, and omit on INSERT operations. I guess the possible solution I am seeking for could be to declare something like this: Or can I somehow dynamically exclude this field from participating in operation, whatever this operation might be? Similar to ObjectModification class mechanism, but that will exclude this field from operation only for this Broker? I know I can dynamically change the class descriptor and set this field to anonymous and then revert it back to normal, but I am afraid this will impact other Brokers operations with this class, -Sergey -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 04, 2004 11:30 AM To: OJB Users List Subject: Re: insert object, and don't specify a value for one of the fields Hi Sergey, Manukyan, Sergey wrote: > Folks, > > The thing is I need to insert a record where for one of the fields I want to > omit value, not specify at all, not even null, nothing. So that in INSERT > operation it will not be present at all and will be populated by the default > value from database. Is there a way how I can do that? > you can try to declare field as access="readonly". regards, Armin > Thank you, > -Sergey > > ** > ** LEGAL DISCLAIMER ** > ** > > This E-mail message and any attachments may contain > legally privileged, confidential or proprietary > information. If you are not the intended recipient(s), > or the employee or agent responsible for delivery of > this message to the intended recipient(s), you are > hereby notified that any dissemination, distribution > or copying of this E-mail message is strictly > prohibited. If you have received this message in > error, please immediately notify the sender and > delete this E-mail message from your computer. > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: insert object, and don't specify a value for one of the fields
Maybe I should give you my manager's phone number and you will explain it to him ... ;) I think in anyway we should have a mechanism to control what fields take part in operations. Regards. Sergey. -Original Message- From: Andy Malakov [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 04, 2004 2:24 PM To: OJB Users List Subject: Re: insert object, and don't specify a value for one of the fields Simplest solution may be to change business logic. Since you want it to be writable from OJB side, who said "dateChanged" should be initially set by database? Sorry :-) - Original Message - From: "Manukyan, Sergey" <[EMAIL PROTECTED]> To: "'OJB Users List'" <[EMAIL PROTECTED]> Sent: Wednesday, February 04, 2004 1:31 PM Subject: RE: insert object, and don't specify a value for one of the fields > Hi Armin, > > If I declare this field as readonly, then it will be always readonly, but I > need to update on UPDATE operations, and omit on INSERT operations. > I guess the possible solution I am seeking for could be to declare something > like this: > > name="dateChanged" > column="DATECH" > jdbc-type="DATE" > use-database-default-if-null-on-insert-operations = "true" /> > > Or can I somehow dynamically exclude this field from participating in > operation, whatever this operation might be? Similar to ObjectModification > class mechanism, but that will exclude this field from operation only for > this Broker? > > I know I can dynamically change the class descriptor and set this field to > anonymous and then revert it back to normal, but I am afraid this will > impact other Brokers operations with this class, > > -Sergey > > > > -Original Message- > From: Armin Waibel [mailto:[EMAIL PROTECTED] > Sent: Wednesday, February 04, 2004 11:30 AM > To: OJB Users List > Subject: Re: insert object, and don't specify a value for one of the fields > > Hi Sergey, > > Manukyan, Sergey wrote: > > > Folks, > > > > The thing is I need to insert a record where for one of the fields I want > to > > omit value, not specify at all, not even null, nothing. So that in INSERT > > operation it will not be present at all and will be populated by the > default > > value from database. Is there a way how I can do that? > > > > you can try to declare field as access="readonly". > > regards, > Armin > > > Thank you, > > -Sergey > > > > ** > > ** LEGAL DISCLAIMER ** > > ** > > > > This E-mail message and any attachments may contain > > legally privileged, confidential or proprietary > > information. If you are not the intended recipient(s), > > or the employee or agent responsible for delivery of > > this message to the intended recipient(s), you are > > hereby notified that any dissemination, distribution > > or copying of this E-mail message is strictly > > prohibited. If you have received this message in > > error, please immediately notify the sender and > > delete this E-mail message from your computer. > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: insert object, and don't specify a value for one of the fields
Simplest solution may be to change business logic. Since you want it to be writable from OJB side, who said "dateChanged" should be initially set by database? Sorry :-) - Original Message - From: "Manukyan, Sergey" <[EMAIL PROTECTED]> To: "'OJB Users List'" <[EMAIL PROTECTED]> Sent: Wednesday, February 04, 2004 1:31 PM Subject: RE: insert object, and don't specify a value for one of the fields > Hi Armin, > > If I declare this field as readonly, then it will be always readonly, but I > need to update on UPDATE operations, and omit on INSERT operations. > I guess the possible solution I am seeking for could be to declare something > like this: > > name="dateChanged" > column="DATECH" > jdbc-type="DATE" > use-database-default-if-null-on-insert-operations = "true" /> > > Or can I somehow dynamically exclude this field from participating in > operation, whatever this operation might be? Similar to ObjectModification > class mechanism, but that will exclude this field from operation only for > this Broker? > > I know I can dynamically change the class descriptor and set this field to > anonymous and then revert it back to normal, but I am afraid this will > impact other Brokers operations with this class, > > -Sergey > > > > -Original Message- > From: Armin Waibel [mailto:[EMAIL PROTECTED] > Sent: Wednesday, February 04, 2004 11:30 AM > To: OJB Users List > Subject: Re: insert object, and don't specify a value for one of the fields > > Hi Sergey, > > Manukyan, Sergey wrote: > > > Folks, > > > > The thing is I need to insert a record where for one of the fields I want > to > > omit value, not specify at all, not even null, nothing. So that in INSERT > > operation it will not be present at all and will be populated by the > default > > value from database. Is there a way how I can do that? > > > > you can try to declare field as access="readonly". > > regards, > Armin > > > Thank you, > > -Sergey > > > > ** > > ** LEGAL DISCLAIMER ** > > ** > > > > This E-mail message and any attachments may contain > > legally privileged, confidential or proprietary > > information. If you are not the intended recipient(s), > > or the employee or agent responsible for delivery of > > this message to the intended recipient(s), you are > > hereby notified that any dissemination, distribution > > or copying of this E-mail message is strictly > > prohibited. If you have received this message in > > error, please immediately notify the sender and > > delete this E-mail message from your computer. > > > > - > > 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: insert object, and don't specify a value for one of the fields
Another thing you can try is declare a second object to the same table... So that in you code you need to check whether you want to use the default values then you use this second object. If you need to fill all columns you use the original object. I have a table for persons which includes a blob (a photo).. I created several objects mapped to the same table.. one object has all the columns (except photo). another object has pk and photo. some objects only fetch (and save) a subset of data. It works because the layout of my application is such that this is possible. Axel Guerrero -Original Message- From: Manukyan, Sergey [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 04, 2004 12:31 PM To: 'OJB Users List' Subject: RE: insert object, and don't specify a value for one of the fields Hi Armin, If I declare this field as readonly, then it will be always readonly, but I need to update on UPDATE operations, and omit on INSERT operations. I guess the possible solution I am seeking for could be to declare something like this: Or can I somehow dynamically exclude this field from participating in operation, whatever this operation might be? Similar to ObjectModification class mechanism, but that will exclude this field from operation only for this Broker? I know I can dynamically change the class descriptor and set this field to anonymous and then revert it back to normal, but I am afraid this will impact other Brokers operations with this class, -Sergey -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 04, 2004 11:30 AM To: OJB Users List Subject: Re: insert object, and don't specify a value for one of the fields Hi Sergey, Manukyan, Sergey wrote: > Folks, > > The thing is I need to insert a record where for one of the fields I want to > omit value, not specify at all, not even null, nothing. So that in INSERT > operation it will not be present at all and will be populated by the default > value from database. Is there a way how I can do that? > you can try to declare field as access="readonly". regards, Armin > Thank you, > -Sergey > > ** > ** LEGAL DISCLAIMER ** > ** > > This E-mail message and any attachments may contain > legally privileged, confidential or proprietary > information. If you are not the intended recipient(s), > or the employee or agent responsible for delivery of > this message to the intended recipient(s), you are > hereby notified that any dissemination, distribution > or copying of this E-mail message is strictly > prohibited. If you have received this message in > error, please immediately notify the sender and > delete this E-mail message from your computer. > > - > 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: insert object, and don't specify a value for one of the fields
Hi Armin, If I declare this field as readonly, then it will be always readonly, but I need to update on UPDATE operations, and omit on INSERT operations. I guess the possible solution I am seeking for could be to declare something like this: Or can I somehow dynamically exclude this field from participating in operation, whatever this operation might be? Similar to ObjectModification class mechanism, but that will exclude this field from operation only for this Broker? I know I can dynamically change the class descriptor and set this field to anonymous and then revert it back to normal, but I am afraid this will impact other Brokers operations with this class, -Sergey -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 04, 2004 11:30 AM To: OJB Users List Subject: Re: insert object, and don't specify a value for one of the fields Hi Sergey, Manukyan, Sergey wrote: > Folks, > > The thing is I need to insert a record where for one of the fields I want to > omit value, not specify at all, not even null, nothing. So that in INSERT > operation it will not be present at all and will be populated by the default > value from database. Is there a way how I can do that? > you can try to declare field as access="readonly". regards, Armin > Thank you, > -Sergey > > ** > ** LEGAL DISCLAIMER ** > ** > > This E-mail message and any attachments may contain > legally privileged, confidential or proprietary > information. If you are not the intended recipient(s), > or the employee or agent responsible for delivery of > this message to the intended recipient(s), you are > hereby notified that any dissemination, distribution > or copying of this E-mail message is strictly > prohibited. If you have received this message in > error, please immediately notify the sender and > delete this E-mail message from your computer. > > - > 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: IllegarlArgumentException Error
Can you check that you are not passing null as example object into the query [OjbExample.readAtributoId]? - Original Message - From: "ANDRES FELIPE RINCON ZAPATA" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, February 03, 2004 11:25 PM Subject: IllegarlArgumentException Error > You are right Andy, but I had probed every option with similar errors. > > For instance when I selected PersistentFieldDirectAccessImpl this was > the console output. > > [DEFAULT] ERROR: Error getting field:idAtributo in object:com.ecip.ojb.AtributoImpl > org.apache.ojb.broker.metadata.MetadataException: Error getting field:idAtributo in > object:com.ecip.ojb.AtributoImpl > at > org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectAccessImpl.doGet(Unknown > Source) > at org.apache.ojb.broker.metadata.fieldaccess.AbstractPersistentField.get(Unknown > Source) > at org.apache.ojb.broker.query.QueryByCriteria.buildCriteria(Unknown Source) > > > > This is the class, it have private fields and public getters and setters. > I thought that PersistentFieldIntrospectorImpl option was right. > > package com.ecip.ojb; > public class AtributoImpl implements Atributo, java.io.Serializable { > > private Integer idAtributo; > private String atributo; > private String descripcion; > > public Integer getIdAtributo() { > return idAtributo; > } > > public String getAtributo() { > return atributo; > } > > public String getDescripcion() { >return descripcion; > } > > public void setIdAtributo(Integer id) { > this.idAtributo = id; > } > > public void setAtributo(String atrib) { > this.atributo = atrib; > } > > public void setDescripcion(String descrip) { > this.descripcion = descrip; > } > } > > Is this class OK? > What else should I check in the ojb properties file? > > > Thanks Andy. > > > > From: Andy Malakov <[EMAIL PROTECTED]> > Subject: IllegarlArgumentException Error > Sent: Tue, 3 Feb 2004 18:08:56 -0500 > Subject: IllegarlArgumentException Error > > > Check your OJB.properties (PersistentFieldClass). You seems to be using > PersistentFieldIntrospectorImpl which require > JavaBeans-style getters and setters. > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OJb sequence manager - Force computation of unique values
Hi, Ziv Yankowitz wrote: Folks, we are using the High/Low sequence manager implementation and we try to compute the id in advance with the following code : PersistenceBroker broker = ((HasBroker) tx).getBroker(); Identity oid = new Identity(object, broker); we encounter in the following error error : org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException: Can not init Identity for given object Say that class of given object could not be found in repository. But maybe there is another reason for that failure, please post the whole stack trace and the error log before failure. regards, Armin what can be the problem? thanks. - 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]
problems with non-ojb proxies
I have an application (of which I have no control) where I should add persistence for proxied objects. Now whenever I try to write such an object I get this error: org.apache.ojb.broker.PersistenceBrokerException: The InvocationHandler for the provided Proxy was not an instance of org.apache.ojb.broker.accesslayer.IndirectionHandler at org.apache.ojb.broker.util.ProxyHelper.getRealObjectIfMaterialized(ProxyHelper.java:224) at org.apache.ojb.broker.core.PersistenceBrokerImpl.store(PersistenceBrokerImpl.java:653) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(DelegatingPersistenceBroker.java:165) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(DelegatingPersistenceBroker.java:165) So my question is, is there either a way to handle this (without modifying the application classes), or could we add a method to the PB-API: broker.writeObject(obj, RealClass.class); Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
OJb sequence manager - Force computation of unique values
Folks, we are using the High/Low sequence manager implementation and we try to compute the id in advance with the following code : PersistenceBroker broker = ((HasBroker) tx).getBroker(); Identity oid = new Identity(object, broker); we encounter in the following error error : org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException: Can not init Identity for given object what can be the problem? thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: complex joins
Thanks Robert for replying. Its a complex query (look in my first post) in the sense that it has self joins based on logical operators (like greater than and less than). Wasnt able to find anything in the documentation on how to accomplish that. cheers M - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: insert object, and don't specify a value for one of the fields
Hi Sergey, Manukyan, Sergey wrote: Folks, The thing is I need to insert a record where for one of the fields I want to omit value, not specify at all, not even null, nothing. So that in INSERT operation it will not be present at all and will be populated by the default value from database. Is there a way how I can do that? you can try to declare field as access="readonly". regards, Armin Thank you, -Sergey ** ** LEGAL DISCLAIMER ** ** This E-mail message and any attachments may contain legally privileged, confidential or proprietary information. If you are not the intended recipient(s), or the employee or agent responsible for delivery of this message to the intended recipient(s), you are hereby notified that any dissemination, distribution or copying of this E-mail message is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete this E-mail message from your computer. - 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]
insert object, and don't specify a value for one of the fields
Folks, The thing is I need to insert a record where for one of the fields I want to omit value, not specify at all, not even null, nothing. So that in INSERT operation it will not be present at all and will be populated by the default value from database. Is there a way how I can do that? Thank you, -Sergey ** ** LEGAL DISCLAIMER ** ** This E-mail message and any attachments may contain legally privileged, confidential or proprietary information. If you are not the intended recipient(s), or the employee or agent responsible for delivery of this message to the intended recipient(s), you are hereby notified that any dissemination, distribution or copying of this E-mail message is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete this E-mail message from your computer. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ObjectCacheOSCacheImpl without clustering
Hi Jason, Thank you very much for your fast reply. The configuration you told me worked perfectly! Thanks. :-) However, OJB seems a little bit slower when using oscache without clustering as the cache implementation. Do you have that feeling too or am I mistaken? Thanks, Jair - Original Message - From: "Jason McKerr" <[EMAIL PROTECTED]> To: "OJB Users List" <[EMAIL PROTECTED]> Sent: Tuesday, February 03, 2004 7:27 PM Subject: Re: ObjectCacheOSCacheImpl without clustering > You use the same configuration as a single as in the Clustering > documentation, but just comment out the two lines: > > cache.event.listeners=com.opensymphony.oscache.plugins. > clustersupport.JavaGroupsBroadcastingListener > > AND > > cache.cluster.multicast.ip=231.12.21.132 > > > This will create OSCache in single environment without multicast > distribution. > > Jason > > On Tue, 2004-02-03 at 14:15, Jair da Silva Ferreira Júnior wrote: > > Hi, > > I am using ojb1.0_rc5, ODMG api with OJB queries, mysql4 (innodb tables) > > in Linux Red Hat 7.3 (kernel 2.4.20-20.7). > > I've had some problems using the OJB default cache implementation > > (ObjectCacheDefaultImpl ) in RC5, so I would like to change the cache > > implementation to ObjectCacheOSCacheImpl and use oscache. At > > http://db.apache.org/ojb/howto-work-with-clustering.html I found information > > about using oscache in a clustered environment, however I want to use > > oscache in an environment without clustering. Please, can someone tell me > > how to do it? > > > > Thanks, > > Jair Jr > > > > > > > > - > > 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: Collection prefetching patch
I disagree that this is a proper decision in all cases. There are semantic reasons why one would want an empty collection versus a null instance. If this change is going to be made, the behavior should be controlled by an attribute of the collection descriptor. Thanks. Larry. Guillaume Nodet wrote: I submit another patch that corrects my problem: In AbstractPersistentField, lines 321 -> 328 replace the code String name = fieldName.substring(0, index); PersistentField pField = createInternPersistentField(realClass, name); Object attrib = pField.get(realObj); if (attrib != null || value != null) { if (attrib == null) { by the following code: String name = fieldName.substring(0, index); PersistentField pField = createInternPersistentField(realClass, name); Object attrib = pField.get(realObj); if (attrib != null || (value != null && (!(value instanceof Collection) || ((Collection) value).size() > 0))) { if (attrib == null) { -Message d'origine- De : Guillaume Nodet [mailto:[EMAIL PROTECTED] Envoye : mercredi 4 fevrier 2004 09:40 A : OJB Users List Objet : Collection prefetching patch I saw that ojb do automatically create empty collections and set them to the appropriate field even if they are empty. In my own, case, this appears with nested objects, and thus it actually creates the nested object despite the fact that it was null when i stored the object. Wouldn't it be better to create the collection only when it is not empty ? In the CollectionPrefetcher, lines 213 -> 218, there is the following code: ManageableCollection col = createCollection(collectionClass); for (Iterator it2 = list.iterator(); it2.hasNext();) { col.ojbAdd(it2.next()); } result = col; What would be the impact to replace it with the following. IMHO, it would improve performance a little, and avoid creating unnecessary collections. ManageableCollection col = null; for (Iterator it2 = list.iterator(); it2.hasNext();) { if (col == null) { col = createCollection(collectionClass); } col.ojbAdd(it2.next()); } result = col; Another way to solve my problem is to implement my own PersistentField class that avoids setting empty collections on nested object if they are not created yet, but i guess the one above is better. Regards, Guillaume Nodet - 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] -- Larry V. Streepy, Jr. Senior Vice President and CTO
RE: Collection prefetching patch
I submit another patch that corrects my problem: In AbstractPersistentField, lines 321 -> 328 replace the code String name = fieldName.substring(0, index); PersistentField pField = createInternPersistentField(realClass, name); Object attrib = pField.get(realObj); if (attrib != null || value != null) { if (attrib == null) { by the following code: String name = fieldName.substring(0, index); PersistentField pField = createInternPersistentField(realClass, name); Object attrib = pField.get(realObj); if (attrib != null || (value != null && (!(value instanceof Collection) || ((Collection) value).size() > 0))) { if (attrib == null) { -Message d'origine- De : Guillaume Nodet [mailto:[EMAIL PROTECTED] Envoye : mercredi 4 fevrier 2004 09:40 A : OJB Users List Objet : Collection prefetching patch I saw that ojb do automatically create empty collections and set them to the appropriate field even if they are empty. In my own, case, this appears with nested objects, and thus it actually creates the nested object despite the fact that it was null when i stored the object. Wouldn't it be better to create the collection only when it is not empty ? In the CollectionPrefetcher, lines 213 -> 218, there is the following code: ManageableCollection col = createCollection(collectionClass); for (Iterator it2 = list.iterator(); it2.hasNext();) { col.ojbAdd(it2.next()); } result = col; What would be the impact to replace it with the following. IMHO, it would improve performance a little, and avoid creating unnecessary collections. ManageableCollection col = null; for (Iterator it2 = list.iterator(); it2.hasNext();) { if (col == null) { col = createCollection(collectionClass); } col.ojbAdd(it2.next()); } result = col; Another way to solve my problem is to implement my own PersistentField class that avoids setting empty collections on nested object if they are not created yet, but i guess the one above is better. Regards, Guillaume Nodet - 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: Criteria with select with no where clause?
That's easy: Query query = new QueryByCriteria(, null) Collection c = broker.getCollectionByQuery(query); From: "Robert S. Sfeir" <[EMAIL PROTECTED]> Reply-To: "OJB Users List" <[EMAIL PROTECTED]> To: OJB Users List <[EMAIL PROTECTED]> Subject: Criteria with select with no where clause? Date: Tue, 03 Feb 2004 23:17:01 -0500 Can't seem to find a method which would allow me to add a criteria to return all records in a table. select * from table without where clause... what's the trick? R - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Learn how to choose, serve, and enjoy wine at Wine @ MSN. http://wine.msn.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Criteria with select with no where clause?
Hennebelle wrote: Hi, You can create an empty criteria and not had clauses, like this : Criteria criteria = new Criteria(); Query query = QueryFactory.newQuery(SitBO.class, criteria); heh, thanks not real obvious. R -Message d'origine- De : Robert S. Sfeir [mailto:[EMAIL PROTECTED] Envoyé : mercredi 4 février 2004 05:17 À : OJB Users List Objet : Criteria with select with no where clause? Can't seem to find a method which would allow me to add a criteria to return all records in a table. select * from table without where clause... what's the trick? R - 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: Criteria with select with no where clause?
Easy: Issue a query where criteria using a "null" as criteria. Best regards, Edson Richter - Original Message - From: Robert S. Sfeir To: OJB Users List Sent: Wednesday, February 04, 2004 1:17 AM Subject: Criteria with select with no where clause? Can't seem to find a method which would allow me to add a criteria to return all records in a table. select * from table without where clause... what's the trick? R - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.576 / Virus Database: 365 - Release Date: 30/1/2004 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Collection prefetching patch
I saw that ojb do automatically create empty collections and set them to the appropriate field even if they are empty. In my own, case, this appears with nested objects, and thus it actually creates the nested object despite the fact that it was null when i stored the object. Wouldn't it be better to create the collection only when it is not empty ? In the CollectionPrefetcher, lines 213 -> 218, there is the following code: ManageableCollection col = createCollection(collectionClass); for (Iterator it2 = list.iterator(); it2.hasNext();) { col.ojbAdd(it2.next()); } result = col; What would be the impact to replace it with the following. IMHO, it would improve performance a little, and avoid creating unnecessary collections. ManageableCollection col = null; for (Iterator it2 = list.iterator(); it2.hasNext();) { if (col == null) { col = createCollection(collectionClass); } col.ojbAdd(it2.next()); } result = col; Another way to solve my problem is to implement my own PersistentField class that avoids setting empty collections on nested object if they are not created yet, but i guess the one above is better. Regards, Guillaume Nodet - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Criteria with select with no where clause?
Hi, You can create an empty criteria and not had clauses, like this : Criteria criteria = new Criteria(); Query query = QueryFactory.newQuery(SitBO.class, criteria); -Message d'origine- De : Robert S. Sfeir [mailto:[EMAIL PROTECTED] Envoyé : mercredi 4 février 2004 05:17 À : OJB Users List Objet : Criteria with select with no where clause? Can't seem to find a method which would allow me to add a criteria to return all records in a table. select * from table without where clause... what's the trick? R - 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]