Re: [Lift] Multi-Ćolumn MappedField

2009-12-10 Thread Derek Chen-Becker
IMHO this doesn't sound like an ideal way to do this. At a high level what
are you trying to do? Is this a legacy DB or starting from scratch? If I had
to do something like this I would instead use something like
MappedLongForeignKey so that you have a direct reference to the other tables
instead of having to do it manually. Something like:

class C extends LongKeyedMapper[C] with IdPK {
  def getSingleton = C

  object refA extends MappedLongForeignKey(this,A)
  object refB extends MappedLongForeignKey(this,B)

  def getRef = refA.obj or refB.obj

  def setRef(obj : A) = refA(obj); refB(Empty)
  def setRef(obj : B) = refB(obj); refA(Empty)
}

Derek

On Wed, Dec 9, 2009 at 9:44 PM, Joern joern.bernha...@gmx.net wrote:

 Hi there,

 I want to create a MappedField, which has one column as Type Long and
 another column as Type Boolean, but I don't know, what I should put
 into dbFieldClass and/or targetSQLType. If I look at MappedPassword
 for example, I just see classOf[String] or Types.VARCHAR, which
 somehow makes sense, because all columns of the MappedPassword are
 Strings. How can I create such a MappedField ?

 Or maybe there is a completely different and/or better way to approach
 my problem:
 I have two tables (A and B), which are represented by my own mapper
 classes having IdPK.
 In a third table (let's call it C), I want to reference an instance of
 A or B in table C. As mentioned above, I want to say for example that
 Boolean false means look in table A for the Long (=index) and true
 - look in table B.

 Any tips, pointers or links to more documentation about multi-column
 mappedfields? :)

 Thanks,
 Joern

 --

 You received this message because you are subscribed to the Google Groups
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.




--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.




[Lift] Multi-Ćolumn MappedField

2009-12-09 Thread Joern
Hi there,

I want to create a MappedField, which has one column as Type Long and
another column as Type Boolean, but I don't know, what I should put
into dbFieldClass and/or targetSQLType. If I look at MappedPassword
for example, I just see classOf[String] or Types.VARCHAR, which
somehow makes sense, because all columns of the MappedPassword are
Strings. How can I create such a MappedField ?

Or maybe there is a completely different and/or better way to approach
my problem:
I have two tables (A and B), which are represented by my own mapper
classes having IdPK.
In a third table (let's call it C), I want to reference an instance of
A or B in table C. As mentioned above, I want to say for example that
Boolean false means look in table A for the Long (=index) and true
- look in table B.

Any tips, pointers or links to more documentation about multi-column
mappedfields? :)

Thanks,
Joern

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.