[Lift] Re: JPA w/Scala (and hibernate validator)

2008-09-10 Thread Viktor Klang
Hi Tim, http://www.hibernate.org/hib_docs/v3/api/org/hibernate/property/PropertyAccessor.html It should be declared with the @Access annotation (if I remember correctly) Cheers, Viktor On Wed, Sep 10, 2008 at 5:50 PM, Tim Perrett <[EMAIL PROTECTED]> wrote: > > PropertyAccessor? Im not familiar V

[Lift] Re: JPA w/Scala (and hibernate validator)

2008-09-10 Thread Tim Perrett
PropertyAccessor? Im not familiar Viktor, can you explain a little more? Thanks Tim --~--~-~--~~~---~--~~ 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 unsu

[Lift] Re: JPA w/Scala (and hibernate validator)

2008-09-10 Thread Viktor Klang
Or just write a PropertyAccessor implementation for Scala vars? That should do the trick. Cheers, Viktor On Wed, Sep 10, 2008 at 3:22 PM, Derek Chen-Becker <[EMAIL PROTECTED]>wrote: > Two lines lower it looks like it's trying to fetch the value > (ClassValidator.getMemberValue), but name_$eq is

[Lift] Re: JPA w/Scala (and hibernate validator)

2008-09-10 Thread Derek Chen-Becker
Two lines lower it looks like it's trying to fetch the value (ClassValidator.getMemberValue), but name_$eq is the setter for a value, not the getter. That's probably why it's coming up with the error "wrong number of arguments". You might try adding an explicit "getter" for the property you want to

[Lift] Re: JPA w/Scala

2008-09-10 Thread Derek Chen-Becker
Yeah, I tested in PostgreSQL 8.3 and it works fine there, too. Weird. On Wed, Sep 10, 2008 at 3:43 AM, Tim Perrett <[EMAIL PROTECTED]> wrote: > > > > > I've also tested it against SQL Server 2000 and it runs without any > problems > > (unfortunately, I don't have SQL Server 2005 or later, to test

[Lift] Re: JPA w/Scala (and hibernate validator)

2008-09-10 Thread Tim Perrett
Out of interest, I tried playing around with hibernate-validator on this demo to see if it works, and (as you can see below), it doesnt. Any ideas why its doing this? Looking at the compiled bytecode, its trying to invoke the synthesized method "name_$eq(String x$1)", and for some reason, failin

[Lift] Re: JPA w/Scala

2008-09-10 Thread Tim Perrett
> I've also tested it against SQL Server 2000 and it runs without any problems > (unfortunately, I don't have SQL Server 2005 or later, to test against) > Reading online, there seem to be a number of eccentricities with 2005 + 2008, so it might just be that. Its working for me now, so as long a

[Lift] Re: JPA w/Scala

2008-09-09 Thread Oliver
Hi Derek, this is looking good On Wed, Sep 10, 2008 at 2:55 AM, Derek Chen-Becker <[EMAIL PROTECTED]>wrote: > OK, the code is merged in and the latest version is attached. I made a few > minor modifications to the JPA code that Oliver sent: > > 1. I made the openEM and closeEM methods abstract a

[Lift] Re: JPA w/Scala

2008-09-09 Thread Derek Chen-Becker
OK, the code is merged in and the latest version is attached. I made a few minor modifications to the JPA code that Oliver sent: 1. I made the openEM and closeEM methods abstract and protected. The idea is that the JPA class shouldn't be tied to the way the user wants to access JPA. Rather, when t

[Lift] Re: JPA w/Scala

2008-09-09 Thread Derek Chen-Becker
Looks like I missed a lot in the two days I was gone :). I'm going to look at Oliver's code and merge it. As for Tim's problem with the insertions, the AUTO ID generation should usually just work. I don't have a SQL Server instance to try it out on, but after I merge the code I'll test it again wit

[Lift] Re: JPA w/Scala

