Re: Tapestry 5.1 on top of GORM Hibernate Session bound to thread

2009-04-07 Thread Otho
You use transactional support like:

User.withTransaction{
  user.save()
}

What I find much more annoying is that the Gorm events don't work.


2009/4/6 ice96 ice...@gmail.com


 Hello,

 I'm experimenting with T5.1 and GORM. At the moment I'm trying to save
 models into the database. Models without associations like: hasMany and
 BelongsTo works perfectly. But when I try To save model like this:


 package org.example.entities
 mport grails.persistence.Entity

 @Entity
 public class User {
  long id
  String login
  String password
  static belongsTo = [role:Role]

  static mapping = {
  table 'USERS'
  login column:'LOGIN'
  password column:'PASSWORD'
  }
 }

 With this:

 package org.example.pages.users

 import org.apache.tapestry5.annotations.Property
 import org.apache.tapestry5.ioc.annotations.Inject
 import org.example.entities.User
 import org.slf4j.Logger

 public class UsersAdd {
  @Inject
  private Logger log

  @Property
  private User user;

  Object onSuccess() {
user.save();
return null
  }

 }


 I have got an error: Hibernate Session bound to thread, and configuration
 does not allow creation of non-transactional one here

 As I sad, this works fine without associations. How to configure and pass
 transactional session from Tapestry to Gorm?

 Any suggestions?

 --
 View this message in context:
 http://www.nabble.com/Tapestry-5.1-on-top-of-GORM-Hibernate-Session-bound-to-thread-tp22900050p22900050.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org




Re: Tapestry 5.1 on top of GORM Hibernate Session bound to thread

2009-04-07 Thread ice96

Thank you. This works like a charm.

Saddly but the Gorm events not work for me too. 

Now I'm thinking about the Tapestry Grid and the BeanEditForm form
improvements. I want automaticly bind belongsTo anotation for multiple
choice (select) in BeanEditForm. 
-- 
View this message in context: 
http://www.nabble.com/Tapestry-5.1-on-top-of-GORM-Hibernate-Session-bound-to-thread-tp22900050p22927783.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Tapestry 5.1 on top of GORM Hibernate Session bound to thread

2009-04-05 Thread ice96

Hello,

I'm experimenting with T5.1 and GORM. At the moment I'm trying to save
models into the database. Models without associations like: hasMany and
BelongsTo works perfectly. But when I try To save model like this:


package org.example.entities
mport grails.persistence.Entity

@Entity
public class User {
  long id
  String login
  String password
  static belongsTo = [role:Role]

  static mapping = {
  table 'USERS'
  login column:'LOGIN'
  password column:'PASSWORD'
  }
}

With this:

package org.example.pages.users

import org.apache.tapestry5.annotations.Property
import org.apache.tapestry5.ioc.annotations.Inject
import org.example.entities.User
import org.slf4j.Logger

public class UsersAdd {
  @Inject
  private Logger log

  @Property
  private User user;

  Object onSuccess() {
user.save();
return null
  }

}


I have got an error: Hibernate Session bound to thread, and configuration
does not allow creation of non-transactional one here

As I sad, this works fine without associations. How to configure and pass
transactional session from Tapestry to Gorm?

Any suggestions?

-- 
View this message in context: 
http://www.nabble.com/Tapestry-5.1-on-top-of-GORM-Hibernate-Session-bound-to-thread-tp22900050p22900050.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org