[Lift] Re: Error shutting down Jetty instance

2009-06-23 Thread David Pollak
Just checked in a patch.  Please let me know if it works.

On Tue, Jun 23, 2009 at 9:23 PM, Nolan Darilek wrote:

>
> I've been getting this huge backtrace when shutting down Jetty. This
> probably isn't as much of an issue on mvn, but I'm using SBT, and it'd
> be nice to not need to restart the SBT instance to restart Jetty. I also
> just tried mvn jetty:run and saw nearly identical behavior, so it
> doesn't appear to be SBT. Is there a work-around?
>
> ERROR - Servlet destruction failure
> java.lang.RuntimeException: snapshot operation not supported.
> at scala.Predef$.error(Predef.scala:76)
> at scala.actors.Scheduler$.snapshot(Scheduler.scala:53)
> at net.liftweb.http.LiftServlet.destroy(LiftServlet.scala:58)
> at net.liftweb.http.LiftFilter.destroy(LiftServlet.scala:546)
> at
>
> org.mortbay.jetty.servlet.FilterHolder.destroyInstance(FilterHolder.java:127)
> at org.mortbay.jetty.servlet.FilterHolder.doStop(FilterHolder.java:107)
> at
> org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:78)
> at
> org.mortbay.jetty.servlet.ServletHandler.doStop(ServletHandler.java:162)
> at
> org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:78)
> at
> org.mortbay.jetty.handler.HandlerWrapper.doStop(HandlerWrapper.java:142)
> at
> org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:78)
> at
> org.mortbay.jetty.handler.HandlerWrapper.doStop(HandlerWrapper.java:142)
> at
> org.mortbay.jetty.servlet.SessionHandler.doStop(SessionHandler.java:124)
> at
> org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:78)
> at
> org.mortbay.jetty.handler.HandlerWrapper.doStop(HandlerWrapper.java:142)
> at
> org.mortbay.jetty.handler.ContextHandler.doStop(ContextHandler.java:591)
> at
> org.mortbay.jetty.webapp.WebAppContext.doStop(WebAppContext.java:498)
> at
> org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:78)
> at
> org.mortbay.jetty.handler.HandlerWrapper.doStop(HandlerWrapper.java:142)
> at org.mortbay.jetty.Server.doStop(Server.java:281)
> at
> org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:78)
> at sbt.LazyJettyRun$StopServer.stop(WebApp.scala:177)
> at sbt.JettyRun$$anonfun$stop$1.apply(WebApp.scala:24)
> at sbt.JettyRun$$anonfun$stop$1.apply(WebApp.scala:24)
> at scala.Option.foreach(Option.scala:94)
> at sbt.JettyRun$.stop(WebApp.scala:24)
> at
> sbt.WebScalaProject$$anonfun$jettyStopTask$1.apply(ScalaProject.scala:335)
> at
> sbt.WebScalaProject$$anonfun$jettyStopTask$1.apply(ScalaProject.scala:335)
> at sbt.TaskManager$Task.invoke(TaskManager.scala:58)
> at sbt.impl.RunTask.runTask(RunTask.scala:78)
> at sbt.impl.RunTask.run(RunTask.scala:31)
> at sbt.impl.RunTask$.apply(RunTask.scala:16)
> at sbt.impl.RunTask$.apply(RunTask.scala:15)
> at sbt.Project$class.run(Project.scala:95)
> at sbt.Project$class.act(Project.scala:126)
> at sbt.BasicScalaProject.act(DefaultProject.scala:19)
> at sbt.Main$$anonfun$10.apply(Main.scala:376)
> at sbt.Main$$anonfun$10.apply(Main.scala:376)
> at sbt.Main$.withAction(Main.scala:408)
> at sbt.Main$.sbt$Main$$handleAction(Main.scala:376)
> at sbt.Main$.sbt$Main$$handleBatchCommand(Main.scala:343)
> at sbt.Main$$anonfun$3.apply(Main.scala:118)
> at sbt.Main$$anonfun$3.apply(Main.scala:118)
> at sbt.Control$.lazyFold(Control.scala:54)
> at sbt.Main$.startProject(Main.scala:118)
> at sbt.Main$.run(Main.scala:76)
> at sbt.Main.run(Main.scala)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at sbt.boot.Boot$.run(Boot.scala:89)
> at sbt.boot.Boot$.load(Boot.scala:76)
> at sbt.boot.Boot$.doLoad$1(Boot.scala:59)
> at sbt.boot.Boot$.runBatch(Boot.scala:62)
> at sbt.boot.Boot$.boot(Boot.scala:55)
> at sbt.boot.Boot$.main(Boot.scala:31)
> at sbt.boot.Boot.main(Boot.scala)
>
>
> >
>


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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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] Error shutting down Jetty instance

2009-06-23 Thread Nolan Darilek

I've been getting this huge backtrace when shutting down Jetty. This 
probably isn't as much of an issue on mvn, but I'm using SBT, and it'd 
be nice to not need to restart the SBT instance to restart Jetty. I also 
just tried mvn jetty:run and saw nearly identical behavior, so it 
doesn't appear to be SBT. Is there a work-around?

ERROR - Servlet destruction failure
java.lang.RuntimeException: snapshot operation not supported.
 at scala.Predef$.error(Predef.scala:76)
 at scala.actors.Scheduler$.snapshot(Scheduler.scala:53)
 at net.liftweb.http.LiftServlet.destroy(LiftServlet.scala:58)
 at net.liftweb.http.LiftFilter.destroy(LiftServlet.scala:546)
 at 
org.mortbay.jetty.servlet.FilterHolder.destroyInstance(FilterHolder.java:127)
 at org.mortbay.jetty.servlet.FilterHolder.doStop(FilterHolder.java:107)
 at 
org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:78)
 at 
org.mortbay.jetty.servlet.ServletHandler.doStop(ServletHandler.java:162)
 at 
org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:78)
 at 
org.mortbay.jetty.handler.HandlerWrapper.doStop(HandlerWrapper.java:142)
 at 
org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:78)
 at 
org.mortbay.jetty.handler.HandlerWrapper.doStop(HandlerWrapper.java:142)
 at 
org.mortbay.jetty.servlet.SessionHandler.doStop(SessionHandler.java:124)
 at 
org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:78)
 at 
org.mortbay.jetty.handler.HandlerWrapper.doStop(HandlerWrapper.java:142)
 at 
org.mortbay.jetty.handler.ContextHandler.doStop(ContextHandler.java:591)
 at 
org.mortbay.jetty.webapp.WebAppContext.doStop(WebAppContext.java:498)
 at 
org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:78)
 at 
org.mortbay.jetty.handler.HandlerWrapper.doStop(HandlerWrapper.java:142)
 at org.mortbay.jetty.Server.doStop(Server.java:281)
 at 
org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:78)
 at sbt.LazyJettyRun$StopServer.stop(WebApp.scala:177)
 at sbt.JettyRun$$anonfun$stop$1.apply(WebApp.scala:24)
 at sbt.JettyRun$$anonfun$stop$1.apply(WebApp.scala:24)
 at scala.Option.foreach(Option.scala:94)
 at sbt.JettyRun$.stop(WebApp.scala:24)
 at 
sbt.WebScalaProject$$anonfun$jettyStopTask$1.apply(ScalaProject.scala:335)
 at 
sbt.WebScalaProject$$anonfun$jettyStopTask$1.apply(ScalaProject.scala:335)
 at sbt.TaskManager$Task.invoke(TaskManager.scala:58)
 at sbt.impl.RunTask.runTask(RunTask.scala:78)
 at sbt.impl.RunTask.run(RunTask.scala:31)
 at sbt.impl.RunTask$.apply(RunTask.scala:16)
 at sbt.impl.RunTask$.apply(RunTask.scala:15)
 at sbt.Project$class.run(Project.scala:95)
 at sbt.Project$class.act(Project.scala:126)
 at sbt.BasicScalaProject.act(DefaultProject.scala:19)
 at sbt.Main$$anonfun$10.apply(Main.scala:376)
 at sbt.Main$$anonfun$10.apply(Main.scala:376)
 at sbt.Main$.withAction(Main.scala:408)
 at sbt.Main$.sbt$Main$$handleAction(Main.scala:376)
 at sbt.Main$.sbt$Main$$handleBatchCommand(Main.scala:343)
 at sbt.Main$$anonfun$3.apply(Main.scala:118)
 at sbt.Main$$anonfun$3.apply(Main.scala:118)
 at sbt.Control$.lazyFold(Control.scala:54)
 at sbt.Main$.startProject(Main.scala:118)
 at sbt.Main$.run(Main.scala:76)
 at sbt.Main.run(Main.scala)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at sbt.boot.Boot$.run(Boot.scala:89)
 at sbt.boot.Boot$.load(Boot.scala:76)
 at sbt.boot.Boot$.doLoad$1(Boot.scala:59)
 at sbt.boot.Boot$.runBatch(Boot.scala:62)
 at sbt.boot.Boot$.boot(Boot.scala:55)
 at sbt.boot.Boot$.main(Boot.scala:31)
 at sbt.boot.Boot.main(Boot.scala)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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: Can't embed a snippet

2009-06-23 Thread David Pollak
On Tue, Jun 23, 2009 at 9:09 PM, Nolan Darilek wrote:

>
> Cool deal, mvn test showed me the issue.
>
> Apparently, templates can only have a single element, I had an  and
> a . The book called it a fragment, so this wasn't entirely clear. In
> any case, I put a div#welcome around it and now it works fine. Thanks
> for the pointer.


It's the problem of the day... you're the third person that's had the exact
same issue. :-)


>
>
>
> >
>


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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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: Can't embed a snippet

2009-06-23 Thread Nolan Darilek

Cool deal, mvn test showed me the issue.

Apparently, templates can only have a single element, I had an  and 
a . The book called it a fragment, so this wasn't entirely clear. In 
any case, I put a div#welcome around it and now it works fine. Thanks 
for the pointer.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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: Can't embed a snippet

2009-06-23 Thread David Pollak
I just implemented the code at:
http://github.com/dpp/lift_1_1_sample/tree/master

Also, please do an mvn test
which will make sure all your templates are well formed XML

On Tue, Jun 23, 2009 at 8:37 PM, Nolan Darilek wrote:

>
> On 06/23/2009 09:43 PM, David Pollak wrote:
> > try /templates-hidden/welcome
> >
>
>   
>
>
>
> >
>


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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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: Can't embed a snippet

2009-06-23 Thread Nolan Darilek

On 06/23/2009 09:43 PM, David Pollak wrote:
> try /templates-hidden/welcome
>

   



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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: Can't embed a snippet

2009-06-23 Thread David Pollak
On Tue, Jun 23, 2009 at 5:52 PM, Nolan Darilek wrote:

>
> OK, finally introducing the first bit of user dynamicity into my app. I
> want my homepage to contain a bit of homepagy-type intro stuff for
> logged-out users, but a dashboard-like interface when someone is logged
> in. So I have this in index.html:
>
> 
> 
> Welcome back
>
> Thanks for logging in.
> 
> 
>
> And the following Home snippet:
>
> package info.thewordnerd.therascribe.snippet
>
> import scala.xml.NodeSeq
> import net.liftweb.util._
>
> import info.thewordnerd.therascribe.model._
>
> class Home {
>   def render(in: NodeSeq): NodeSeq = User.currentUser match {
> case Full(user) => {
> Thanks again for logging in.
> }
> case _ => 
>   }
>
> }
>
> But I get a comment in my rendered HTML telling me that the welcome
> template isn't found. This happens regardless of whether I refer to it
> as just welcome or templates-hidden/welcome.


try /templates-hidden/welcome


>
>
> My code is inspired by an example from the Mastering Lift book, where a
> welcome_msg template from templates-hidden is embedded in the homepage.
> I'm guessing this behavior was changed post 1.0? If so, do I just place
> welcome.html in my webapp directory now?
>
>
> >
>


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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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] Can't embed a snippet

2009-06-23 Thread Nolan Darilek

OK, finally introducing the first bit of user dynamicity into my app. I 
want my homepage to contain a bit of homepagy-type intro stuff for 
logged-out users, but a dashboard-like interface when someone is logged 
in. So I have this in index.html:



Welcome back

Thanks for logging in.



And the following Home snippet:

package info.thewordnerd.therascribe.snippet

import scala.xml.NodeSeq
import net.liftweb.util._

import info.thewordnerd.therascribe.model._

class Home {
   def render(in: NodeSeq): NodeSeq = User.currentUser match {
 case Full(user) => {
Thanks again for logging in.
 }
 case _ => 
   }

}

But I get a comment in my rendered HTML telling me that the welcome 
template isn't found. This happens regardless of whether I refer to it 
as just welcome or templates-hidden/welcome.

