Re: Default column values?

Anthony & Melissa Berglas <[email protected]>
Newsgroups gmane.comp.java.orm.simpleorm
Message-ID <[email protected]>
You raise a valid point though.  Maybe 
setInitialValue rather than setDerfault.  And we 
should think about triggers and dirty behaviors 
to enable explicit implementations.  I've made a note.

Anthony

At 10:18 AM 13/11/2008, you wrote:

>#1 is all I'm getting at. Setting them 
>constructor sounds fine, I just thought it would 
>be nice to define them "next to" the field, like:
>
>public static final SFieldString MyValue = new 
>SFieldString(MYRECORD, "MyValue").setDefault("Hello World");
>
>
>Regards,
>Carl
>
>On Wed Nov 12 16:13:09 PST 2008, Anthony Berglas wrote:
>Hmm. Defaulting can mean a number of things. 1. 
>Values to be set to the fields when a record is 
>initially created. 2. Values to be written to 
>the database when a field is null. 3. Values to 
>be set to fields when a record is read and the 
>column in the database is null. 3a. This is 
>marked dirty, so database column always updated 
>if it had been null. 3b. This is not marked 
>dirty and does not update upon write. 4. DDL to 
>be added to Create Table statement. 5. Values 
>that are not constants but default from other 
>records. Eg. Department.Default_Salary. 5a. When 
>the record is created or the column is null. 5b. 
>Each time the record is read if no value has 
>been set. Do not write default value back to the 
>database. 6. Various combinations of the above. 
>For the first case you can just use an ordinary 
>class constructor to set the field values. Maybe 
>we should add an example. The other cases get a 
>bit messy. Which should be supported? DDL is non 
>standard between databases. 5b could be the most 
>powerful, but also the most complex. How useful 
>are they really, or should we just say no? 
>Anthony At 06:16 PM 12/11/2008, you 
>wrote: >Hi, > >you're not missing anything, and 
>a default value would indeed be a >valuable 
>feature. > >I think we could think of it, to 
>find where it would best fit 
>: >rmeta.newRecordInstance, or at a higher 
>level, like dataSet.create(), >createDetached, 
>... > >Did you already think about it ? > >Le 
>mercredi 12 novembre 2008 Ã 00:18 +0000, cg_ia a 
>écrit : > > Is there no notion of a column's 
>default value is SimpleORM? For > > example, 
>when I call SDataSet.create() or 
>SSessionJdbc.create(), I'd > > like the 
>SRecordInstance that is returned to have default 
>values set > > on most of its fields. Generators 
>don't seem to fill this roll as far > > as I can 
>tell, they are only for generating primary key 
>values. > > > > I know I can add this 
>functionality by putting my own user 
>property > > on > > my SFieldMetas, and wrapping 
>the create() calls, I just wanted to > > 
>make > > sure I wasn't missing any built-in 
>functionality. > > > > > > > > > > > > Dr 
>Anthony Berglas, [email protected] Mobile: +61 
>4 4838 8874 Just because it is possible to push 
>twigs along the ground with ones nose does not 
>necessarily mean that is the best way to collect 
>firewood. ------------------------------------ 
>Yahoo! Groups Links *> To visit your group on 
>the web, go to: 
>http://groups.yahoo.com/group/SimpleORM/ *> Your 
>email settings: Individual Email | Traditional 
>*> To change settings online go to: 
>http://groups.yahoo.com/group/SimpleORM/join 
>(Yahoo! ID required) *> To change settings via 
>email: mailto:[email protected] 
>mailto:[email protected] *> 
>To unsubscribe from this group, send an email 
>to: [email protected] *> 
>Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
>
>


Spreadsheet Detective,
Southern Cross Software Queensland Pty Limited
54 Gerler Street
Bardon, Queensland 4065, Australia.

Email: [email protected]
www.SpreadsheetDetective.com
Ph: +61 427 830248 (Australian Eastern Standard Time)

"If the model seems correct only because the numbers look right,
then why build the model in the first place?"

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/SimpleORM/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/SimpleORM/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[email protected] 
    mailto:[email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
1c39ac1.jpg (image/jpeg, 3.3 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.