I'm probably missing something here, but wouldn't putting those 5 lines of
code into a trait work?

trait ManualValue {
       /* allow user-defined primary key */
       override def writePermission_? = true
       override def dbAutogenerated_? = false
       private var myDirty = false
       override def dirty_? = myDirty
       override def dirty_?(b : Boolean) = { myDirty = b; super.dirty_?(b) }
}

object myId extends MappedLongIndex(this) with ManualValue

If that does work, I don't see any issue with adding that trait to the
Mapper library for others to use...

Derek

On Tue, Aug 25, 2009 at 12:42 PM, Naftoli Gugenheim <[email protected]>wrote:

>
>
> On Tue, Aug 25, 2009 at 2:31 PM, David Pollak <
> [email protected]> wrote:
>
>>
>>
>> On Tue, Aug 25, 2009 at 10:56 AM, Naftoli Gugenheim <[email protected]
>> > wrote:
>>
>>> It definitely would have been an option, although it would have been
>>> more difficult due to the complex structure of the new database. But I
>>> want to understand why it can't work the way I thought it would.
>>
>>
>>
>> Peter provided code that allows you to override autogeneration of keys.
>>
>
> Like I said, it doesn't make sense to add 5 lines of code to 13 mappers
> each just to make importing simpler. That code is good for a
> non-autogenerated primary key.
>
> Why does it work the way it does?  Because in the nearly 3 year life of
>> Mapper, you're the first person that's asked for the feature.  Because the
>> cost of changing Mapper to work differently (especially when there's a
>> work-around) and testing it and making sure it doesn't break isn't worth it.
>>
> Well, I can't argue with that...
>
> But is it really so complicated to change? Would the following not cover
> all the bases?
> 1) A private var on the mapper, _saved_? etc., initialized to false
> 2) When find etc. creates an instance it uses reflection to set this
> variable to true
> 3) When save is successful it sets this variable to true
> 4) def saved_? returns the value of the var.
> Wouldn't that be more accurate from a logical standpoint? I'm not coming
> from the angle of, "I have a use case for a feature," but from, "doesn't
> this use case bring out a hole in the logic and demonstrate that the index
> can be nondefault and still represent a new record (aside from MSAccess)?"
>
> Regards
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to