2008-09-09 Thread Oliver Lambert
On 09/09/2008, at 7:47 PM, Tim Perrett wrote: > > I agree - its strange and not what we would expect. > > What version of SQL server are you running? Im using 2005 Enterprise > here... > I think thats what they are using at my company > Its just a really strange thing, the 100 is always ignore

[Lift] Re: JPA w/Scala

2008-09-09 Thread Tim Perrett
I agree - its strange and not what we would expect. What version of SQL server are you running? Im using 2005 Enterprise here... Its just a really strange thing, the 100 is always ignored... I think it just needs a 2nd parameter there, even if its going to ignore it. Thats certainly what it look

[Lift] Re: JPA w/Scala

2008-09-08 Thread Oliver
Doesn't look right. The id is the primary key - it could now be inserted with a value of 100, always. I can do an insert here with @Id @GeneratedValue(){val strategy = GenerationType.AUTO} Still works without GeneratedValue being present. My pom dependencies are org.hibernat

[Lift] Re: JPA w/Scala

2008-09-08 Thread Tim Perrett
I managed to fix it in the end by reading some really really old post in the hibernate archive. Effectively, if you define something, a class property that has no initial value (in our case, _ ) then it bones the inserting for some reason. Quite knows what it does that but it does.. and with

[Lift] Re: JPA w/Scala

2008-09-08 Thread Tim Perrett
Hey all, Very strange, I re-wrote the classes in Java and I still see the same issue!!! What on earth could be going on here? I tried calling persist rather than merge, but it appeared to have no impact. Cheers Tim --~--~-~--~~~---~--~~ You received this messa

[Lift] Re: JPA w/Scala

2008-09-08 Thread Martin Ellis
Hi Tim, On Mon, Sep 8, 2008 at 12:29 PM, Tim Perrett wrote: > > Just been doing some more debugging on this - it appears that the > correct values are being passed through and are assigned to an entity > instance, but they blow up when trying to do the em.merge(author) > call. > > The stack trace

[Lift] Re: JPA w/Scala

2008-09-08 Thread Oliver Lambert
or, you could try @GeneratedValue(strategy = GenerationType.AUTO, generator = "system-guid") @GenericGenerator(name = "system-guid", strategy = "guid") with or without the Microsoft driver com.microsoft.sqlserver.jdbc.SQLServerDriver

[Lift] Re: JPA w/Scala

2008-09-08 Thread Mateusz Fiołka
http://www.oracle.com/technology/products/ias/toplink/jpa/howto/id-generation.html On Mon, Sep 8, 2008 at 4:43 PM, Tim Perrett <[EMAIL PROTECTED]> wrote: > > Hmmm, I've tried: > > @Id > @GeneratedValue(){val strategy = GenerationType.AUTO} > @Column(){val insertable = false} > var id : Long

[Lift] Re: JPA w/Scala

2008-09-08 Thread Oliver Lambert
I think sql server uses @GeneratedValue(strategy=GenerationType.IDENTITY) You could try this instead of GenerationType.AUTO (though this should translate to the above) Oliver On 09/09/2008, at 12:43 AM, Tim Perrett wrote: > > Hmmm, I've tried: > > @Id > @GeneratedValue(){val strategy = Gene

[Lift] Re: JPA w/Scala

2008-09-08 Thread Tim Perrett
Hmmm, I've tried: @Id @GeneratedValue(){val strategy = GenerationType.AUTO} @Column(){val insertable = false} var id : Long = _ But yet its still being included in the query, any ideas? Cheers, Tim --~--~-~--~~~---~--~~ You received this message because y

[Lift] Re: JPA w/Scala

2008-09-08 Thread Tim Perrett
Hey Oliver, I think your right, it works no problem when updating. Is there a way of stopping JPA inserting a value for a field with an annotation or such? Cheers Tim --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Group

[Lift] Re: JPA w/Scala

2008-09-08 Thread Oliver Lambert
Could it be that the author id isn't being created properly by the @GeneratedValue(strategy = GenerationType.AUTO) On 08/09/2008, at 9:29 PM, Tim Perrett wrote: > > Just been doing some more debugging on this - it appears that the > correct values are being passed through and are assigned to an