My code is inspired by an example from the Mastering Lift book, where a 
welcome_msg template from templates-hidden is embedded in the homepage. 
I'm guessing this behavior was changed post 1.0? If so, do I just place 
welcome.html in my webapp directory now?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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: [scala] JPA question

2009-06-23 Thread Oliver Lambert
Actually, I don't think I would be looking at @MappedSuperclass either.
Whats your database schema? Is it always a Legacy database or are you
creating it new?
Are the java entities you are trying to create, read only?
Why aren't you using Scala's JPA?
If you are creating a complex parent-child relationships, cant you use
one-many relationships in hibernate
rather than bothering with Hibernates object-superclass implementation?

I have seen Hibernate used to map complex relationships in production, but
when I see an OR-mapping
problem I always try KISS principles on it first. Sometimes this involves
creating views, sometimes it involves just completely lying to Hibernate
about the underling data structure and creating
a Read only entity.
For example I have a the following entity that maps to a select (not a table
or view)
class RoEntity {
  @Id
  var entityId: Long = _
...
}
EM.createNativeQuery[RoEntity](nativeQueryStr, classOf[RoEntity])

If I want to save it, I populate an entity that really has an underlying
table.

cheers
Oliver

On Wed, Jun 24, 2009 at 9:55 AM, Oliver Lambert  wrote:

> I don't understand from the code sample why AbstractContainer has to be an
> entity or
> have a table or id annotation. I'd be looking at just using the
> @MappedSuperclass annotation.
>
>
> On Wed, Jun 24, 2009 at 9:27 AM, Meredith Gregory <
> lgreg.mered...@gmail.com> wrote:
>
>> Kris,
>>
>> Thanks for this code sample. i will study and see if it offers a way
>> around the conundrum. In the meantime, here's a code 
>> sampleillustrating
>>  exactly what i'm talking about.
>>
>> Best wishes,
>>
>> --greg
>>
>>
>> On Tue, Jun 23, 2009 at 2:21 PM, Kris Nuttycombe <
>> kris.nuttyco...@gmail.com> wrote:
>>
>>>
>>> Oops, forgot a member of the hierarchy, inline below:
>>>
>>> On Tue, Jun 23, 2009 at 3:19 PM, Kris
>>> Nuttycombe wrote:
>>> > I'm just so puzzled by this thread because I have the following entity
>>> > hierarchy in my app:
>>> >
>>> > @Entity
>>> > @Inheritance(strategy = InheritanceType.JOINED)
>>> > @Table(name = "payment_source_transaction")
>>> > public abstract class PaymentSourceTransaction>> PaymentSource>
>>> >extends SubscriptionTransaction implements
>>> > MonetaryTransaction, Serializable {
>>> >
>>> >@ManyToOne(cascade = {CascadeType.MERGE, CascadeType.PERSIST},
>>> > optional = false, targetEntity = PaymentSource.class)
>>> >private T paymentSource;
>>> >
>>> >...
>>> > }
>>> >
>>> > @Entity
>>> > public abstract class CreditCardTransaction extends
>>> > PaymentSourceTransaction { ... }
>>> >
>>>
>>> @MappedSuperclass
>>> public abstract class VoidableCCTransaction extends
>>> CreditCardTransaction implements Serializable { ... }
>>>
>>>@OneToOne(cascade = {CascadeType.MERGE, CascadeType.PERSIST},
>>> mappedBy="voidedTransaction")
>>>private CCVoidTransaction voidTransaction;
>>>
>>> > @Entity
>>> > public class CCAuthTransaction extends VoidableCCTransaction
>>> > implements AuthTransaction, Divisional, Serializable { ..
>>> > }
>>> >
>>> > @Entity
>>> > @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
>>> > public abstract class CCCaptureTransaction extends
>>> > VoidableCCTransaction implements Serializable,
>>> > CaptureTransaction {
>>> >private static final long serialVersionUID = 1L;
>>> >
>>> >@OneToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
>>> >private CCAuthTransaction authTransaction;
>>> >
>>> >...
>>> > }
>>> >
>>> > @Entity
>>> > public class EcometryCaptureTransaction extends CCCaptureTransaction
>>> > implements EcometryOrder, Serializable { ... }
>>> >
>>> > @Entity
>>> > @Inheritance(strategy = InheritanceType.JOINED)
>>> > public abstract class PaymentSource>
>>> > extends UUEntity implements MutationControlled, Serializable { ...
>>> > }
>>> >
>>> > @Entity
>>> > public class CreditCard extends PaymentSource implements
>>> > Addressable, Serializable { ... }
>>> >
>>> > @Entity
>>> > public class CheckingAccount extends PaymentSource
>>> > implements Serializable { ... }
>>> >
>>> > This works for me without difficulty. What am I missing that is
>>> > different about this scheme than the one that you describe?
>>> >
>>> > Kris
>>> >
>>> >
>>> >
>>> > On Tue, Jun 23, 2009 at 11:29 AM, Meredith
>>> > Gregory wrote:
>>> >> Derek,
>>> >>
>>> >> i completely concur. i wanted to give it a serious go, however, before
>>> i
>>> >> abandoned it. The issue is that so much of the incumbent technology
>>> goes
>>> >> across this object-relational boundary, i needed a simple case to
>>> justify
>>> >> walking away from this technology. This example provides it. To see
>>> just how
>>> >> non-complex it is, let me state it in common sense terms.
>>> >>
>>> >> Suppose we are building an app for a manufacturing firm, and the firm
>>> ships
>>> >> out its goods in different kinds of containers: plastic-coated
>>> cardboard
>>> >> boxes, metal boxes, etc.
>>> >

[Lift] Re: [scala] JPA question

2009-06-23 Thread Meredith Gregory
Oliver,

Thanks. This proposal has been put forward before.

   - The code is generated. If the top class is annotated @MappedSuperclass,
   why not label every abstract class that is top of its hierarchy
   @MappedSuperclass. That's the simplest change to the compilation strategy
   that generates this code.
   - This fails for the contained element. Specifically, if you also label
   the top of the contained element hierarchy @MappedSuperclass, then hibernate
   fails to be able to find the Id of the subclasses.
   - Futher, how does the compilation scheme know which top class is
   contained. That's not possible because someone could always come along and
   add another class that was a container. So, this fails to be compositional,
   in the extreme.


Best wishes,

--greg

On Tue, Jun 23, 2009 at 4:55 PM, Oliver Lambert  wrote:

> I don't understand from the code sample why AbstractContainer has to be an
> entity or
> have a table or id annotation. I'd be looking at just using the
> @MappedSuperclass annotation.
>
>
> On Wed, Jun 24, 2009 at 9:27 AM, Meredith Gregory <
> lgreg.mered...@gmail.com> wrote:
>
>> Kris,
>>
>> Thanks for this code sample. i will study and see if it offers a way
>> around the conundrum. In the meantime, here's a code 
>> sampleillustrating
>>  exactly what i'm talking about.
>>
>> Best wishes,
>>
>> --greg
>>
>>
>> On Tue, Jun 23, 2009 at 2:21 PM, Kris Nuttycombe <
>> kris.nuttyco...@gmail.com> wrote:
>>
>>>
>>> Oops, forgot a member of the hierarchy, inline below:
>>>
>>> On Tue, Jun 23, 2009 at 3:19 PM, Kris
>>> Nuttycombe wrote:
>>> > I'm just so puzzled by this thread because I have the following entity
>>> > hierarchy in my app:
>>> >
>>> > @Entity
>>> > @Inheritance(strategy = InheritanceType.JOINED)
>>> > @Table(name = "payment_source_transaction")
>>> > public abstract class PaymentSourceTransaction>> PaymentSource>
>>> >extends SubscriptionTransaction implements
>>> > MonetaryTransaction, Serializable {
>>> >
>>> >@ManyToOne(cascade = {CascadeType.MERGE, CascadeType.PERSIST},
>>> > optional = false, targetEntity = PaymentSource.class)
>>> >private T paymentSource;
>>> >
>>> >...
>>> > }
>>> >
>>> > @Entity
>>> > public abstract class CreditCardTransaction extends
>>> > PaymentSourceTransaction { ... }
>>> >
>>>
>>> @MappedSuperclass
>>> public abstract class VoidableCCTransaction extends
>>> CreditCardTransaction implements Serializable { ... }
>>>
>>>@OneToOne(cascade = {CascadeType.MERGE, CascadeType.PERSIST},
>>> mappedBy="voidedTransaction")
>>>private CCVoidTransaction voidTransaction;
>>>
>>> > @Entity
>>> > public class CCAuthTransaction extends VoidableCCTransaction
>>> > implements AuthTransaction, Divisional, Serializable { ..
>>> > }
>>> >
>>> > @Entity
>>> > @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
>>> > public abstract class CCCaptureTransaction extends
>>> > VoidableCCTransaction implements Serializable,
>>> > CaptureTransaction {
>>> >private static final long serialVersionUID = 1L;
>>> >
>>> >@OneToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
>>> >private CCAuthTransaction authTransaction;
>>> >
>>> >...
>>> > }
>>> >
>>> > @Entity
>>> > public class EcometryCaptureTransaction extends CCCaptureTransaction
>>> > implements EcometryOrder, Serializable { ... }
>>> >
>>> > @Entity
>>> > @Inheritance(strategy = InheritanceType.JOINED)
>>> > public abstract class PaymentSource>
>>> > extends UUEntity implements MutationControlled, Serializable { ...
>>> > }
>>> >
>>> > @Entity
>>> > public class CreditCard extends PaymentSource implements
>>> > Addressable, Serializable { ... }
>>> >
>>> > @Entity
>>> > public class CheckingAccount extends PaymentSource
>>> > implements Serializable { ... }
>>> >
>>> > This works for me without difficulty. What am I missing that is
>>> > different about this scheme than the one that you describe?
>>> >
>>> > Kris
>>> >
>>> >
>>> >
>>> > On Tue, Jun 23, 2009 at 11:29 AM, Meredith
>>> > Gregory wrote:
>>> >> Derek,
>>> >>
>>> >> i completely concur. i wanted to give it a serious go, however, before
>>> i
>>> >> abandoned it. The issue is that so much of the incumbent technology
>>> goes
>>> >> across this object-relational boundary, i needed a simple case to
>>> justify
>>> >> walking away from this technology. This example provides it. To see
>>> just how
>>> >> non-complex it is, let me state it in common sense terms.
>>> >>
>>> >> Suppose we are building an app for a manufacturing firm, and the firm
>>> ships
>>> >> out its goods in different kinds of containers: plastic-coated
>>> cardboard
>>> >> boxes, metal boxes, etc.
>>> >> Suppose that different kinds of materials go into different kinds of
>>> boxes,
>>> >> and sometimes medicinal or toxic substances go into these containers;
>>> but,
>>> >> every container gets a manifest. When the container contains these
>>> materials
>>> >

[Lift] Re: [scala] JPA question

2009-06-23 Thread Meredith Gregory
Kris,

Do you have a self-contained, compilable sample i could compare to the one i
made? i can craft one from your snippet below, but it'd be a better
comparison if you had one already.

Best wishes,

--greg

On Tue, Jun 23, 2009 at 2:21 PM, Kris Nuttycombe
wrote:

>
> Oops, forgot a member of the hierarchy, inline below:
>
> On Tue, Jun 23, 2009 at 3:19 PM, Kris
> Nuttycombe wrote:
> > I'm just so puzzled by this thread because I have the following entity
> > hierarchy in my app:
> >
> > @Entity
> > @Inheritance(strategy = InheritanceType.JOINED)
> > @Table(name = "payment_source_transaction")
> > public abstract class PaymentSourceTransaction PaymentSource>
> >extends SubscriptionTransaction implements
> > MonetaryTransaction, Serializable {
> >
> >@ManyToOne(cascade = {CascadeType.MERGE, CascadeType.PERSIST},
> > optional = false, targetEntity = PaymentSource.class)
> >private T paymentSource;
> >
> >...
> > }
> >
> > @Entity
> > public abstract class CreditCardTransaction extends
> > PaymentSourceTransaction { ... }
> >
>
> @MappedSuperclass
> public abstract class VoidableCCTransaction extends
> CreditCardTransaction implements Serializable { ... }
>
>@OneToOne(cascade = {CascadeType.MERGE, CascadeType.PERSIST},
> mappedBy="voidedTransaction")
>private CCVoidTransaction voidTransaction;
>
> > @Entity
> > public class CCAuthTransaction extends VoidableCCTransaction
> > implements AuthTransaction, Divisional, Serializable { ..
> > }
> >
> > @Entity
> > @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
> > public abstract class CCCaptureTransaction extends
> > VoidableCCTransaction implements Serializable,
> > CaptureTransaction {
> >private static final long serialVersionUID = 1L;
> >
> >@OneToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
> >private CCAuthTransaction authTransaction;
> >
> >...
> > }
> >
> > @Entity
> > public class EcometryCaptureTransaction extends CCCaptureTransaction
> > implements EcometryOrder, Serializable { ... }
> >
> > @Entity
> > @Inheritance(strategy = InheritanceType.JOINED)
> > public abstract class PaymentSource>
> > extends UUEntity implements MutationControlled, Serializable { ...
> > }
> >
> > @Entity
> > public class CreditCard extends PaymentSource implements
> > Addressable, Serializable { ... }
> >
> > @Entity
> > public class CheckingAccount extends PaymentSource
> > implements Serializable { ... }
> >
> > This works for me without difficulty. What am I missing that is
> > different about this scheme than the one that you describe?
> >
> > Kris
> >
> >
> >
> > On Tue, Jun 23, 2009 at 11:29 AM, Meredith
> > Gregory wrote:
> >> Derek,
> >>
> >> i completely concur. i wanted to give it a serious go, however, before i
> >> abandoned it. The issue is that so much of the incumbent technology goes
> >> across this object-relational boundary, i needed a simple case to
> justify
> >> walking away from this technology. This example provides it. To see just
> how
> >> non-complex it is, let me state it in common sense terms.
> >>
> >> Suppose we are building an app for a manufacturing firm, and the firm
> ships
> >> out its goods in different kinds of containers: plastic-coated cardboard
> >> boxes, metal boxes, etc.
> >> Suppose that different kinds of materials go into different kinds of
> boxes,
> >> and sometimes medicinal or toxic substances go into these containers;
> but,
> >> every container gets a manifest. When the container contains these
> materials
> >> that need to be handled with care or attention, the manifest is a
> special
> >> kind of certified manifest.
> >>
> >> We might imagine that this firm has already constructed an object model
> that
> >> looks like
> >>
> >> abstract class Container { ...; Manifest getManifest(); void
> setManifest(
> >> Manifest manifest ); ... }
> >> class CardboardContainer extends Container { ... }
> >> class MetalContainer extends Container { ... }
> >> abstract class Manifest { ... }
> >> class StdManifest extends Manifest { ... }
> >> class CertifiedManifest extends Manifest { ... }
> >>
> >> We need to work with their existing infrastructure. However, this
> >> situation/model breaks Hibernate's implementation of JPA. That such a
> simple
> >> situation would cause problems indicates to me that these technologies
> have
> >> never been used in any significant way in production -- otherwise they
> would
> >> have bumped into such a common case. If i'm wrong about something, here,
> i'd
> >> love to be disabused of my misunderstanding(s). Currently, i feel i have
> >> enough justification to go to a different kind of solution, such as a
> >> LINQ-based solution.
> >>
> >> Best wishes,
> >>
> >> --greg
> >>
> >> On Mon, Jun 22, 2009 at 5:46 PM, Derek Chen-Becker <
> dchenbec...@gmail.com>
> >> wrote:
> >>>
> >>> For sufficiently complex relationships, JPA is not a good fit. Beyond a
> >>> certain point it's usually simpler to roll your own. I think that this
> is
> >>

[Lift] Re: [scala] JPA question

2009-06-23 Thread Oliver Lambert
I don't understand from the code sample why AbstractContainer has to be an
entity or
have a table or id annotation. I'd be looking at just using the
@MappedSuperclass annotation.

On Wed, Jun 24, 2009 at 9:27 AM, Meredith Gregory
wrote:

> Kris,
>
> Thanks for this code sample. i will study and see if it offers a way around
> the conundrum. In the meantime, here's a code 
> sampleillustrating
>  exactly what i'm talking about.
>
> Best wishes,
>
> --greg
>
>
> On Tue, Jun 23, 2009 at 2:21 PM, Kris Nuttycombe <
> kris.nuttyco...@gmail.com> wrote:
>
>>
>> Oops, forgot a member of the hierarchy, inline below:
>>
>> On Tue, Jun 23, 2009 at 3:19 PM, Kris
>> Nuttycombe wrote:
>> > I'm just so puzzled by this thread because I have the following entity
>> > hierarchy in my app:
>> >
>> > @Entity
>> > @Inheritance(strategy = InheritanceType.JOINED)
>> > @Table(name = "payment_source_transaction")
>> > public abstract class PaymentSourceTransaction> PaymentSource>
>> >extends SubscriptionTransaction implements
>> > MonetaryTransaction, Serializable {
>> >
>> >@ManyToOne(cascade = {CascadeType.MERGE, CascadeType.PERSIST},
>> > optional = false, targetEntity = PaymentSource.class)
>> >private T paymentSource;
>> >
>> >...
>> > }
>> >
>> > @Entity
>> > public abstract class CreditCardTransaction extends
>> > PaymentSourceTransaction { ... }
>> >
>>
>> @MappedSuperclass
>> public abstract class VoidableCCTransaction extends
>> CreditCardTransaction implements Serializable { ... }
>>
>>@OneToOne(cascade = {CascadeType.MERGE, CascadeType.PERSIST},
>> mappedBy="voidedTransaction")
>>private CCVoidTransaction voidTransaction;
>>
>> > @Entity
>> > public class CCAuthTransaction extends VoidableCCTransaction
>> > implements AuthTransaction, Divisional, Serializable { ..
>> > }
>> >
>> > @Entity
>> > @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
>> > public abstract class CCCaptureTransaction extends
>> > VoidableCCTransaction implements Serializable,
>> > CaptureTransaction {
>> >private static final long serialVersionUID = 1L;
>> >
>> >@OneToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
>> >private CCAuthTransaction authTransaction;
>> >
>> >...
>> > }
>> >
>> > @Entity
>> > public class EcometryCaptureTransaction extends CCCaptureTransaction
>> > implements EcometryOrder, Serializable { ... }
>> >
>> > @Entity
>> > @Inheritance(strategy = InheritanceType.JOINED)
>> > public abstract class PaymentSource>
>> > extends UUEntity implements MutationControlled, Serializable { ...
>> > }
>> >
>> > @Entity
>> > public class CreditCard extends PaymentSource implements
>> > Addressable, Serializable { ... }
>> >
>> > @Entity
>> > public class CheckingAccount extends PaymentSource
>> > implements Serializable { ... }
>> >
>> > This works for me without difficulty. What am I missing that is
>> > different about this scheme than the one that you describe?
>> >
>> > Kris
>> >
>> >
>> >
>> > On Tue, Jun 23, 2009 at 11:29 AM, Meredith
>> > Gregory wrote:
>> >> Derek,
>> >>
>> >> i completely concur. i wanted to give it a serious go, however, before
>> i
>> >> abandoned it. The issue is that so much of the incumbent technology
>> goes
>> >> across this object-relational boundary, i needed a simple case to
>> justify
>> >> walking away from this technology. This example provides it. To see
>> just how
>> >> non-complex it is, let me state it in common sense terms.
>> >>
>> >> Suppose we are building an app for a manufacturing firm, and the firm
>> ships
>> >> out its goods in different kinds of containers: plastic-coated
>> cardboard
>> >> boxes, metal boxes, etc.
>> >> Suppose that different kinds of materials go into different kinds of
>> boxes,
>> >> and sometimes medicinal or toxic substances go into these containers;
>> but,
>> >> every container gets a manifest. When the container contains these
>> materials
>> >> that need to be handled with care or attention, the manifest is a
>> special
>> >> kind of certified manifest.
>> >>
>> >> We might imagine that this firm has already constructed an object model
>> that
>> >> looks like
>> >>
>> >> abstract class Container { ...; Manifest getManifest(); void
>> setManifest(
>> >> Manifest manifest ); ... }
>> >> class CardboardContainer extends Container { ... }
>> >> class MetalContainer extends Container { ... }
>> >> abstract class Manifest { ... }
>> >> class StdManifest extends Manifest { ... }
>> >> class CertifiedManifest extends Manifest { ... }
>> >>
>> >> We need to work with their existing infrastructure. However, this
>> >> situation/model breaks Hibernate's implementation of JPA. That such a
>> simple
>> >> situation would cause problems indicates to me that these technologies
>> have
>> >> never been used in any significant way in production -- otherwise they
>> would
>> >> have bumped into such a common case. If i'm wrong about something,
>> her

[Lift] Re: Misleading error: The Requested URL /admin/orders/new was not found on this server

2009-06-23 Thread David Pollak
I hate it when Lift lies... it sucks rubber donkey lungs!!

I've just checked in code that should make this kind of error much more
obvious.

I'm sorry for your frustration, but thanks to you and your error report,
future Lift users will have a much better time.

On Tue, Jun 23, 2009 at 3:31 PM, Trav  wrote:

>
> The Requested URL /admin/orders/new was not found on this server
>
> So I check my SiteMap: Menu(Loc("New Order", "orders" :: "new" ::
> Nil, ?("New Order")))
> I check there is a file "orders/new.html" (admin is the web context)
> Then I read about site maps, and recheck and try new Locs.
> I study my logs.
> Hours go by and I'm quite frustrated.
>
> Finally it dawns on me that the error message may be lying to me and I
> start to comment out lines from the new.html file -- presto!
>
> Here is the line that I commented out:
> Full Name
>
> Oh, lookie, it's missing a closing td tag.  Cuss this, cuss that
> commit and go to sleep.  So something else should have caught that
> (like my IDE), but in the end: lift lied!
>
> -Trav
>
>
>
>
>
>
>
>
>
>
> >
>


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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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: [scala] JPA question

2009-06-23 Thread Meredith Gregory
Kris,

Thanks for this code sample. i will study and see if it offers a way around
the conundrum. In the meantime, here's a code
sampleillustrating
exactly what i'm talking about.

Best wishes,

--greg

On Tue, Jun 23, 2009 at 2:21 PM, Kris Nuttycombe
wrote:

>
> Oops, forgot a member of the hierarchy, inline below:
>
> On Tue, Jun 23, 2009 at 3:19 PM, Kris
> Nuttycombe wrote:
> > I'm just so puzzled by this thread because I have the following entity
> > hierarchy in my app:
> >
> > @Entity
> > @Inheritance(strategy = InheritanceType.JOINED)
> > @Table(name = "payment_source_transaction")
> > public abstract class PaymentSourceTransaction PaymentSource>
> >extends SubscriptionTransaction implements
> > MonetaryTransaction, Serializable {
> >
> >@ManyToOne(cascade = {CascadeType.MERGE, CascadeType.PERSIST},
> > optional = false, targetEntity = PaymentSource.class)
> >private T paymentSource;
> >
> >...
> > }
> >
> > @Entity
> > public abstract class CreditCardTransaction extends
> > PaymentSourceTransaction { ... }
> >
>
> @MappedSuperclass
> public abstract class VoidableCCTransaction extends
> CreditCardTransaction implements Serializable { ... }
>
>@OneToOne(cascade = {CascadeType.MERGE, CascadeType.PERSIST},
> mappedBy="voidedTransaction")
>private CCVoidTransaction voidTransaction;
>
> > @Entity
> > public class CCAuthTransaction extends VoidableCCTransaction
> > implements AuthTransaction, Divisional, Serializable { ..
> > }
> >
> > @Entity
> > @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
> > public abstract class CCCaptureTransaction extends
> > VoidableCCTransaction implements Serializable,
> > CaptureTransaction {
> >private static final long serialVersionUID = 1L;
> >
> >@OneToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
> >private CCAuthTransaction authTransaction;
> >
> >...
> > }
> >
> > @Entity
> > public class EcometryCaptureTransaction extends CCCaptureTransaction
> > implements EcometryOrder, Serializable { ... }
> >
> > @Entity
> > @Inheritance(strategy = InheritanceType.JOINED)
> > public abstract class PaymentSource>
> > extends UUEntity implements MutationControlled, Serializable { ...
> > }
> >
> > @Entity
> > public class CreditCard extends PaymentSource implements
> > Addressable, Serializable { ... }
> >
> > @Entity
> > public class CheckingAccount extends PaymentSource
> > implements Serializable { ... }
> >
> > This works for me without difficulty. What am I missing that is
> > different about this scheme than the one that you describe?
> >
> > Kris
> >
> >
> >
> > On Tue, Jun 23, 2009 at 11:29 AM, Meredith
> > Gregory wrote:
> >> Derek,
> >>
> >> i completely concur. i wanted to give it a serious go, however, before i
> >> abandoned it. The issue is that so much of the incumbent technology goes
> >> across this object-relational boundary, i needed a simple case to
> justify
> >> walking away from this technology. This example provides it. To see just
> how
> >> non-complex it is, let me state it in common sense terms.
> >>
> >> Suppose we are building an app for a manufacturing firm, and the firm
> ships
> >> out its goods in different kinds of containers: plastic-coated cardboard
> >> boxes, metal boxes, etc.
> >> Suppose that different kinds of materials go into different kinds of
> boxes,
> >> and sometimes medicinal or toxic substances go into these containers;
> but,
> >> every container gets a manifest. When the container contains these
> materials
> >> that need to be handled with care or attention, the manifest is a
> special
> >> kind of certified manifest.
> >>
> >> We might imagine that this firm has already constructed an object model
> that
> >> looks like
> >>
> >> abstract class Container { ...; Manifest getManifest(); void
> setManifest(
> >> Manifest manifest ); ... }
> >> class CardboardContainer extends Container { ... }
> >> class MetalContainer extends Container { ... }
> >> abstract class Manifest { ... }
> >> class StdManifest extends Manifest { ... }
> >> class CertifiedManifest extends Manifest { ... }
> >>
> >> We need to work with their existing infrastructure. However, this
> >> situation/model breaks Hibernate's implementation of JPA. That such a
> simple
> >> situation would cause problems indicates to me that these technologies
> have
> >> never been used in any significant way in production -- otherwise they
> would
> >> have bumped into such a common case. If i'm wrong about something, here,
> i'd
> >> love to be disabused of my misunderstanding(s). Currently, i feel i have
> >> enough justification to go to a different kind of solution, such as a
> >> LINQ-based solution.
> >>
> >> Best wishes,
> >>
> >> --greg
> >>
> >> On Mon, Jun 22, 2009 at 5:46 PM, Derek Chen-Becker <
> dchenbec...@gmail.com>
> >> wrote:
> >>>
> >>> For sufficiently complex relationships, JPA is not a good fit. Beyond a
> >>> certain point 

