Re: Integrating Hibernate Validator with Wicket

2010-02-16 Thread prati

Hi

I integrated Hibernate Validator given in Wicket stuff with my application

I am getting this error
org.hibernate.PropertyValueException: not-null property references a null or
transient value:
Any ideas?

Thanks
P

Carlos Vara wrote:
 
 Hi,
 
 if you prefer to use JSR 303 Bean Validation (it's very similar to
 Hibernate
 Validator, in fact, it is the reference implementation), I made a blog
 post
 about how to integrate it with Wicket:
 
 http://carinae.net/2009/12/integration-of-jsr-303-bean-validation-standard-and-wicket-1-4/
 
 
 On Mon, Jan 4, 2010 at 11:28 AM, ayman elwany aymanelw...@gmail.com
 wrote:
 
 thanks Martin for the link , I used it but I had a problem;


 public class CarPage extends WebPage {

 *   ..*
 *   ..*
UserModel user= 
 ((LoginSession)getSession()).getUserBean();
  *  ..*
 *..*
 *   ..*
 private void fillPersonalInfoComponents(Form personalForm) {
  *   ..*
  *   ..   *
PropertyModel fullnamepropertyModel =new
 PropertyModelString(user, fullNameValue);
 fullName = new TextField(fullName, fullnamepropertyModel);
  personalForm.add(fullName);
 //System.out.println(Model =
 +fullnamepropertyModel.getChainedModel().getClass().getName());
 fullName.add(new HibernateValidatorString(fullnamepropertyModel,
 fullNameValue));

  }
 }



 And the user model is

 public class UserModel implements Serializable {

 /**
  *
  */
 private static final long serialVersionUID = 1011452297289823651L;
*   ..*
 *   ..*
 *   ..*

 @NotNull
 @NotEmpty
 private String fullNameValue;
*   ..*
 *   ..*
 *   ..*
 }


 but it always fails and gives me that my model is null .  but the strange
 behaviour that when I changed  HibernateValidator constructor

 *from*

 public HibernateValidator(I*Model entityModel*, String property) {
 this.property = property;
 if (entityModel != null)
 hibernateValidator = new
 ClassValidator(*entityModel.getObject().getClass()*
 );
 }


 *TO*
 public HibernateValidator(*Object bean, *String property) {
 this.property = property;
 //if (entityModel != null)
 hibernateValidator = new ClassValidator(*bean.getClass()*);
 }

 and did this

 fullName.add(new HibernateValidatorString(user, fullNameValue));

 the validation worked *fine *!!!

 so is there is any problem in the propertymodel with hibernate
 validator???

 On Mon, Jan 4, 2010 at 8:37 AM, Martin Makundi 
 martin.maku...@koodaripalvelut.com wrote:

  http://42lines.net/content/integrating-hibernate-validator-and-wicket
 
  2010/1/4 ayman elwany aymanelw...@gmail.com:
   Hi,
  
   Is there any common practice to integrate wicket with hibernate
 validator
  ?
  
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 

 
 

-- 
View this message in context: 
http://old.nabble.com/Integrating-Hibernate-Validator-with-Wicket-tp27009326p27607538.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Integrating Hibernate Validator with Wicket

2010-01-04 Thread ayman elwany
thanks Martin for the link , I used it but I had a problem;


public class CarPage extends WebPage {

*   ..*
*   ..*
UserModel user=  ((LoginSession)getSession()).getUserBean();
  *  ..*
*..*
*   ..*
private void fillPersonalInfoComponents(Form personalForm) {
 *   ..*
  *   ..   *
PropertyModel fullnamepropertyModel =new
PropertyModelString(user, fullNameValue);
fullName = new TextField(fullName, fullnamepropertyModel);
  personalForm.add(fullName);
//System.out.println(Model =
+fullnamepropertyModel.getChainedModel().getClass().getName());
fullName.add(new HibernateValidatorString(fullnamepropertyModel,
fullNameValue));

  }
}



And the user model is

public class UserModel implements Serializable {

/**
 *
 */
private static final long serialVersionUID = 1011452297289823651L;
*   ..*
*   ..*
*   ..*

@NotNull
@NotEmpty
private String fullNameValue;
*   ..*
*   ..*
*   ..*
}