[Lift] Re: JPA w/Scala

2008-09-08 Thread Oliver Lambert
You know I always forget those long winded archetype creation commands and thinking about this I guess I would hope for something more. Something like specify a set of tables (and stuff) and have "LiftBuilder" go and create mappings, validation and default html for me. I haven't looked at it

[Lift] Re: JPA w/Scala

2008-09-08 Thread Tim Perrett
Just been doing some more debugging on this - it appears that the correct values are being passed through and are assigned to an entity instance, but they blow up when trying to do the em.merge(author) call. The stack trace I get is: ### AUTHOR [EMAIL PROTECTED] ### AUTHOR ID 0 ### AUTHOR NAME s

[Lift] Re: JPA w/Scala

2008-09-08 Thread Tim Perrett
Awesome, I have it working with SQL Server as well now, which is sweet. Im using JTDS for my driver, and the reading and updating work no problem however the inserting does not work? I get the following message: DEBUG - could not insert: [com.foo.jpaweb.Author] [insert into authors (name, id) va

[Lift] Re: JPA w/Scala

2008-09-07 Thread Charles F. Munat
Oh, hell yeah. Please! And down the road, when the mapper becomes agnostic, would there be an archetype that used JPA as the back end for the Lift mapper? Chas. Tim Perrett wrote: > Ah cool - this is quite nice actually; good work Oliver! > > @Derek, what are your thoughts? > > It certainly

[Lift] Re: JPA w/Scala

2008-09-07 Thread Tim Perrett
Ah cool - this is quite nice actually; good work Oliver! @Derek, what are your thoughts? It certainly strikes me that as time wears on and more people are using the lift/jpa stuff that we should really create an archetype for it would others find that useful? Cheers Tim --~--~-~--~

[Lift] Re: JPA w/Scala

2008-09-07 Thread Tim Perrett
Sounds good Oliver - there was no attached zip file however? Cheers Tim On Sep 7, 8:49 am, Oliver Lambert <[EMAIL PROTECTED]> wrote: > I've modified the code to expand all the methods of EntityManager and   > Query. I've also added a couple of value added methods such as   > setParams, as a map

[Lift] Re: JPA w/Scala

2008-09-05 Thread Charles F. Munat
Very cool. It worked, too. Derek Chen-Becker wrote: > Rock on! Glad to hear it's working for you now :). In the > persistence.xml the line > > > > Is what should make automatically populate the DB with tables, etc. As > an added bonus, if you change the def of an object, it should update the

[Lift] Re: JPA w/Scala

2008-09-05 Thread Derek Chen-Becker
Rock on! Glad to hear it's working for you now :). In the persistence.xml the line Is what should make automatically populate the DB with tables, etc. As an added bonus, if you change the def of an object, it should update the tables, although I caution against doing this in a production environ

[Lift] Re: JPA w/Scala

2008-09-05 Thread Charles F. Munat
Answering my own posts... Switching to PostgreSQL was quite simple: 1. in perscala/pom.xml, replace this: hsqldb hsqldb 1.8.0.7 with this: org.postgresql.Driver postgres 8.3 No need to change anything in webapp/pom.x

[Lift] Re: JPA w/Scala

2008-09-05 Thread Charles F. Munat
Hot damn. I installed Lift using mvn install on my local copy, and went back to the webapp and ran mvn jetty:run -U and IT RUNS. I now have "Welcome to the super duper catalog!" at localhost:9090. THANK YOU VERY MUCH, DEREK. Now, any ideas on how to switch it from HSQLDB to PostgreSQL? I pres

[Lift] Re: JPA w/Scala

2008-09-05 Thread Derek Chen-Becker
On Fri, Sep 5, 2008 at 4:01 PM, Charles F. Munat <[EMAIL PROTECTED]> wrote: > > OK, did that, and mvn test ran successfully. Phew! I was really confused as to how that could have gone wrong. > > Am I missing something? > > Yes. The first missing dependency is the perscala project. I forgot th

[Lift] Re: JPA w/Scala

2008-09-05 Thread David Pollak
Derek Chen-Becker wrote: > Well, the only thing it helps is my ego, which I guess is the problem ;) If you need ego help... you're doing a frickin' amazing job of helping out the Lift community and you're clearly the wicked smart and caring kind of person that enhances the Lift community. > >

