Thomas, Can I specify conversion not for a particular field in table but let's say for all DATE type fields in a database?
-Sergey -----Original Message----- From: Thomas Mahler [mailto:[EMAIL PROTECTED] Sent: Thursday, February 05, 2004 1:37 AM To: OJB Users List Subject: 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: >>> >>> <field-descriptor >>> 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] >> >> >> >> > --------------------------------------------------------------------- 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]
