Re: [Lift] Newbie Question: Problems compiling/running examples

2009-11-26 Thread David Bernard
The latest and older maven-scala-plugin require maven 2.0.9. (I used maven
2.2.1 to build the plugin)

On Mon, Nov 23, 2009 at 05:01, David Pollak
feeder.of.the.be...@gmail.comwrote:

 Try running with Maven 2.2.x

 I think the latest Scala Maven plugin may require a version of Maven newer
 than 2.0.9


 On Sun, Nov 22, 2009 at 7:55 PM, Jcon javarad...@gmail.com wrote:

 Today I cloned the liftweb source from git, and had a couple of
 problems trying to get the examples to run.  Must have missed some
 instructions or something.  What I did:

 1. git clone git://github.com/dpp/liftweb.git
 2. cd liftweb
 3. 'mvn install' which resulted in some errors (didn't save the exact
 message, sorry)
 4. Tried to just run the examples.  'cd lift-examples/example'
 5. 'mvn install' which resulted in test errors:

 Results :

 Tests in error:
  wiki edit HomePage should not have HomePage content define
  wiki edit HomePage should allow edition of HomePage

 Tests run: 2, Failures: 0, Errors: 2, Skipped: 0

 [INFO]
 
 [ERROR] BUILD FAILURE
 [INFO]
 
 [INFO] There are test failures.


 6. Bypassed tests by running 'mvn install -DskipTests' and compile
 worked
 7. 'mvn jetty:run' results in an error:

 ERROR - Failed to Boot
 java.lang.ClassNotFoundException: bootstrap.liftweb.Boot

 My environment:
 Mac running Snow Leopard
 Maven version: 2.0.9
 Java version: 1.6.0_15

 --

 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=.





 --
 Lift, the simply functional web framework http://liftweb.net
 Beginning Scala http://www.apress.com/book/view/1430219890
 Follow me: http://twitter.com/dpp
 Surf the harmonics

  --
 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=.


--

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] Access do Database objects from scala:console

2009-11-26 Thread Marcin Jurczuk
Hello,

Can someone point me how to access data from Box object return by
mapper query:

Here is example (mvn scala:console)

scala new bootstrap.liftweb.Boot().boot

scala import pl.com.company.model._
import pl.com.company.model._

scala import _root_.net.liftweb.mapper._
import _root_.net.liftweb.mapper._

scala var r = RejDocBin.find(By(RejDocBin.DocBinId,4))
r: net.liftweb.common.Box[pl.com.company.model.RejDocBin] = Full
(pl.com.company.model.RejDocBin=
{docbin...@1c10834,docbinid=4,contenttype=image/jpeg,description=})

scala

I need to retrieve contenttype field and check if it is not null
However how to get by RejDocBin object from Box ?
Best regards,

--

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] Re: derby

2009-11-26 Thread opyate
Hi Jack,

There are quite a few examples readily available that comes configured
with Derby:

http://github.com/dpp/liftweb/tree/master/lift-examples/
http://github.com/tjweir/pocketchangeapp

In Boot.scala you'll see a Derby ConnectionManager defined.

If you want to go the JNDI route:

In Boot.scala:

DefaultConnectionIdentifier.jndiName = jdbc/myDS

In web.xml:

resource-ref
descriptionMy Data Source/description
res-ref-namejdbc/myDS/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
/resource-ref

And then in your container context, use these examples:
http://wiki.github.com/opyate/yauser

Good luck,
Juan

On Nov 26, 6:48 am, jack jack.wid...@gmail.com wrote:
 Could somebody point me to a quickstart or tutorial about how to use
 Derby with Lift?

--

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.




Re: [Lift] Access do Database objects from scala:console

2009-11-26 Thread Jeppe Nejsum Madsen
Marcin Jurczuk mjurc...@gmail.com writes:

 Hello,

 Can someone point me how to access data from Box object return by
 mapper query:

[...]

 scala var r = RejDocBin.find(By(RejDocBin.DocBinId,4))
 r: net.liftweb.common.Box[pl.com.company.model.RejDocBin] = Full
 (pl.com.company.model.RejDocBin=
 {docbin...@1c10834,docbinid=4,contenttype=image/jpeg,description=})

 scala

 I need to retrieve contenttype field and check if it is not null
 However how to get by RejDocBin object from Box ?
 Best regards,