[Lift] Re: Basic Question

2009-06-23 Thread David Pollak
Please see the ARC challenge code: http://demo.liftweb.net/arc

It's a bit more complex than you were asking as there's an intermediate
screen, but there's the user input to output in this example.

On Tue, Jun 23, 2009 at 3:34 PM, Ishkhor  wrote:

>
> Hello, all.
>
> I'm just getting started with Lift and am having trouble pulling some
> of the basic ideas together. I've never worked with Rails, but come
> from a Struts/Spring background. I'm just learning Scala now also. I'm
> having trouble seeing how the application flow works, specifically, I
> do something on a web page, something happens on the server, then I
> get a new page back or some data or whatever.
>
> Can anyone give me some code snippets for the following scenario?
> (using just the basics, nothing with SiteMap or the Mapper db stuff)
>
> -You have a simple html page with a text box and a button.
> -You enter text and click the button
> -A Scala function gets the input as a parameter
> -A new html page is returned to the user.
>
> Very simple stuff, but I'm having trouble picking these basic parts
> out of the tutorials and docs I'm looking at.
>
>
> >
>


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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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] Misleading error: The Requested URL /admin/orders/new was not found on this server

2009-06-23 Thread Trav

The Requested URL /admin/orders/new was not found on this server

So I check my SiteMap: Menu(Loc("New Order", "orders" :: "new" ::
Nil, ?("New Order")))
I check there is a file "orders/new.html" (admin is the web context)
Then I read about site maps, and recheck and try new Locs.
I study my logs.
Hours go by and I'm quite frustrated.

Finally it dawns on me that the error message may be lying to me and I
start to comment out lines from the new.html file -- presto!

Here is the line that I commented out:
Full Name

Oh, lookie, it's missing a closing td tag.  Cuss this, cuss that
commit and go to sleep.  So something else should have caught that
(like my IDE), but in the end: lift lied!

-Trav










--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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] Basic Question

2009-06-23 Thread Ishkhor

Hello, all.

I'm just getting started with Lift and am having trouble pulling some
of the basic ideas together. I've never worked with Rails, but come
from a Struts/Spring background. I'm just learning Scala now also. I'm
having trouble seeing how the application flow works, specifically, I
do something on a web page, something happens on the server, then I
get a new page back or some data or whatever.

Can anyone give me some code snippets for the following scenario?
(using just the basics, nothing with SiteMap or the Mapper db stuff)

-You have a simple html page with a text box and a button.
-You enter text and click the button
-A Scala function gets the input as a parameter
-A new html page is returned to the user.

Very simple stuff, but I'm having trouble picking these basic parts
out of the tutorials and docs I'm looking at.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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: Trouble with menus and CRUDify

2009-06-23 Thread Nolan Darilek

On 06/23/2009 11:46 AM, Andrew Scherpbier wrote:
> I had the same requirements.  What I ended up doing is something along
> these lines:
>
>
Sweet, worked very well. Thanks.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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: [scala] JPA question

2009-06-23 Thread Kris Nuttycombe

I'm just so puzzled by this thread because I have the following entity
hierarchy in my app:

@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "payment_source_transaction")
public abstract class PaymentSourceTransaction>
extends SubscriptionTransaction implements
MonetaryTransaction, Serializable {

@ManyToOne(cascade = {CascadeType.MERGE, CascadeType.PERSIST},
optional = false, targetEntity = PaymentSource.class)
private T paymentSource;

...
}

@Entity
public abstract class CreditCardTransaction extends
PaymentSourceTransaction { ... }

@Entity
public class CCAuthTransaction extends VoidableCCTransaction
implements AuthTransaction, Divisional, Serializable { ..
}

@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
public abstract class CCCaptureTransaction extends
VoidableCCTransaction implements Serializable,
CaptureTransaction {
private static final long serialVersionUID = 1L;

@OneToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
private CCAuthTransaction authTransaction;

...
}

@Entity
public class EcometryCaptureTransaction extends CCCaptureTransaction
implements EcometryOrder, Serializable { ... }

@Entity
@Inheritance(strategy = InheritanceType.JOINED)
public abstract class PaymentSource>
extends UUEntity implements MutationControlled, Serializable { ...
}

@Entity
public class CreditCard extends PaymentSource implements
Addressable, Serializable { ... }

@Entity
public class CheckingAccount extends PaymentSource
implements Serializable { ... }

This works for me without difficulty. What am I missing that is
different about this scheme than the one that you describe?

Kris



On Tue, Jun 23, 2009 at 11:29 AM, Meredith
Gregory wrote:
> Derek,
>
> i completely concur. i wanted to give it a serious go, however, before i
> abandoned it. The issue is that so much of the incumbent technology goes
> across this object-relational boundary, i needed a simple case to justify
> walking away from this technology. This example provides it. To see just how
> non-complex it is, let me state it in common sense terms.
>
> Suppose we are building an app for a manufacturing firm, and the firm ships
> out its goods in different kinds of containers: plastic-coated cardboard
> boxes, metal boxes, etc.
> Suppose that different kinds of materials go into different kinds of boxes,
> and sometimes medicinal or toxic substances go into these containers; but,
> every container gets a manifest. When the container contains these materials
> that need to be handled with care or attention, the manifest is a special
> kind of certified manifest.
>
> We might imagine that this firm has already constructed an object model that
> looks like
>
> abstract class Container { ...; Manifest getManifest(); void setManifest(
> Manifest manifest ); ... }
> class CardboardContainer extends Container { ... }
> class MetalContainer extends Container { ... }
> abstract class Manifest { ... }
> class StdManifest extends Manifest { ... }
> class CertifiedManifest extends Manifest { ... }
>
> We need to work with their existing infrastructure. However, this
> situation/model breaks Hibernate's implementation of JPA. That such a simple
> situation would cause problems indicates to me that these technologies have
> never been used in any significant way in production -- otherwise they would
> have bumped into such a common case. If i'm wrong about something, here, i'd
> love to be disabused of my misunderstanding(s). Currently, i feel i have
> enough justification to go to a different kind of solution, such as a
> LINQ-based solution.
>
> Best wishes,
>
> --greg
>
> On Mon, Jun 22, 2009 at 5:46 PM, Derek Chen-Becker 
> wrote:
>>
>> For sufficiently complex relationships, JPA is not a good fit. Beyond a
>> certain point it's usually simpler to roll your own. I think that this is
>> somewhat of a failing of the model, but it's not a simple problem to solve
>> in the generic case.
>>
>> Derek
>>
>> On Mon, Jun 22, 2009 at 6:45 PM, Derek Chen-Becker 
>> wrote:
>>>
>>> Ah, sorry, I lost track of the thread.
>>>
>>> On Mon, Jun 22, 2009 at 4:55 PM, Meredith Gregory
>>>  wrote:

 Derek,

 You are correct and i noted and reported this on Scala on Friday.
 However, if you have a chain of the form

 AbstractClass <- Class <-contains- AbstractClass <-Class <-contains- ...

 The @MappedSuperclass solution fails at level 2.

 Best wishes,

 --greg

 On Mon, Jun 22, 2009 at 3:52 PM, Derek Chen-Becker
  wrote:
>
> Something I just want to throw out into the discussion: Since you're
> using table-per-class, having a @Table annotation on AbstractContainer
> doesn't do anything since abstract classes can't have instances. Tables 
> are
> only generated for abstract classes if you're using a JOINED inheritance
> strategy. You might want to look at using the MappedSuperclass annotation
> for the abst

[Lift] Re: [scala] JPA question

2009-06-23 Thread Kris Nuttycombe

Oops, forgot a member of the hierarchy, inline below:

On Tue, Jun 23, 2009 at 3:19 PM, Kris
Nuttycombe wrote:
> I'm just so puzzled by this thread because I have the following entity
> hierarchy in my app:
>
> @Entity
> @Inheritance(strategy = InheritanceType.JOINED)
> @Table(name = "payment_source_transaction")
> public abstract class PaymentSourceTransaction>
>        extends SubscriptionTransaction implements
> MonetaryTransaction, Serializable {
>
>   �...@manytoone(cascade = {CascadeType.MERGE, CascadeType.PERSIST},
> optional = false, targetEntity = PaymentSource.class)
>    private T paymentSource;
>
>    ...
> }
>
> @Entity
> public abstract class CreditCardTransaction extends
> PaymentSourceTransaction { ... }
>

@MappedSuperclass
public abstract class VoidableCCTransaction extends
CreditCardTransaction implements Serializable { ... }

@OneToOne(cascade = {CascadeType.MERGE, CascadeType.PERSIST},
mappedBy="voidedTransaction")
private CCVoidTransaction voidTransaction;

> @Entity
> public class CCAuthTransaction extends VoidableCCTransaction
> implements AuthTransaction, Divisional, Serializable { ..
> }
>
> @Entity
> @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
> public abstract class CCCaptureTransaction extends
> VoidableCCTransaction implements Serializable,
> CaptureTransaction {
>    private static final long serialVersionUID = 1L;
>
>   �...@onetoone(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
>    private CCAuthTransaction authTransaction;
>
>    ...
> }
>
> @Entity
> public class EcometryCaptureTransaction extends CCCaptureTransaction
> implements EcometryOrder, Serializable { ... }
>
> @Entity
> @Inheritance(strategy = InheritanceType.JOINED)
> public abstract class PaymentSource>
> extends UUEntity implements MutationControlled, Serializable { ...
> }
>
> @Entity
> public class CreditCard extends PaymentSource implements
> Addressable, Serializable { ... }
>
> @Entity
> public class CheckingAccount extends PaymentSource
> implements Serializable { ... }
>
> This works for me without difficulty. What am I missing that is
> different about this scheme than the one that you describe?
>
> Kris
>
>
>
> On Tue, Jun 23, 2009 at 11:29 AM, Meredith
> Gregory wrote:
>> Derek,
>>
>> i completely concur. i wanted to give it a serious go, however, before i
>> abandoned it. The issue is that so much of the incumbent technology goes
>> across this object-relational boundary, i needed a simple case to justify
>> walking away from this technology. This example provides it. To see just how
>> non-complex it is, let me state it in common sense terms.
>>
>> Suppose we are building an app for a manufacturing firm, and the firm ships
>> out its goods in different kinds of containers: plastic-coated cardboard
>> boxes, metal boxes, etc.
>> Suppose that different kinds of materials go into different kinds of boxes,
>> and sometimes medicinal or toxic substances go into these containers; but,
>> every container gets a manifest. When the container contains these materials
>> that need to be handled with care or attention, the manifest is a special
>> kind of certified manifest.
>>
>> We might imagine that this firm has already constructed an object model that
>> looks like
>>
>> abstract class Container { ...; Manifest getManifest(); void setManifest(
>> Manifest manifest ); ... }
>> class CardboardContainer extends Container { ... }
>> class MetalContainer extends Container { ... }
>> abstract class Manifest { ... }
>> class StdManifest extends Manifest { ... }
>> class CertifiedManifest extends Manifest { ... }
>>
>> We need to work with their existing infrastructure. However, this
>> situation/model breaks Hibernate's implementation of JPA. That such a simple
>> situation would cause problems indicates to me that these technologies have
>> never been used in any significant way in production -- otherwise they would
>> have bumped into such a common case. If i'm wrong about something, here, i'd
>> love to be disabused of my misunderstanding(s). Currently, i feel i have
>> enough justification to go to a different kind of solution, such as a
>> LINQ-based solution.
>>
>> Best wishes,
>>
>> --greg
>>
>> On Mon, Jun 22, 2009 at 5:46 PM, Derek Chen-Becker 
>> wrote:
>>>
>>> For sufficiently complex relationships, JPA is not a good fit. Beyond a
>>> certain point it's usually simpler to roll your own. I think that this is
>>> somewhat of a failing of the model, but it's not a simple problem to solve
>>> in the generic case.
>>>
>>> Derek
>>>
>>> On Mon, Jun 22, 2009 at 6:45 PM, Derek Chen-Becker 
>>> wrote:

 Ah, sorry, I lost track of the thread.

 On Mon, Jun 22, 2009 at 4:55 PM, Meredith Gregory
  wrote:
>
> Derek,
>
> You are correct and i noted and reported this on Scala on Friday.
> However, if you have a chain of the form
>
> AbstractClass <- Class <-contains- AbstractClass <-Class <-contains- ...
>
> The @MappedSuperclass solu

[Lift] Re: Deployment questions and little Java web dev experience

2009-06-23 Thread Jeppe Nejsum Madsen

On 23 Jun 2009, Naftoli Gugenhem wrote:


> What's the difference between an application server and a servlet
> container?

Depends on who you ask :-) Application server usually means a J2EE
implementation which support things such as EJBs, message services,
transaction monitors, database pools (and a servlet container).