[Lift] Re: JPA w/Scala

2008-09-05 Thread Charles F. Munat
Sorry, forgot about that. Here it is: --- Test set: com.foo.jpaweb.model.TestJPAWeb --- Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time el

[Lift] Re: JPA w/Scala

2008-09-05 Thread Derek Chen-Becker
Well, the only thing it helps is my ego, which I guess is the problem ;) On Fri, Sep 5, 2008 at 1:27 PM, Derek Chen-Becker <[EMAIL PROTECTED]>wrote: > I agree about keeping it public. I have a bad habit of sitting on things > when I don't think they're up to snuff but I realize that doing that do

[Lift] Re: JPA w/Scala

2008-09-05 Thread Derek Chen-Becker
I agree about keeping it public. I have a bad habit of sitting on things when I don't think they're up to snuff but I realize that doing that doesn't really help anyone in this case :) Derek On Fri, Sep 5, 2008 at 1:21 PM, Tim Perrett <[EMAIL PROTECTED]> wrote: > > Derek, by all means keep worki

[Lift] Re: JPA w/Scala

2008-09-05 Thread Tim Perrett
Derek, by all means keep working on this stuff, its brilliant, really it is. I think there are a lot of people that want JPA / Lift, so its important that we keep it public as who knows what type of great ideas people might come up with whilst the discussion evolves! Kudos again tho, Lift <-> JP

[Lift] Re: JPA w/Scala

2008-09-05 Thread Charles F. Munat
I added those jars because I was getting errors with things not defined (this was earlier), so I presumed that maven wasn't finding the right jars. I understand that maven is supposed to do this, but I was trying to figure out what maven was missing. If I add a jar and things start working, th

[Lift] Re: JPA w/Scala

2008-09-05 Thread Charles F. Munat
The code I have for my attempt to follow the JPA tutorial is -- with one very minor exception -- exactly the code that is in the tutorial. A couple of days ago, I posted to the list the one question I had, and the answer I came up with. Sorry if I wasn't clear about this. The exception was thi

[Lift] Re: JPA w/Scala

2008-09-05 Thread Charles F. Munat
Currently, when I run mvn test on the perscala subproject, I get this: mvn test [17:12] [INFO] Scanning for projects... [INFO] [INFO] Building perscala [INFO]task-segment: [test] [INFO] ---

[Lift] Re: JPA w/Scala

2008-09-05 Thread Derek Chen-Becker
I agree with keeping the discussions on-list. I've actually been asking the relevant questions on-list, just not in the thread of the final JPA demo project. I didn't intend to be seen as hiding it, I just didn't want to post up code and a tutorial that were based on a SNAPSHOT version. In hindsigh

[Lift] Re: JPA w/Scala

2008-09-05 Thread David Pollak
Derek, Thanks for posting up the code. In general, I like to keep conversations on-list. People learn a lot by seeing back and forth communications rather than simply the magic result. Additionally, there are a number of folks who have different skills and different perspectives and allowing the

[Lift] Re: JPA w/Scala

2008-09-05 Thread Derek Chen-Becker
I think Chas didn't post up the code because I had said I wanted to wait to release this until the kinks were worked out, not because he's obstructionist :). I've attached the current form of the tutorial project. The code in question is JPADemo/perscala/src/main/scala/com/jpaweb/foo/model/Author.s

[Lift] Re: JPA w/Scala

2008-09-05 Thread Tim Perrett
Chas, It would be usefull if you just posted the entity code - if it's from the tutorial, or a varient of that, I don't see why your not giving others their chance to contribute? Just post up the code... There are a lot of talented people on this list who I'm sure can a) help improve the

[Lift] Re: JPA w/Scala

