[seam-issues] [JBoss JIRA] Commented: (JBSEAM-3247) Seam without hibernate: Please make org.jboss.seam.core.Validators independent from Hibernate

John Franey (JIRA) jira-events at lists.jboss.org
Sat Nov 27 22:40:30 EST 2010

    [ https://jira.jboss.org/browse/JBSEAM-3247?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565720#comment-12565720 ] 

John Franey commented on JBSEAM-3247:

So, Here is my workaround:

1) Create a class file in your project and copy in the code for org.jboss.seam.core.Validators from seam's source distribution.  Copying code is not good practice, but the code serves as good template.  For example, it has an inner class worth reusing but is not visible.  The inner class function is to resolve an EL expression and to drive the call to the validation library.

2) Your project's version of this class should extend org.jboss.seam.core.Validators.  This is required.  To get an instance of your component class, seam calls org.jboss.seam.core.Validators.instance which casts your class to this type.

3) Modify your project's version of this class to call your validator in YourValidators.ValidatingResolvers.setValue and to take the result from your validator to populate an array of InvalideValues.  Remove all unneeded cruft (including the static method 'instance', and maybe the validator cache - if you don't use it).

4) Add your validation library jar to the compile path of your project.  It should also be built into the ear.

5) Also, you will need a jar file that defines InvalidValue.  If your validation library is hibernate-validator 4.x, then also add hibernate-validator-legacy 4.0.2.GA.  If your own validation library is NOT HV 4.x, its necessary to leave hibernate-validator 3.1.x on the build path and ear library.

> Seam without hibernate: Please make org.jboss.seam.core.Validators independent from Hibernate 
> ----------------------------------------------------------------------------------------------
>                 Key: JBSEAM-3247
>                 URL: https://jira.jboss.org/browse/JBSEAM-3247
>             Project: Seam
>          Issue Type: Feature Request
>    Affects Versions: 2.0.2.GA
>            Reporter: Francisco Jose Peredo Noguez
>            Assignee: Pete Muir
>              Labels: hibernate_validation, seam_independence, seam_validation
>             Fix For: 2.1.0.BETA1
> I think org.jboss.seam.core.Validators should implement and interface, so that it could be possible to replace it with one that doesn't use org.hibernate.validator.ClassValidator I guess with that we could say that Seam can be used in a 100% free of Hibernate way
> I really like Hibernate, but sometimes, for really simple projects, or for projects full of interactions with stored procedures , it might be overkill or innapropiate, so it would be nice to be able to use Seam without having any Hibernate dependencies.

This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the seam-issues mailing list