A servlet container, as the name implies, is a service that can be used
to host servlets. 

So while applications can run using only a servlet container, an
"application server" typically means a servlet container and a lot of
extra services which you may or (most likely) may not need.

/Jeppe

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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: lift and mysql

2009-06-23 Thread David Pollak
Rog,

Thanks for pointing to this old wiki page.  I've changed Can -> Box.  I've
updated the wiki.

And, yes, it should work.

Thanks,

David

On Tue, Jun 23, 2009 at 11:01 AM, Rogelio  wrote:

>
> Hi All,
>
> I'm new to Lift so forgive me if this is old news -- I did not see
> this info in a search of the
> group archive.
>
> I've been trying to get Lift to work with MySQL following the
> instructions on the
> wiki:  http://wiki.liftweb.net/index.php/HowTo_configure_lift_with_MySQL
>
> I kept getting an error that  "Can" was an unresolved symbol in line 2
> of this section of code:
>
> 
> object DBVendor extends ConnectionManager {
>  def newConnection(name: ConnectionIdentifier): Can[Connection] = {
>   try {
> Class.forName("com.mysql.jdbc.Driver")
> val dm = DriverManager.getConnection("jdbc:mysql://localhost/name-
> of-your-database?user=root&password=mysql-password")
> Full(dm)
>   } catch {
> case e : Exception => e.printStackTrace; Empty
>   }
>  }
>  def releaseConnection(conn: Connection) {conn.close}
> }
> 
>
> I found that if I replaced the word "Can" with "Box" (ie Box
> [Connection]), then I was able to
> get the wiki instructions to work.  I also has to preface the two
> import statement in the
> wiki with "_root_."  So far it appears to work, but others with more
> experience may want
> to weigh in.
>
> Thanks,
> Rog
>
>
> >
>


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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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: Deployment questions and little Java web dev experience

2009-06-23 Thread David Pollak
On Tue, Jun 23, 2009 at 11:07 AM, Naftoli Gugenhem wrote:

>
> What's the difference between an application server and a servlet
> container?


App servers do everything that servlet containers do and more (LDAP, JNDI,
blah blah blah).

If you're running a big enterprise system, you might need an app server...
most projects I work on just need a servlet container.


>
>
> -
> Timothy Perrett wrote:
>
>
> Yes thats pretty much right - examples of context are:
>
> /
>
> /something/
>
> /yet/another/
>
> Cheers, Tim
>
> On Jun 23, 4:59 am, Naftoli Gugenheim  wrote:
> > When you deploy a web app I think you specify a context path (at least in
> > jetty) which I think is what you're looking for -- the first part of the
> > path after the domain name.
> >
> >
> >
> > On Mon, Jun 22, 2009 at 11:39 PM, g-man  wrote:
> >
> > > I came from a similar background, but with some detours after Rails
> > > through Erlang, GAE w/ Django, and web2py. It took me about 2 months
> > > to finally start having fun with Lift and Scala, but I can tell you
> > > now it's really nice to just sit down, write something, and watch it
> > > work!
> >
> > > I'm no expert yet, and I'm constantly reading all the books I can
> > > find, but the rewards and power are definitely there. Where I needed
> > > dozens of files with Rails, I only need 3 models, 3 snippets, and 2
> > > templates now, and they are far cleaner!
> >
> > > My advice is to slow down, do the 'ToDo' app tutorial, and then start
> > > adding functionality to it. As you add features, you will research and
> > > learn about new things and how to do them. As a study aid, I keep the
> > > 'PocketChange' app from the book open, and look to see how similar
> > > problems were solved there.
> >
> > > As they say, almost everything you need to know is contained in those
> > > two examples. As to all the niceties of the servers and deployment to
> > > a VPS, I suggest you leave that for later. The little Jetty thing
> > > running on localhost will give you a taste of how Maven sets up
> > > things, and how to tweak them (adding logging, comments, debugging
> > > messages, etc), plus you always have the Group here for help.
> >
> > > Lift (and Scala) are both very young, so it will take a while for all
> > > the books, websites, tutorials, and videos to come out. Imagine Rails
> > > 5 years ago and you have some idea of where we are, and that's not
> > > even considering the new 'Goat Rodeo' project...
> >
> > > No worries -- have fun!
> >
> > > On Jun 19, 1:09 pm, "Nolan Darilek"  wrote:
> > > > Hi, all. I'm new to Lift and have a few questions about using it. For
> > > > background, I'm coming from Ruby to Scala, having finally been
> > > > frustrated by some aspects of the former enough to try jumping ship.
> I
> > > > know Java syntax, but the simplicity of Ruby has always been a
> powerful
> > > > draw for me, so when I used Java I always stayed away from Maven and
> > > > other cornerstones of the Java tool community. I say all of this not
> to
> > > > stir up Ruby vs. Scala drama (because we just don't have enough of
> that
> > > > already :P ) but to explain that I'm mistified by much of the Java
> > > > ecosystem, and a lot of what's out there seems to take it for granted
> > > > that I know all of this. So please pardon my newbie questions, and
> feel
> > > > free to point me to the FM on the subject if there is one, because
> I've
> > > > certainly been *trying* to RTFM. :) I also recognize that these
> topics
> > > > aren't specific to Lift, but I figure I'm likely to find more
> proponents
> > > > of low ceremony in the Scala community than I'd find if I seeked out
> > > > some more general purpose Java enterprise deployment resource.
> >
> > > > First...servlets? Web containers? App servers? Oh my. I want to write
> a
> > > > few hobbyist apps with Lift and deploy them to my VPS. They may or
> may
> > > > not take off, in which case I'd like a solution that can scale to
> > > > real-world use. Not heavy real-world use, mind you, but I figure a
> > > > separate VM/port for every app instance is overkill. So what do I
> need
> > > > for this? I gather the app server is what handles arranging web apps
> in
> > > > a single VM instance, but it's tough cutting through all the
> enterprise
> > > > language to figure out which one of these is best for my
> circumstances,
> > > > especially since I'm not dealing with legacy code and just want to
> > > > launch hobbyist/personal projects. And I can't for the life of me
> figure
> > > > out whether Tomcat is an app server or something else entirely. This
> > > > seems so much more complicated than just throwing up a few Mongrels
> and
> > > > a load balancer, or reading through the nicely-written Passenger
> manual
> > > > and following the step-by-step instructions. I'm sure it has its
> > > > advantages, I just can't get a grip on how it works.
> >
> > > > I've also been reading a lot about O

[Lift] Re: Using Mapper outside Lift?

2009-06-23 Thread Joe Wass

Thanks for all advice. The non-lift apps aren't particularly
complicated at the database end (they take stuff out, run some
algorithms and put stuff back), but I would need quick insertion. So
far I've done it with native SQL but would happily go ORM. I would
consider either (I don't mind extra baggage for the sake of part of
the library), but I think I'll give JPA a go in case separation
becomes an issue further down.

Incidentally Tim, your apostrophe on "*wouldn't*" appears to be
1!

Joe

On Jun 23, 6:46 pm, Timothy Perrett  wrote:
> I didn¹t say that it *wouldn¹t* work, just that its tied to lift-webkit...
> Besides, he says that he will be doing a lot of data intensive processing -
> seems like JPA would play better there as Mapper is usually has a ceiling of
> functionality and then it becomes necessary to move to JPA anyway. IMHO,
> might as well save the recoding time and just work with JPA right away if he
> knows from the start that he will have tricky data ORM tasks.
>
> Cheers, Tim
>
> On 23/06/2009 18:28, "Jorge Ortiz"  wrote:
>
> > I've used Mapper in desktop apps too. It works fine.
>
> > --j
>
> > On Tue, Jun 23, 2009 at 9:56 AM, Naftoli Gugenhem 
> > wrote:
>
> >> I used mapper in an offline (demo) app. You have to include the util and 
> >> http
> >> jars IIRC but it's a desktop app. If you're subcribed to scala-user, I 
> >> posted
> >> it (I think last week) in the thread about a scala SWT DSL.
>
> >> -
> >> Timothy Perrett wrote:
>
> >> Hi Joe,
>
> >> Mapper does not work standalone, its not like ActiveRecord in that
> >> sense - its tied to lift-webkit. Your best bet would be to go with
> >> JPA; I think that will serve you better anyway.
>
> >> Cheers, Tim
>
> >> On Jun 23, 4:47 pm, Joe Wass  wrote:
> >>> Good afternoon (at least in England),
>
> >>> I'm writing an application which has a significant Lift manifestation,
> >>> but also some stand-alone Scala (maybe even Java but I'll exclude this
> >>> from the conversation). The stand-alone code is a set of tools that
> >>> hang off the database and do some heavy-lifting with the data in the
> >>> database, out of sync with the site. Something like periodic data-
> >>> crunching from the data on the site. The question comes down to
> >>> database mapping.
>
> >>> I was wondering what people think is a sensible way of doing this. My
> >>> data model is simple enough that Mapper could work and I could use the
> >>> same classes. I'm aware there are many different ways I could do it,
> >>> but it would be nice to do it that way for the sake of simplicity.
>
> >>> Does this sound a sensible approach? Has anyone else written an app
> >>> that's half online, half offline? Are there any obvious pitfalls?
>
> >>> Cheers
>
> >>> Joe

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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] Deployment questions and little Java web dev experience

2009-06-23 Thread Naftoli Gugenhem

What's the difference between an application server and a servlet container?

-
Timothy Perrett wrote:


Yes thats pretty much right - examples of context are:

/

/something/

/yet/another/

Cheers, Tim