There have been many discussions about Box on the list, searching the
archives will bring a lot of info :-)

You can unpack a box in several ways, one is like this:

r.dmap(Empty contenttype)(_.contenttype.is)

or

r.open_! (but this is discouraged use, will throw if the box is empty)

Note Box is similar to Scala's option, so you might take a look here

http://blog.lostlake.org/index.php?/archives/50-The-Scala-Option-class-and-how-lift-uses-it.html

/Jeppe

--

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] Re: Validations

2009-11-26 Thread suls
Thanks David, this did the trick.Out of curiosity: where in the docs
could I have found this information?
http://scala-tools.org/scaladocs/liftweb/1.0/net/liftweb/builtin/snippet/Msgs.html
doesn't seem to be updated ..

- suls

On Nov 25, 8:01 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 On Wed, Nov 25, 2009 at 11:52 AM, suls s...@suls.org wrote:
  Hi guys,

  It seems that I don't completely understand how validations work.. I
  am having a model with the following property:

  object size extends MappedInt(this) {
     override def validations =  validPosition _ :: super.validations

     def validPosition(in: Int): List[FieldError] =
       if (-100 until 101 contains in) Nil
       else List(FieldError(this, bPosition size must not be greater
  than +/- 100/b))
   }

  And in the snippet I do the following:

  pos.validate match {
       case Nil = pos.save; S.notice(Position change 
                                      + pos.size +  for 
                                      + pos.dateOf.asHtml +  successful.)

       case xs = S.error(xs); Log.error(. + xs)
     }

  Now something I cannot explain to myself happens: If the validation
  fails, the error gets logged on the console but not displayed in the
  browser:

  ERROR - .List(Full(position_size) : bPosition size must not be
  greater than +/- 100/b)

  Am I getting something wrong with how validations work?

 In your default template (templates-hidden/default.html) change lift:Msgs
 / to lift:Msgs showAll=true/

 A few months back, we changed MappedFields to having a field identifier.
  The default Msgs does not render error messages on fields with a field
 identifier set.





  Cheers, suls

  --

  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.

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Surf the harmonics

--

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] Re: Access do Database objects from scala:console

2009-11-26 Thread Marcin Jurczuk
Thanks .. read that ...and look and dmap implementation however it
doesn't work like I expected:


scala r.dmap(application/octet-stream)(_.contentType.is)
res49: java.lang.String = null

scala

There should be application/octet-stream result

scala s.dmap(app)(_.contentType.is)
res50: java.lang.String = image/jpeg

scala

That is OK - contentType exists ..


I tried .toString but doesn't work either ..

Best regards,

On 26 Lis, 11:52, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
 Marcin Jurczuk mjurc...@gmail.com writes:
  Hello,

  Can someone point me how to access data from Box object return by
  mapper query:

 [...]

  scala var r = RejDocBin.find(By(RejDocBin.DocBinId,4))
  r: net.liftweb.common.Box[pl.com.company.model.RejDocBin] = Full
  (pl.com.company.model.RejDocBin=
  {docbin...@1c10834,docbinid=4,contenttype=image/jpeg,description=})

  scala

  I need to retrieve contenttype field and check if it is not null
  However how to get by RejDocBin object from Box ?
  Best regards,

 There have been many discussions about Box on the list, searching the
 archives will bring a lot of info :-)

 You can unpack a box in several ways, one is like this:

 r.dmap(Empty contenttype)(_.contenttype.is)

 or

 r.open_! (but this is discouraged use, will throw if the box is empty)

 Note Box is similar to Scala's option, so you might take a look here

 http://blog.lostlake.org/index.php?/archives/50-The-Scala-Option-clas...

 /Jeppe

--

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.




Re: [Lift] derby

2009-11-26 Thread David Pollak
On Wed, Nov 25, 2009 at 10:48 PM, jack jack.wid...@gmail.com wrote:

 Could somebody point me to a quickstart or tutorial about how to use
 Derby with Lift?


