How to use the validate() method of a existing domain class

View: New views
2 Messages — Rating Filter:   Alert me  

How to use the validate() method of a existing domain class

by Felipe Cypriano :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I need to reuse some entities in my Grails app, they have a method called validate() that uses Hibernate Validator to do the validation. But when I call myEntity.validate() the result is true event when it should be false. I think grails is executing it's own validate(), how could I tell grails to not override existing methods?

Regards,
---
Felipe Cypriano

Re: How to use the validate() method of a existing domain class

by Felipe Cypriano :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

A java domain class:
@Entity
public class ExistingEntity {
  // some properties
  public boolean  validate() {
     return false; // force error
  }
}

If I map this entity and try to use it's validate method the result is true. Is it possible to reuse this existing class without reimplement the validation method?

Regards,
---
Felipe Cypriano


On Fri, Jul 3, 2009 at 15:55, Felipe Cypriano <fmcypriano@...> wrote:
Hello,

I need to reuse some entities in my Grails app, they have a method called validate() that uses Hibernate Validator to do the validation. But when I call myEntity.validate() the result is true event when it should be false. I think grails is executing it's own validate(), how could I tell grails to not override existing methods?

Regards,
---
Felipe Cypriano