2008-09-05 Thread Charles F. Munat
I think Derek has a new version of the tutorial. I've been communicating with him about it, and am trying to get his Scala-only version working. I'll check with him to make sure my suspicions are correct. Then one of us will update the tutorial. I was planning to revise the tutorial myself, bu

[Lift] Re: JPA w/Scala

2008-09-05 Thread Viktor Klang
Sorry Chas, I think I expressed myself somewhat unfortunate, what I meant was: "Can you paste in the code for the Author-class"? Cheers, Viktor On Thu, Sep 4, 2008 at 10:18 PM, Charles F. Munat <[EMAIL PROTECTED]> wrote: > > Oh, sorry, Victor. I think I posted a response to my own question alm

[Lift] Re: JPA w/Scala

2008-09-04 Thread Oliver
They aint plain and they aint old, So we have to call them all SO's On Fri, Sep 5, 2008 at 1:50 PM, Tim Perrett <[EMAIL PROTECTED]> wrote: > > I think Viktor was asking you to post the scala code for the entity; > or alternatively update the wiki page so that its correct > > Interestingly, didn't

[Lift] Re: JPA w/Scala

2008-09-04 Thread Tim Perrett
I think Viktor was asking you to post the scala code for the entity; or alternatively update the wiki page so that its correct Interestingly, didn't the term POJO come about because it made the distinct difference between EJB beans and normal classes but as we don't have EJB etc etc in Scala, arn

[Lift] Re: JPA w/Scala

2008-09-04 Thread Charles F. Munat
Oh, sorry, Victor. I think I posted a response to my own question almost immediately after I posted it. I was aiming this question at anyone who had used the JPA tutorial because I figured that the problem was in the difference between using POJOs and POSOs (hence, I assumed they would have no

[Lift] Re: JPA w/Scala

2008-09-04 Thread Viktor Klang
Chas, You'll have to give us more than that, i.e. the definition of Author. Cheers, Viktor On Wed, Sep 3, 2008 at 4:29 AM, Charles F. Munat <[EMAIL PROTECTED]> wrote: > > Has anyone followed the JPA tutorial using pure Scala instead of Java? > I've got it very close to running, but I am getting

[Lift] Re: JPA w/Scala - never mind

2008-09-03 Thread Derek Chen-Becker
Yes, 100% pure Scala. It means you have to use orm.xml for some things, but that's pretty easy to deal with. Derek On Wed, Sep 3, 2008 at 3:23 PM, Tim Perrett <[EMAIL PROTECTED]> wrote: > > @derek Awesome, is that new example using scala in the persistence > module? > > Cheers > > Tim > > > --~

[Lift] Re: JPA w/Scala - never mind

2008-09-03 Thread Tim Perrett
@derek Awesome, is that new example using scala in the persistence module? Cheers Tim --~--~-~--~~~---~--~~ 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 un

[Lift] Re: JPA w/Scala - never mind

2008-09-03 Thread Charles F. Munat
Great! Derek Chen-Becker wrote: > Sorry I didn't get back to you on that. I'm working on an improved > version of the tutorial to include a complete example but it's dependent > on 0.10-SNAPSHOT right now. As soon as 0.10 goes GA I'll revise the > tutorial page. > > Derek > > On Tue, Sep 2,

[Lift] Re: JPA w/Scala - never mind

2008-09-03 Thread Derek Chen-Becker
Sorry I didn't get back to you on that. I'm working on an improved version of the tutorial to include a complete example but it's dependent on 0.10-SNAPSHOT right now. As soon as 0.10 goes GA I'll revise the tutorial page. Derek On Tue, Sep 2, 2008 at 8:35 PM, Charles F. Munat <[EMAIL PROTECTED]>

[Lift] Re: JPA w/Scala - never mind

2008-09-02 Thread Charles F. Munat
I figured it out, I think. Should be author.name, without the parentheses. Charles F. Munat wrote: > Has anyone followed the JPA tutorial using pure Scala instead of Java? > I've got it very close to running, but I am getting the following error: > > [WARNING] > /private/var/www/wsbg/webapp/sr