Derby is inferior in every way to H2 (another open source pure Java
relational database).  If you're building something for production,
Postgresql is your best choice.  If you need a simple database that needs no
separate process and just works H2 is your best choice.



 --

 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.





-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

--

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.




Re: [Lift] Re: Access do Database objects from scala:console

2009-11-26 Thread Jeppe Nejsum Madsen
Marcin Jurczuk mjurc...@gmail.com writes:

 Thanks .. read that ...and look and dmap implementation however it
 doesn't work like I expected:


 scala r.dmap(application/octet-stream)(_.contentType.is)
 res49: java.lang.String = null

This is (probably) because contentType is null. The dmap only opens the
Box returned from the query. This will be empty if the query fails.

Now you have the result of the query, but the result can still contain a
null value for the field contentType, so you need something like this:

r.dmap(application/octet-stream)(b = if (b.contentType.is == null)
application/octet-stream else b.contentType.is)

or, to be more DRY

r.flatMap(b = Box !! b.contentType.is) openOr application/octet-stream

Basically, unpack the query result and put the contenType in a new box,
unpack everything or return the default :-)

/Jeppe

--

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] Re: Access do Database objects from scala:console

2009-11-26 Thread Marcin Jurczuk


Thanks ! :)

Your solution is much DRY then my :) :

{img.contentType.toString.isEmpty match {
case true = application/
octet-stream
case false =
img.contentType.is.toString}}


Best regards,

On 26 Lis, 15:10, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
 Marcin Jurczuk mjurc...@gmail.com writes:
  Thanks .. read that ...and look and dmap implementation however it
  doesn't work like I expected:

  scala r.dmap(application/octet-stream)(_.contentType.is)
  res49: java.lang.String = null

 This is (probably) because contentType is null. The dmap only opens the
 Box returned from the query. This will be empty if the query fails.

 Now you have the result of the query, but the result can still contain a
 null value for the field contentType, so you need something like this:

 r.dmap(application/octet-stream)(b = if (b.contentType.is == null)
 application/octet-stream else b.contentType.is)

 or, to be more DRY

 r.flatMap(b = Box !! b.contentType.is) openOr application/octet-stream

 Basically, unpack the query result and put the contenType in a new box,
 unpack everything or return the default :-)

 /Jeppe

--

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] Oracle DB connection in 1.1-m7

2009-11-26 Thread suls
Hi,

I see that there is a DriverType and OracleDriver in 1.1-m7 but again
I don't know how to connect the dots.

How would a DB.defineConnectionManager method call that uses an oracle
db look like?

Thanks, suls

--

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.




Re: [Lift] Looking for an example of how to do master detail, on the view side

2009-11-26 Thread Jim Barrows
Excellent.  He's already where I was headed :)

On Wed, Nov 25, 2009 at 8:51 PM, David Pollak feeder.of.the.be...@gmail.com
 wrote:

 Kris blogged about a really nice pattern: http://logji.blogspot.com/

 On Wed, Nov 25, 2009 at 3:16 PM, Jim Barrows jim.barr...@gmail.comwrote:

 I'm using JPA, and need to do a One-Many, or master detail view.  So I
 tried the obvious:
 lift:PersonSnippets.save form=post
 !-- form --
  /lift:PersonSnippets.save
 lift:PersonSnippets.addContactMechanism form=post
 /lift:PersonSnippets.addContactMechanism

 However, the HTML that gets generated is the same form for both.
 Is there an example somewhere I've missed about how to do this?
 --
 James A Barrows

  --
 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.




 --
 Lift, the simply functional web framework http://liftweb.net
 Beginning Scala http://www.apress.com/book/view/1430219890
 Follow me: http://twitter.com/dpp
 Surf the harmonics

  --
 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.




-- 
James A Barrows

--

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.




Re: [Lift] Looking for an example of how to do master detail, on the view side

2009-11-26 Thread Timothy Perrett
Agreed - Kirs' idea is a nice one. It would be good to incorporate such a 
pattern in the lift examples.

Cheers, Tim