but it always fails and gives me that my model is null .  but the strange
behaviour that when I changed  HibernateValidator constructor

*from*

public HibernateValidator(I*Model entityModel*, String property) {
this.property = property;
if (entityModel != null)
hibernateValidator = new ClassValidator(*entityModel.getObject().getClass()*
);
}


*TO*
public HibernateValidator(*Object bean, *String property) {
this.property = property;
//if (entityModel != null)
hibernateValidator = new ClassValidator(*bean.getClass()*);
}

and did this

fullName.add(new HibernateValidatorString(user, fullNameValue));

the validation worked *fine *!!!

so is there is any problem in the propertymodel with hibernate validator???

On Mon, Jan 4, 2010 at 8:37 AM, Martin Makundi 
martin.maku...@koodaripalvelut.com wrote:

 http://42lines.net/content/integrating-hibernate-validator-and-wicket

 2010/1/4 ayman elwany aymanelw...@gmail.com:
  Hi,
 
  Is there any common practice to integrate wicket with hibernate validator
 ?
 

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




Re: Integrating Hibernate Validator with Wicket

2010-01-04 Thread Carlos Vara
Hi,

if you prefer to use JSR 303 Bean Validation (it's very similar to Hibernate
Validator, in fact, it is the reference implementation), I made a blog post
about how to integrate it with Wicket:

http://carinae.net/2009/12/integration-of-jsr-303-bean-validation-standard-and-wicket-1-4/


On Mon, Jan 4, 2010 at 11:28 AM, ayman elwany aymanelw...@gmail.com wrote:

 thanks Martin for the link , I used it but I had a problem;


 public class CarPage extends WebPage {

 *   ..*
 *   ..*
UserModel user=  ((LoginSession)getSession()).getUserBean();
  *  ..*
 *..*
 *   ..*
 private void fillPersonalInfoComponents(Form personalForm) {
  *   ..*
  *   ..   *
PropertyModel fullnamepropertyModel =new
 PropertyModelString(user, fullNameValue);
 fullName = new TextField(fullName, fullnamepropertyModel);
  personalForm.add(fullName);
 //System.out.println(Model =
 +fullnamepropertyModel.getChainedModel().getClass().getName());
 fullName.add(new HibernateValidatorString(fullnamepropertyModel,
 fullNameValue));

  }
 }



 And the user model is

 public class UserModel implements Serializable {

 /**
  *
  */
 private static final long serialVersionUID = 1011452297289823651L;
*   ..*
 *   ..*
 *   ..*

 @NotNull
 @NotEmpty
 private String fullNameValue;
*   ..*
 *   ..*
 *   ..*
 }


 but it always fails and gives me that my model is null .  but the strange
 behaviour that when I changed  HibernateValidator constructor

 *from*

 public HibernateValidator(I*Model entityModel*, String property) {
 this.property = property;
 if (entityModel != null)
 hibernateValidator = new
 ClassValidator(*entityModel.getObject().getClass()*
 );
 }


 *TO*
 public HibernateValidator(*Object bean, *String property) {
 this.property = property;
 //if (entityModel != null)
 hibernateValidator = new ClassValidator(*bean.getClass()*);
 }

 and did this

 fullName.add(new HibernateValidatorString(user, fullNameValue));

 the validation worked *fine *!!!

 so is there is any problem in the propertymodel with hibernate validator???

 On Mon, Jan 4, 2010 at 8:37 AM, Martin Makundi 
 martin.maku...@koodaripalvelut.com wrote:

  http://42lines.net/content/integrating-hibernate-validator-and-wicket
 
  2010/1/4 ayman elwany aymanelw...@gmail.com:
   Hi,
  
   Is there any common practice to integrate wicket with hibernate
 validator
  ?
  
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 



Re: Integrating Hibernate Validator with Wicket

2010-01-03 Thread Martin Makundi
http://42lines.net/content/integrating-hibernate-validator-and-wicket

2010/1/4 ayman elwany aymanelw...@gmail.com:
 Hi,

 Is there any common practice to integrate wicket with hibernate validator ?


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