On Jun 23, 4:59 am, Naftoli Gugenheim  wrote:
> When you deploy a web app I think you specify a context path (at least in
> jetty) which I think is what you're looking for -- the first part of the
> path after the domain name.
>
>
>
> On Mon, Jun 22, 2009 at 11:39 PM, g-man  wrote:
>
> > I came from a similar background, but with some detours after Rails
> > through Erlang, GAE w/ Django, and web2py. It took me about 2 months
> > to finally start having fun with Lift and Scala, but I can tell you
> > now it's really nice to just sit down, write something, and watch it
> > work!
>
> > I'm no expert yet, and I'm constantly reading all the books I can
> > find, but the rewards and power are definitely there. Where I needed
> > dozens of files with Rails, I only need 3 models, 3 snippets, and 2
> > templates now, and they are far cleaner!
>
> > My advice is to slow down, do the 'ToDo' app tutorial, and then start
> > adding functionality to it. As you add features, you will research and
> > learn about new things and how to do them. As a study aid, I keep the
> > 'PocketChange' app from the book open, and look to see how similar
> > problems were solved there.
>
> > As they say, almost everything you need to know is contained in those
> > two examples. As to all the niceties of the servers and deployment to
> > a VPS, I suggest you leave that for later. The little Jetty thing
> > running on localhost will give you a taste of how Maven sets up
> > things, and how to tweak them (adding logging, comments, debugging
> > messages, etc), plus you always have the Group here for help.
>
> > Lift (and Scala) are both very young, so it will take a while for all
> > the books, websites, tutorials, and videos to come out. Imagine Rails
> > 5 years ago and you have some idea of where we are, and that's not
> > even considering the new 'Goat Rodeo' project...
>
> > No worries -- have fun!
>
> > On Jun 19, 1:09 pm, "Nolan Darilek"  wrote:
> > > Hi, all. I'm new to Lift and have a few questions about using it. For
> > > background, I'm coming from Ruby to Scala, having finally been
> > > frustrated by some aspects of the former enough to try jumping ship. I
> > > know Java syntax, but the simplicity of Ruby has always been a powerful
> > > draw for me, so when I used Java I always stayed away from Maven and
> > > other cornerstones of the Java tool community. I say all of this not to
> > > stir up Ruby vs. Scala drama (because we just don't have enough of that
> > > already :P ) but to explain that I'm mistified by much of the Java
> > > ecosystem, and a lot of what's out there seems to take it for granted
> > > that I know all of this. So please pardon my newbie questions, and feel
> > > free to point me to the FM on the subject if there is one, because I've
> > > certainly been *trying* to RTFM. :) I also recognize that these topics
> > > aren't specific to Lift, but I figure I'm likely to find more proponents
> > > of low ceremony in the Scala community than I'd find if I seeked out
> > > some more general purpose Java enterprise deployment resource.
>
> > > First...servlets? Web containers? App servers? Oh my. I want to write a
> > > few hobbyist apps with Lift and deploy them to my VPS. They may or may
> > > not take off, in which case I'd like a solution that can scale to
> > > real-world use. Not heavy real-world use, mind you, but I figure a
> > > separate VM/port for every app instance is overkill. So what do I need
> > > for this? I gather the app server is what handles arranging web apps in
> > > a single VM instance, but it's tough cutting through all the enterprise
> > > language to figure out which one of these is best for my circumstances,
> > > especially since I'm not dealing with legacy code and just want to
> > > launch hobbyist/personal projects. And I can't for the life of me figure
> > > out whether Tomcat is an app server or something else entirely. This
> > > seems so much more complicated than just throwing up a few Mongrels and
> > > a load balancer, or reading through the nicely-written Passenger manual
> > > and following the step-by-step instructions. I'm sure it has its
> > > advantages, I just can't get a grip on how it works.
>
> > > I've also been reading a lot about OSGi and it looks really nice. Am I
> > > correct in assuming that OSGi is to Java web apps what Rack is to Ruby
> > > ones? OK, maybe not exactly, and I know it's a more general-purpose
> > > mechanism (I'm toying with ScalaModules in a desktop app for providing
> > > pluggable UIs and other services) but in poking through OSGi articles,
> > > I've read a few statements hinting that this is probably the best way to
> > > deploy new apps with no legacy dependencies. Is this true? Is an app
> >

[Lift] lift and mysql

2009-06-23 Thread Rogelio

Hi All,

I'm new to Lift so forgive me if this is old news -- I did not see
this info in a search of the
group archive.

I've been trying to get Lift to work with MySQL following the
instructions on the
wiki:  http://wiki.liftweb.net/index.php/HowTo_configure_lift_with_MySQL

I kept getting an error that  "Can" was an unresolved symbol in line 2
of this section of code:


object DBVendor extends ConnectionManager {
 def newConnection(name: ConnectionIdentifier): Can[Connection] = {
   try {
 Class.forName("com.mysql.jdbc.Driver")
 val dm = DriverManager.getConnection("jdbc:mysql://localhost/name-
of-your-database?user=root&password=mysql-password")
 Full(dm)
   } catch {
 case e : Exception => e.printStackTrace; Empty
   }
 }
 def releaseConnection(conn: Connection) {conn.close}
}


I found that if I replaced the word "Can" with "Box" (ie Box
[Connection]), then I was able to
get the wiki instructions to work.  I also has to preface the two
import statement in the
wiki with "_root_."  So far it appears to work, but others with more
experience may want
to weigh in.

Thanks,
Rog


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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: Using Mapper outside Lift?

2009-06-23 Thread Jorge Ortiz
The OP claims his data model is simple enough for Mapper.

If he doesn't mind adding the lift-webkit jar to his classpath, I don't see
a problem with using Mapper.

--j

On Tue, Jun 23, 2009 at 10:46 AM, Timothy Perrett
wrote:

>
>
> I didn¹t say that it *wouldn¹t* work, just that its tied to lift-webkit...
> Besides, he says that he will be doing a lot of data intensive processing -
> seems like JPA would play better there as Mapper is usually has a ceiling
> of
> functionality and then it becomes necessary to move to JPA anyway. IMHO,
> might as well save the recoding time and just work with JPA right away if
> he
> knows from the start that he will have tricky data ORM tasks.
>
> Cheers, Tim
>
> On 23/06/2009 18:28, "Jorge Ortiz"  wrote:
>
> > I've used Mapper in desktop apps too. It works fine.
> >
> > --j
> >
> > On Tue, Jun 23, 2009 at 9:56 AM, Naftoli Gugenhem 
> > wrote:
> >>
> >> I used mapper in an offline (demo) app. You have to include the util and
> http
> >> jars IIRC but it's a desktop app. If you're subcribed to scala-user, I
> posted
> >> it (I think last week) in the thread about a scala SWT DSL.
> >>
> >> -
> >> Timothy Perrett wrote:
> >>
> >>
> >> Hi Joe,
> >>
> >> Mapper does not work standalone, its not like ActiveRecord in that
> >> sense - its tied to lift-webkit. Your best bet would be to go with
> >> JPA; I think that will serve you better anyway.
> >>
> >> Cheers, Tim
> >>
> >> On Jun 23, 4:47 pm, Joe Wass  wrote:
> >>> Good afternoon (at least in England),
> >>>
> >>> I'm writing an application which has a significant Lift manifestation,
> >>> but also some stand-alone Scala (maybe even Java but I'll exclude this
> >>> from the conversation). The stand-alone code is a set of tools that
> >>> hang off the database and do some heavy-lifting with the data in the
> >>> database, out of sync with the site. Something like periodic data-
> >>> crunching from the data on the site. The question comes down to
> >>> database mapping.
> >>>
> >>> I was wondering what people think is a sensible way of doing this. My
> >>> data model is simple enough that Mapper could work and I could use the
> >>> same classes. I'm aware there are many different ways I could do it,
> >>> but it would be nice to do it that way for the sake of simplicity.
> >>>
> >>> Does this sound a sensible approach? Has anyone else written an app
> >>> that's half online, half offline? Are there any obvious pitfalls?
> >>>
> >>> Cheers
> >>>
> >>> Joe
> >>
> >>
> >>
> >
> >
> > >
> >
>
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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: Using Mapper outside Lift?

2009-06-23 Thread Timothy Perrett


I didn¹t say that it *wouldn¹t* work, just that its tied to lift-webkit...
Besides, he says that he will be doing a lot of data intensive processing -
seems like JPA would play better there as Mapper is usually has a ceiling of
functionality and then it becomes necessary to move to JPA anyway. IMHO,
might as well save the recoding time and just work with JPA right away if he
knows from the start that he will have tricky data ORM tasks.

Cheers, Tim

On 23/06/2009 18:28, "Jorge Ortiz"  wrote:

> I've used Mapper in desktop apps too. It works fine.
> 
> --j
> 
> On Tue, Jun 23, 2009 at 9:56 AM, Naftoli Gugenhem 
> wrote:
>> 
>> I used mapper in an offline (demo) app. You have to include the util and http
>> jars IIRC but it's a desktop app. If you're subcribed to scala-user, I posted
>> it (I think last week) in the thread about a scala SWT DSL.
>> 
>> -
>> Timothy Perrett wrote:
>> 
>> 
>> Hi Joe,
>> 
>> Mapper does not work standalone, its not like ActiveRecord in that
>> sense - its tied to lift-webkit. Your best bet would be to go with
>> JPA; I think that will serve you better anyway.
>> 
>> Cheers, Tim
>> 
>> On Jun 23, 4:47 pm, Joe Wass  wrote:
>>> Good afternoon (at least in England),
>>> 
>>> I'm writing an application which has a significant Lift manifestation,
>>> but also some stand-alone Scala (maybe even Java but I'll exclude this
>>> from the conversation). The stand-alone code is a set of tools that
>>> hang off the database and do some heavy-lifting with the data in the
>>> database, out of sync with the site. Something like periodic data-
>>> crunching from the data on the site. The question comes down to
>>> database mapping.
>>> 
>>> I was wondering what people think is a sensible way of doing this. My
>>> data model is simple enough that Mapper could work and I could use the
>>> same classes. I'm aware there are many different ways I could do it,
>>> but it would be nice to do it that way for the sake of simplicity.
>>> 
>>> Does this sound a sensible approach? Has anyone else written an app
>>> that's half online, half offline? Are there any obvious pitfalls?
>>> 
>>> Cheers
>>> 
>>> Joe
>> 
>> 
>> 
> 
> 
> > 
> 



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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: [scala] JPA question

2009-06-23 Thread Meredith Gregory
Derek,

i completely concur. i wanted to give it a serious go, however, before i
abandoned it. The issue is that so much of the incumbent technology goes
across this object-relational boundary, i needed a simple case to justify
walking away from this technology. This example provides it. To see just how
non-complex it is, let me state it in common sense terms.

   1. Suppose we are building an app for a manufacturing firm, and the firm
   ships out its goods in different kinds of containers: plastic-coated
   cardboard boxes, metal boxes, etc.
   2. Suppose that different kinds of materials go into different kinds of
   boxes, and sometimes medicinal or toxic substances go into these containers;
   but, every container gets a manifest. When the container contains these
   materials that need to be handled with care or attention, the manifest is a
   special kind of certified manifest.

We might imagine that this firm has already constructed an object model that
looks like

abstract class Container { ...; Manifest getManifest(); void setManifest(
Manifest manifest ); ... }
class CardboardContainer extends Container { ... }
class MetalContainer extends Container { ... }
abstract class Manifest { ... }
class StdManifest extends Manifest { ... }
class CertifiedManifest extends Manifest { ... }

We need to work with their existing infrastructure. However, this
situation/model breaks Hibernate's implementation of JPA. That such a simple
situation would cause problems indicates to me that these technologies have
never been used in any significant way in production -- otherwise they would
have bumped into such a common case. If i'm wrong about something, here, i'd
love to be disabused of my misunderstanding(s). Currently, i feel i have
enough justification to go to a different kind of solution, such as a
LINQ-based solution.

Best wishes,

--greg

On Mon, Jun 22, 2009 at 5:46 PM, Derek Chen-Becker wrote:

> For sufficiently complex relationships, JPA is not a good fit. Beyond a
> certain point it's usually simpler to roll your own. I think that this is
> somewhat of a failing of the model, but it's not a simple problem to solve
> in the generic case.
>
> Derek
>
>
> On Mon, Jun 22, 2009 at 6:45 PM, Derek Chen-Becker 
> wrote:
>
>> Ah, sorry, I lost track of the thread.
>>
>>
>> On Mon, Jun 22, 2009 at 4:55 PM, Meredith Gregory <
>> lgreg.mered...@gmail.com> wrote:
>>
>>> Derek,
>>>
>>> You are correct and i noted and reported this on Scala on Friday.
>>> However, if you have a chain of the form
>>>
>>> AbstractClass <- Class <-contains- AbstractClass <-Class <-contains- ...
>>>
>>> The @MappedSuperclass solution fails at level 2.
>>>
>>> Best wishes,
>>>
>>> --greg
>>>
>>>
>>> On Mon, Jun 22, 2009 at 3:52 PM, Derek Chen-Becker <
>>> dchenbec...@gmail.com> wrote:
>>>
 Something I just want to throw out into the discussion: Since you're
 using table-per-class, having a @Table annotation on AbstractContainer
 doesn't do anything since abstract classes can't have instances. Tables are
 only generated for abstract classes if you're using a JOINED inheritance
 strategy. You might want to look at using the MappedSuperclass annotation
 for the abstract base class instead. If I change the AbstractContainer def
 to:

 @MappedSuperclass
 public abstract class AbstractContainer implements java.io.Serializable
 {

 and then modify MySampleFuContainer to:

 public class MySampleFuContainer extends AbstractContainer {

 then I seem to get the proper schema:

 create table lingo_production.MySampleFuContainer_table (
 id varchar(255) not null,
 uuid varchar(255),
 mysamplingmumble__idSuper varchar(255),
 primary key (id),
 unique (uuid)
 );


 Having said that, I think that the behavior you're currently seeing
 appears to be a bug.

 Derek