On 26 Nov 2009, at 15:42, Jim Barrows wrote:

 Excellent.  He's already where I was headed :)
 
 On Wed, Nov 25, 2009 at 8:51 PM, David Pollak feeder.of.the.be...@gmail.com 
 wrote:
 Kris blogged about a really nice pattern: http://logji.blogspot.com/
 
 On Wed, Nov 25, 2009 at 3:16 PM, Jim Barrows jim.barr...@gmail.com wrote:
 I'm using JPA, and need to do a One-Many, or master detail view.  So I tried 
 the obvious:
 lift:PersonSnippets.save form=post
 !-- form --
  /lift:PersonSnippets.save
 lift:PersonSnippets.addContactMechanism form=post
 /lift:PersonSnippets.addContactMechanism
 
 However, the HTML that gets generated is the same form for both.  
 Is there an example somewhere I've missed about how to do this?
 -- 
 James A Barrows
 
 
 --
 
 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, the simply functional web framework http://liftweb.net
 Beginning Scala http://www.apress.com/book/view/1430219890
 Follow me: http://twitter.com/dpp
 Surf the harmonics
 
 
 --
 
 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.
 
 
 
 -- 
 James A Barrows
 
 
 --
 
 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.

--

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] Re: Oracle DB connection in 1.1-m7

2009-11-26 Thread Mathias Sulser
All right. Figuring out the proper JDBC string was all. Schemifyer
seems to then pick the right driver and produce DDL for the specific
DB.

Great stuff.

On Nov 26, 3:17 pm, suls s...@suls.org wrote:
 Hi,

 I see that there is a DriverType and OracleDriver in 1.1-m7 but again
 I don't know how to connect the dots.

 How would a DB.defineConnectionManager method call that uses an oracle
 db look like?

 Thanks, suls

--

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] Re: Oracle DB connection in 1.1-m7

2009-11-26 Thread Mathias Sulser
I think the MappedBoolean isn't properly done in the OracleDriver:

scala User.findAll(By(User.superUser, false))
java.sql.SQLException: Invalid column type
at oracle.jdbc.driver.DatabaseError.throwSqlException
(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException
(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException
(DatabaseError.java:208)
at oracle.jdbc.driver.OraclePreparedStatement.setObjectCritical
(OraclePreparedStatement.java:9168)
at ora...

And if you look at the generated DDL:

CREATE TABLE USERS
(
   ...
   SUPERUSER decimal(22),
   ...
);

Any hints on how to solve this? Btw, it's a 10g data base

On Nov 26, 4:14 pm, Mathias Sulser s...@suls.org wrote:
 All right. Figuring out the proper JDBC string was all. Schemifyer
 seems to then pick the right driver and produce DDL for the specific
 DB.

 Great stuff.

 On Nov 26, 3:17 pm, suls s...@suls.org wrote:

  Hi,

  I see that there is a DriverType and OracleDriver in 1.1-m7 but again
  I don't know how to connect the dots.

  How would a DB.defineConnectionManager method call that uses an oracle
  db look like?

  Thanks, suls



--

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] simple database question

2009-11-26 Thread jack
I have my database configured properly in Boot.scala and in my
pom.xml. Suppose I have a table name person with a field called name.
What is the simple code to return all rows of this table using Mapper.
I want to understand the essence of how lift ties tables to objects
with a simple example.

--

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] Re: simple database question

2009-11-26 Thread harryh
Here is what you need for a minimal Person table that contains two
columns: an id for the primary key, and name which is a string:

package com.jacksdomain.model

import net.liftweb.mapper._

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

  object name extends MappedString(this, 100)
}

object Person extends Person with LongKeyedMetaMapper[Person] {
  override def dbTableName = person
}

You can then do things like this:

val person = Person.find(1)   // retrieve the person with id = 1 from
the database
val person = Person.find(By(Person.name, Jack)) // retrieve the
person with name = Jack from the database
val people = Person.findAll() // retrieve all people form the database
val people = Person.findAll(By_(Person.id, 10)) // retrieve all the
people with id  10

etc.

-harryh

On Nov 26, 1:39 pm, jack jack.wid...@gmail.com wrote:
 wow. thats impressive. But for this, what does the Person class have
 to look like? Suppose I have the table but I don't have the Person
 class written. What does it need to look like?

 On Nov 26, 1:32 pm, harryh har...@gmail.com wrote:

  val people = Person.findAll()

  On Nov 26, 1:22 pm, jack jack.wid...@gmail.com wrote:

   I have my database configured properly in Boot.scala and in my
   pom.xml. Suppose I have a table name person with a field called name.
   What is the simple code to return all rows of this table using Mapper.
   I want to understand the essence of how lift ties tables to objects
   with a simple example.

--

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.




Re: [Lift] Re: simple database question

2009-11-26 Thread Jack Widman
excellent. Thanks. Just what I needed.

On Thu, Nov 26, 2009 at 2:34 PM, harryh har...@gmail.com wrote:

 Here is what you need for a minimal Person table that contains two
 columns: an id for the primary key, and name which is a string:

 package com.jacksdomain.model

 import net.liftweb.mapper._

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

  object name extends MappedString(this, 100)
 }

 object Person extends Person with LongKeyedMetaMapper[Person] {
  override def dbTableName = person
 }

 You can then do things like this:

 val person = Person.find(1)   // retrieve the person with id = 1 from
 the database
 val person = Person.find(By(Person.name, Jack)) // retrieve the
 person with name = Jack from the database
 val people = Person.findAll() // retrieve all people form the database
 val people = Person.findAll(By_(Person.id, 10)) // retrieve all the
 people with id  10

 etc.

 -harryh

 On Nov 26, 1:39 pm, jack jack.wid...@gmail.com wrote:
  wow. thats impressive. But for this, what does the Person class have
  to look like? Suppose I have the table but I don't have the Person
  class written. What does it need to look like?
 
  On Nov 26, 1:32 pm, harryh har...@gmail.com wrote:
 
   val people = Person.findAll()
 
   On Nov 26, 1:22 pm, jack jack.wid...@gmail.com wrote:
 
I have my database configured properly in Boot.scala and in my
pom.xml. Suppose I have a table name person with a field called name.
What is the simple code to return all rows of this table using
 Mapper.
I want to understand the essence of how lift ties tables to objects
with a simple example.

 --

 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.





-- 
Jack Widman

co-founder / cto,  Authoritude, Inc.

203-641-9355

--

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] Impossible to use Mapper on GAE?

2009-11-26 Thread jlist9
Hi, I read from the list that Mapper is not supported on Google App Engine
(I see people use JPA instead.) I wonder if this is a matter of non-existent
drivers, or there are some fundamental issues that make it impossible?

Thanks,
Jack

--

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.




Re: [Lift] derby

2009-11-26 Thread jlist9
Hi David,

Would you care to elaborate in what way Derby is inferior?
I understand H2 is probably faster as speed is one of its main
design goals. Does Derby have any other issues?

Are there any potential issues with using H2 for production?

Thanks,
Jack

 Derby is inferior in every way to H2 (another open source pure Java
 relational database).  If you're building something for production,
 Postgresql is your best choice.  If you need a simple database that needs no
 separate process and just works H2 is your best choice.

--

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] Re: how does lift work with redis?

2009-11-26 Thread surfman
So, if I want to use nosql database with LIFT, what I have to use is
JDBC driver, am I right?
Any experienced suggestion? Google has very little searching result on
it.
I'd appreciate any idea on this topic. Thanks.

Regards,

Surfman

On 11月25日, 下午4时06分, Timothy Perrett timo...@getintheloop.eu wrote:
 Correct - Redis is a nosql database, mapper is only for RDBMS

 Cheers, Tim

 On 25 Nov 2009, at 20:13, surfman wrote:



  Thanks. Does it mean I may not use lift mapper and I have to write
  everything for database manipulation?

  regards,

  surfman

  On 11月24日, 下午5时12分, Timothy Perrett timo...@getintheloop.eu wrote:
  There is no out of the box implementation. You could write a record  
  back end though - it depends on the features you want I guess.

  Cheers, Tim

  Sent from my iPhone

  On 24 Nov 2009, at 22:00, surfman chinasmile...@gmail.com wrote:

  Is there anything I could learn on how lift works with redis database?
  Thanks.

  --

  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 
  athttp://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 
  athttp://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.