 On Mon, Jun 22, 2009 at 3:43 PM, Meredith Gregory <
 lgreg.mered...@gmail.com> wrote:

> Kris,
>
> Hereis
>  a link to the self-contained example that now uses just Java. i included
> the target dir in the repo to speed up investigation, but you can just 
> blow
> that away and build from scratch. The example is currently written to
> Java1.6, but also exhibits the same behavior under Java1.5. To run the
> example
>
> > svn co
> http://svn.biosimilarity.com/src/open/codesamples/trunk/hibernate
> ...
> > env PATH=:$PATH JAVA_HOME= mvn
> clean compile process-classes
>
> If you switch comment and decl at line 22 in
> src/main/java/maxb/hbex2/MySampleFuContainer.java then you see the error.
> The schema goes from
>
> create table lingo_production.MySampleFuContainer_table (
> id_AbstractContainer varchar(255) not null,
> varchar(255)

[Lift] Re: Using Mapper outside Lift?

2009-06-23 Thread Jorge Ortiz
I've used Mapper in desktop apps too. It works fine.

--j

On Tue, Jun 23, 2009 at 9:56 AM, Naftoli Gugenhem wrote:

>
> I used mapper in an offline (demo) app. You have to include the util and
> http jars IIRC but it's a desktop app. If you're subcribed to scala-user, I
> posted it (I think last week) in the thread about a scala SWT DSL.
>
> -
> Timothy Perrett wrote:
>
>
> Hi Joe,
>
> Mapper does not work standalone, its not like ActiveRecord in that
> sense - its tied to lift-webkit. Your best bet would be to go with
> JPA; I think that will serve you better anyway.
>
> Cheers, Tim
>
> On Jun 23, 4:47 pm, Joe Wass  wrote:
> > Good afternoon (at least in England),
> >
> > I'm writing an application which has a significant Lift manifestation,
> > but also some stand-alone Scala (maybe even Java but I'll exclude this
> > from the conversation). The stand-alone code is a set of tools that
> > hang off the database and do some heavy-lifting with the data in the
> > database, out of sync with the site. Something like periodic data-
> > crunching from the data on the site. The question comes down to
> > database mapping.
> >
> > I was wondering what people think is a sensible way of doing this. My
> > data model is simple enough that Mapper could work and I could use the
> > same classes. I'm aware there are many different ways I could do it,
> > but it would be nice to do it that way for the sake of simplicity.
> >
> > Does this sound a sensible approach? Has anyone else written an app
> > that's half online, half offline? Are there any obvious pitfalls?
> >
> > Cheers
> >
> > Joe
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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: Using Mapper outside Lift?

2009-06-23 Thread Naftoli Gugenhem

I used mapper in an offline (demo) app. You have to include the util and http 
jars IIRC but it's a desktop app. If you're subcribed to scala-user, I posted 
it (I think last week) in the thread about a scala SWT DSL.

-
Timothy Perrett wrote:


Hi Joe,

Mapper does not work standalone, its not like ActiveRecord in that
sense - its tied to lift-webkit. Your best bet would be to go with
JPA; I think that will serve you better anyway.

Cheers, Tim

On Jun 23, 4:47 pm, Joe Wass  wrote:
> Good afternoon (at least in England),
>
> I'm writing an application which has a significant Lift manifestation,
> but also some stand-alone Scala (maybe even Java but I'll exclude this
> from the conversation). The stand-alone code is a set of tools that
> hang off the database and do some heavy-lifting with the data in the
> database, out of sync with the site. Something like periodic data-
> crunching from the data on the site. The question comes down to
> database mapping.
>
> I was wondering what people think is a sensible way of doing this. My
> data model is simple enough that Mapper could work and I could use the
> same classes. I'm aware there are many different ways I could do it,
> but it would be nice to do it that way for the sake of simplicity.
>
> Does this sound a sensible approach? Has anyone else written an app
> that's half online, half offline? Are there any obvious pitfalls?
>
> Cheers
>
> Joe


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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: Trouble with menus and CRUDify

2009-06-23 Thread Andrew Scherpbier

Hi Nolan,

I had the same requirements.  What I ended up doing is something along 
these lines:

//
// For the brand maintenance, we'll use the standard CRUDify stuff 
from the Brand model.
// The menus created by CRUDify will be plucked apart.  The view 
menu will be the main brand menu
// while the create menu will become a submenu off of that.
//
val brandMenu = Menu(Brand.menus.first.loc, Brand.menus.drop(1):_*)
   
//
// For the SKU maintenance, we'll use the standard CRUDify stuff 
from the Sku model.
// The menus created by CRUDify will be plucked apart.  The view 
menu will be the main Sku menu
// while the create menu will become a submenu off of that.
//
val skuMenu = Menu(Sku.menus.first.loc, Sku.menus.drop(1):_*)

(I have a slew of these kinds of things)
So I basically build a new menu for the first item 
(Brand.menus.first.loc) for each set of menus, make that the menu that 
shows up by default, and then make the remaining two 
(Brand.menus.drop(1):_*) submenus.  (Note the ":_*".  That's Scala magic 
for saying to interpret this list as varargs to a function.)

Then I simply put all the *Menu vals in a list and pass it to the sitemap:

val entries:List[Menu] = List(Menu(Loc("Home", List("index"), "Home")),
  brandMenu,
  skuMenu)
)
LiftRules.setSiteMap(SiteMap(entries:_*))

(I have shortened the list of menus...  Also note that I've adopted a 
much more explicit way of building these menus.  What I found is that I 
can write it the way the examples show, but I have a hard time 
interpreting it again after a day or two.  I find documenting this stuff 
much easier if it is all broken up instead of everything in one 
statement.  I'm sure as I get better at Scala this will change.)

To make the menus look nicer, I overload the label in each model.  As an 
example, here's my Brand model:

import net.liftweb.mapper._
import net.liftweb.util._

class Brand extends LongKeyedMapper[Brand] with IdPK {
  def getSingleton = Brand
 
  object name extends MappedString(this, 200) {
override def displayName = "Brand code"
  }
  object company extends MappedString(this, 100) {
override def displayName = "Company name"
  }
  object product extends MappedString(this, 100) {
override def displayName = "Product name"
  }
  object certificateTemplate extends MappedString(this, 200) {
override def displayName = "Resource path to certificate template"
  }
  object serialNumberPrefix extends MappedString(this, 4) {
override def displayName = "Serial number prefix (4 uppercase letters)"
  }
}

object Brand extends Brand with LongKeyedMetaMapper[Brand] with 
CRUDify[Long, Brand] {
  override def fieldOrder = List(name, company, product)
  def allBrands: List[Brand] = findAll
 
  override def showAllMenuName = "Maintain brands"
}

Hope that helps a bit.

--Andrew

Nolan Darilek wrote:
> Cool, thanks again. Here's another. I'm looking through the Mastering 
> Lift book chapter on sitemaps, and if there's an answer then I don't see it.
>
> I have several CRUD objects that I'd like to put in their own submenus. 
> I can't seem to make this happen. If I stick exclusively to Model.menus, 
> it works, but if I do something like:
>
>  val entries =
>Menu(Loc("Home", List("index"), "Home")) ::
>Menu(Loc("layouts", List("layout", "list"), "Layouts"), 
> Layout.menus:_*) ::
>User.sitemap
>
> What I'm expecting to happen is that I'll get a Layouts menu linking to 
> /layout/list, a Loc created by Layout.menus. What actually *does* happen 
> is, apparently, a template lookup of layout/list on the filesystem. I 
> also tried passing Nil as the final argument to Loc, thinking it might 
> defer creation of a link to a template and let Layout.menus set that up, 
> but no luck.
>
>
> >   

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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] Submenus for model-generated views

2009-06-23 Thread Nolan Darilek

This is something I asked in a subthread, but maybe it deserves its own 
thread in case someone might have the answer but chose to stop reading 
the original, whose subject line isn't really accurate for this question 
anyhow. :)

I have a model that I'm using CRUDify for. I'd like to link the model 
into my sitemap such that it has a single top-level menu item pointing 
to /model/list, at which point the CRUD actions appear. So, basically, I 
want Model.menus to be a series of submenus beneath a menu named for the 
model. Thus far I have:

 val entries =
   Menu(Loc("Home", List("index"), "Home")) ::
   Menu(Loc("layouts", List("layout", "list"), "Layouts"), 
Layout.menus:_*) ::
   User.sitemap

This gives me the Layouts menu item, but it doesn't work. Specifically, 
I get a 404 when I click on "Layouts", but not a message telling me that 
/layout/list isn't in the sitemap. From this I assume that /layout/list 
expects to find a filesystem-based template, and whatever magic the 
Layout.menus injects isn't taking.

I've tried a number of variations. I'm also reading chapter 5 of 
Mastering Lift. It could be that the answer is there and obvious, but 
this is all a lot to take in for someone coming from five years of Rails 
and 1.5 of Merb. :)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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: Best method to protect most menu items?

2009-06-23 Thread David Pollak
Jeppe,
I just checked in code (it'll take 45 minutes to hit the Maven repo) that
has global LocParams for each SiteMap.  The SiteMap constructor is now:

SiteMap(globalParamFuncs: List[PartialFunction[Box[Req], Loc.LocParam]],
kids: Menu*)

You can put your Redirect stuff in like:

List({
  case _ if !User.loggedIn_? => ...
})


On Tue, Jun 23, 2009 at 7:05 AM, Jeppe Nejsum Madsen wrote:

>
> On 23 Jun 2009, David Pollak wrote:
>
> > I'll enhance sitemap to support global additions of parameters.
>
> Cool. Looking forward to this :-)
>
> Just out of curiosity: Is it possible to "fall through" in a DispatchPF,
> ie. do the default processing, even if the function is defined at the
> request?


No.  If the function is defined, then that's how the request is services.
 However, you can use a guard in the pattern:

case Req(path, _, _) if path != List("user", "login") => ...

Thanks,

David


>
>
> /Jeppe
>
>
>
> >
>


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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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: Using Mapper outside Lift?

2009-06-23 Thread Timothy Perrett

Hi Joe,

Mapper does not work standalone, its not like ActiveRecord in that
sense - its tied to lift-webkit. Your best bet would be to go with
JPA; I think that will serve you better anyway.

Cheers, Tim

On Jun 23, 4:47 pm, Joe Wass  wrote:
> Good afternoon (at least in England),
>
> I'm writing an application which has a significant Lift manifestation,
> but also some stand-alone Scala (maybe even Java but I'll exclude this
> from the conversation). The stand-alone code is a set of tools that
> hang off the database and do some heavy-lifting with the data in the
> database, out of sync with the site. Something like periodic data-
> crunching from the data on the site. The question comes down to
> database mapping.
>
> I was wondering what people think is a sensible way of doing this. My
> data model is simple enough that Mapper could work and I could use the
> same classes. I'm aware there are many different ways I could do it,
> but it would be nice to do it that way for the sake of simplicity.
>
> Does this sound a sensible approach? Has anyone else written an app
> that's half online, half offline? Are there any obvious pitfalls?
>
> Cheers
>
> Joe
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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] Using Mapper outside Lift?

2009-06-23 Thread Joe Wass

Good afternoon (at least in England),

I'm writing an application which has a significant Lift manifestation,
but also some stand-alone Scala (maybe even Java but I'll exclude this
from the conversation). The stand-alone code is a set of tools that
hang off the database and do some heavy-lifting with the data in the
database, out of sync with the site. Something like periodic data-
crunching from the data on the site. The question comes down to
database mapping.

I was wondering what people think is a sensible way of doing this. My
data model is simple enough that Mapper could work and I could use the
same classes. I'm aware there are many different ways I could do it,
but it would be nice to do it that way for the sake of simplicity.

Does this sound a sensible approach? Has anyone else written an app
that's half online, half offline? Are there any obvious pitfalls?

Cheers

Joe

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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: Best method to protect most menu items?

2009-06-23 Thread Jeppe Nejsum Madsen

On 23 Jun 2009, David Pollak wrote:

> I'll enhance sitemap to support global additions of parameters.

Cool. Looking forward to this :-)

Just out of curiosity: Is it possible to "fall through" in a DispatchPF,
ie. do the default processing, even if the function is defined at the request?

/Jeppe



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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: Best method to protect most menu items?

2009-06-23 Thread David Pollak
I'll enhance sitemap to support global additions of parameters.

On Tue, Jun 23, 2009 at 1:21 AM, Jeppe Nejsum Madsen wrote:

>
> Hi,
>
> Our app is private, which means only the signin and related pages are
> visible without authentication. I've made this Loc to protect menu
> items,
>
>val loggedIn = Loc.EarlyResponse(() =>
> Full(RedirectResponse("/profile/login?returnTo="+S.uri)).filter(ignore =>
> !User.loggedIn_?))
>
> and while this works, I think there must be a better solution since:
>
> 1) It's easy to forget adding this to menu items that should be
> protected (ie most in our case)
> 2) It's not easy to add this to MenuItems generated by Lift,
> e.g. CRUDIfy entries.
>
> So, I created this DispatchPF
>
>  LiftRules.dispatch.prepend(NamedPF("Protect") {
>case Req("profile" :: "login" :: Nil , "", _) => () => Empty
>case Req(_, "", _) => () =>
> Full(RedirectResponse("/profile/login?returnTo="+S.uri)).filter(ignore =>
> !User.loggedIn_?)
>  })
>
> but it doesn't seem to work since now /profile/login gives a 404. So
> basically, I have two questions
>
> 1) Is there a way for requests to "fall through" in the DispatchPF, ie
> /profile/login should just be processed as usual
>
> 2) Is there a better way to accomplish this? It seems the DispatchPF
> method would need to allow requests to javascript, css etc to be handled
> without authentication so you would have to maintain this "whitelist"
> (but this is less of a problem than maintaining the protected list)
>
> /Jeppe
>
> >
>


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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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: Managed child entities

2009-06-23 Thread David Pollak
Wow!

On Mon, Jun 22, 2009 at 9:30 PM, Naftoli Gugenheim wrote:

> I was working on something to help make it easier to deal with one to many
> relationships. I'm attaching it (OneToMany.scala) along with a class that
> uses it (partially work in progress), although it's a bit verbose (partially
> because my class names are very long). Advantages include access to the
> children like a collection, and ability to add and remove children but defer
> actually saving it, as well as adding the children before the parent was
> saved and got an id.
> It's not test very thoroughly, and of course any suggestions for
> improvement are more than welcome. I'm planning to try to make something
> similar for many to many soon.
>
>
> >
>


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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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: Is there any eclipse setup that actually works for lift?

2009-06-23 Thread Rudi Engelbrecht

Hi Dano

I am using the debugger in IntelliJ IDEA and it works seamlessly -  
stepping through Scala code - I find stepping through code helps  
learning the Lift framework.

If you are not committed to using a specific IDE, then trying IntelliJ  
will be a useful investment - you can download a 30 day trial - it has  
been my favourite Java IDE for the past 8 years.

Regards

Rudi

Cell: +27 82 551 0582

On 23 Jun 2009, at 12:20 AM, Dano  wrote:

>
> Rudi,
>
> Thanks for posting your Intellij specifics.  Wondering if you are
> using the debugger and find that it works for your scala/lift
> debugging?
>
>
> Dano
>
> On Jun 22, 2:57 pm, Rudi Engelbrecht  wrote:
>> I know you are looking for a working Eclipse configuration, but I  
>> have
>> had great success and stability with
>>
>> IntelliJ IDEA 8.1.2
>> Scala 2.7.4
>> The Scala plugin for IDEA
>> Lift 1.0
>>
>> I can do "mvn jetty:run" from the IDE and what is really cool is that
>> I can set breakpoints and debug the "mvn jetty:run" target from IDEA
>> and then explore the scala code.
>>
>> Just thought I will post version numbers of a working environment.
>>
>> Regards
>>
>> Rudi
>>
>> On 22 Jun 2009, at 8:35 PM, David Pollak
>>
>>
>>
>>  wrote:
>>
>>> On Mon, Jun 22, 2009 at 11:25 AM, Ellis 
>>> wrote:
>>
>>> Hello David,
>>
>>> Thanks for your reply.  Do you know whether lift *should* work with
>>> scala 2.8 when we pull it from the maven repositories?
>>
>>> Lift currently only works with Scala 2.7.4.  You can use Eclipse and
>>> 2.7.5 to edit Lift files, but Lift must be deployed against 2.7.4.
>>
>>> We will have a branch of Lift (Jorge... you got this running yet)
>>> building against 2.8, but it will be experimental.
>>
>>> I have experienced a fair number of suboptimalities with Lift and
>>> Eclipse in the last 3 weeks with the 2.7.5 stable plugin.  I have
>>> had success recently with NetBeans, IntelliJ, and emacs.
>>
>>>  If so, then
>>> I'll try deleting my ~/.m2 as Tim suggested.
>>
>>> Thanks,
>>> Ellis
>>
>>> On Jun 22, 8:14 pm, David Pollak 
>>> wrote:
 Ellis,
 Miles will be back online in a few days, but I suspect that the
>>> answer is
 that the 2.8 plugin is the "new generation" and the 2.7.5 stuff is
>>> going to
 have bugs. :-(
>>
 Sorry.
>>
 David
>>
 On Mon, Jun 22, 2009 at 11:08 AM, Ellis
>>>  wrote:
>>
> Hello everyone,
>>
> Does anyone have a setup for eclipse that works like it should?
>>> By
> "like it should", I mostly mean that the scala plugin doesn't
>>> crash
> regularly AND it works with lift/maven.  If so, which versions of
> which plugins are you using?
>>
> The nightly build of the scala plugin seems to work better than
> 2.7.4/2.7.5 in some ways, but I couldn't get it working with lift/
> maven due to "signature differences" between the scala libraries.
>>
> Best regards,
> Ellis
>>
 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Git some:http://github.com/dpp
>>
>>> --
>>> Lift, the simply functional web frameworkhttp://liftweb.net
>>> Beginning Scalahttp://www.apress.com/book/view/1430219890
>>> Follow me:http://twitter.com/dpp
>>> Git some:http://github.com/dpp
> >

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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: Trouble with menus and CRUDify

2009-06-23 Thread Nolan Darilek

Cool, thanks again. Here's another. I'm looking through the Mastering 
Lift book chapter on sitemaps, and if there's an answer then I don't see it.

I have several CRUD objects that I'd like to put in their own submenus. 
I can't seem to make this happen. If I stick exclusively to Model.menus, 
it works, but if I do something like:

 val entries =
   Menu(Loc("Home", List("index"), "Home")) ::
   Menu(Loc("layouts", List("layout", "list"), "Layouts"), 
Layout.menus:_*) ::
   User.sitemap

What I'm expecting to happen is that I'll get a Layouts menu linking to 
/layout/list, a Loc created by Layout.menus. What actually *does* happen 
is, apparently, a template lookup of layout/list on the filesystem. I 
also tried passing Nil as the final argument to Loc, thinking it might 
defer creation of a link to a template and let Layout.menus set that up, 
but no luck.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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] Managed child entities

2009-06-23 Thread Naftoli Gugenheim
I was working on something to help make it easier to deal with one to many
relationships. I'm attaching it (OneToMany.scala) along with a class that
uses it (partially work in progress), although it's a bit verbose (partially
because my class names are very long).Advantages include access to the
children like a collection, and ability to add and remove children but defer
actually saving it, as well as adding the children before the parent was
saved and got an id.
It's not test very thoroughly, and of course any suggestions for improvement
are more than welcome. I'm planning to try to make something similar for
many to many soon.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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
-~--~~~~--~~--~--~---



OneToMany.scala
Description: Binary data


Nature.scala
Description: Binary data


[Lift] Best method to protect most menu items?

2009-06-23 Thread Jeppe Nejsum Madsen

Hi,

Our app is private, which means only the signin and related pages are
visible without authentication. I've made this Loc to protect menu
items,

val loggedIn = Loc.EarlyResponse(() => 
Full(RedirectResponse("/profile/login?returnTo="+S.uri)).filter(ignore => 
!User.loggedIn_?))

and while this works, I think there must be a better solution since:

1) It's easy to forget adding this to menu items that should be
protected (ie most in our case)
2) It's not easy to add this to MenuItems generated by Lift,
e.g. CRUDIfy entries.

So, I created this DispatchPF

 LiftRules.dispatch.prepend(NamedPF("Protect") {
case Req("profile" :: "login" :: Nil , "", _) => () => Empty
case Req(_, "", _) => () => 
Full(RedirectResponse("/profile/login?returnTo="+S.uri)).filter(ignore => 
!User.loggedIn_?)   
   
  })

but it doesn't seem to work since now /profile/login gives a 404. So
basically, I have two questions

1) Is there a way for requests to "fall through" in the DispatchPF, ie
/profile/login should just be processed as usual

2) Is there a better way to accomplish this? It seems the DispatchPF
method would need to allow requests to javascript, css etc to be handled
without authentication so you would have to maintain this "whitelist"
(but this is less of a problem than maintaining the protected list)

/Jeppe 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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: Deployment questions and little Java web dev experience

2009-06-23 Thread Timothy Perrett

Yes thats pretty much right - examples of context are:

/

/something/

/yet/another/

Cheers, Tim

On Jun 23, 4:59 am, Naftoli Gugenheim  wrote:
> When you deploy a web app I think you specify a context path (at least in
> jetty) which I think is what you're looking for -- the first part of the
> path after the domain name.
>
>
>
> On Mon, Jun 22, 2009 at 11:39 PM, g-man  wrote:
>
> > I came from a similar background, but with some detours after Rails
> > through Erlang, GAE w/ Django, and web2py. It took me about 2 months
> > to finally start having fun with Lift and Scala, but I can tell you
> > now it's really nice to just sit down, write something, and watch it
> > work!
>
> > I'm no expert yet, and I'm constantly reading all the books I can
> > find, but the rewards and power are definitely there. Where I needed
> > dozens of files with Rails, I only need 3 models, 3 snippets, and 2
> > templates now, and they are far cleaner!
>
> > My advice is to slow down, do the 'ToDo' app tutorial, and then start
> > adding functionality to it. As you add features, you will research and
> > learn about new things and how to do them. As a study aid, I keep the
> > 'PocketChange' app from the book open, and look to see how similar
> > problems were solved there.
>
> > As they say, almost everything you need to know is contained in those
> > two examples. As to all the niceties of the servers and deployment to
> > a VPS, I suggest you leave that for later. The little Jetty thing
> > running on localhost will give you a taste of how Maven sets up
> > things, and how to tweak them (adding logging, comments, debugging
> > messages, etc), plus you always have the Group here for help.
>
> > Lift (and Scala) are both very young, so it will take a while for all
> > the books, websites, tutorials, and videos to come out. Imagine Rails
> > 5 years ago and you have some idea of where we are, and that's not
> > even considering the new 'Goat Rodeo' project...
>
> > No worries -- have fun!
>
> > On Jun 19, 1:09 pm, "Nolan Darilek"  wrote:
> > > Hi, all. I'm new to Lift and have a few questions about using it. For
> > > background, I'm coming from Ruby to Scala, having finally been
> > > frustrated by some aspects of the former enough to try jumping ship. I
> > > know Java syntax, but the simplicity of Ruby has always been a powerful
> > > draw for me, so when I used Java I always stayed away from Maven and
> > > other cornerstones of the Java tool community. I say all of this not to
> > > stir up Ruby vs. Scala drama (because we just don't have enough of that
> > > already :P ) but to explain that I'm mistified by much of the Java
> > > ecosystem, and a lot of what's out there seems to take it for granted
> > > that I know all of this. So please pardon my newbie questions, and feel
> > > free to point me to the FM on the subject if there is one, because I've
> > > certainly been *trying* to RTFM. :) I also recognize that these topics
> > > aren't specific to Lift, but I figure I'm likely to find more proponents
> > > of low ceremony in the Scala community than I'd find if I seeked out
> > > some more general purpose Java enterprise deployment resource.
>
> > > First...servlets? Web containers? App servers? Oh my. I want to write a
> > > few hobbyist apps with Lift and deploy them to my VPS. They may or may
> > > not take off, in which case I'd like a solution that can scale to
> > > real-world use. Not heavy real-world use, mind you, but I figure a
> > > separate VM/port for every app instance is overkill. So what do I need
> > > for this? I gather the app server is what handles arranging web apps in
> > > a single VM instance, but it's tough cutting through all the enterprise
> > > language to figure out which one of these is best for my circumstances,
> > > especially since I'm not dealing with legacy code and just want to
> > > launch hobbyist/personal projects. And I can't for the life of me figure
> > > out whether Tomcat is an app server or something else entirely. This
> > > seems so much more complicated than just throwing up a few Mongrels and
> > > a load balancer, or reading through the nicely-written Passenger manual
> > > and following the step-by-step instructions. I'm sure it has its
> > > advantages, I just can't get a grip on how it works.
>
> > > I've also been reading a lot about OSGi and it looks really nice. Am I
> > > correct in assuming that OSGi is to Java web apps what Rack is to Ruby
> > > ones? OK, maybe not exactly, and I know it's a more general-purpose
> > > mechanism (I'm toying with ScalaModules in a desktop app for providing
> > > pluggable UIs and other services) but in poking through OSGi articles,
> > > I've read a few statements hinting that this is probably the best way to
> > > deploy new apps with no legacy dependencies. Is this true? Is an app
> > > server actually needed here, or do I just create an OSGi execution
> > > environment and start adding bundles?
>
> > > It seems like the w