4 Replies Latest reply on Aug 19, 2008 4:17 PM by Rick Kilcoyne


    Rick Kilcoyne Newbie

      This might belong in a hibernate forum, but has anyone had any success using the @CreditCardNumber annotation on an Entity object? I seem to be able to use other validators in org.hibernate.validators, but no luck with @CreditCardNumber.


        • 1. Re: CreditCardNumber
          Neil C Novice

          I cannot speak to the effectiveness of @CreditCardNumber because I wrote my own annotation using Apache Commons Validator.  If I understand correctly, the Hibernate Validator version uses the Luhn algorithm for validation while the Commons version uses that and additional mechanisms to verify against the type of card.  The implementation is fairly trivial, and it works for me.

          As far as @CreditCardNumber, perhaps you could post the manner you are annotating your entity and how you are using one of the Seam JSF validation controls to activate it.


          • 2. Re: CreditCardNumber
            Brian Hiles Newbie

            Do you have hibernate-commons-annotations.jar in your classpath? Some of the Hibernate validations need that extra bit to work. I ran into the same issue with EAN validation.

            • 3. Re: CreditCardNumber
              Rick Kilcoyne Newbie

              This was my first instinct, so I added hibernate-commons-annotations.jar to my deployed-jars-ear.list. No luck. Then tried adding to the deployed-jars-war.list -- same result. What I find really odd is that other annotation validators such as @Length work fine.

              • 4. Re: CreditCardNumber
                Rick Kilcoyne Newbie

                Still working on this issue...

                One question about annotations: Are they linked/applied at compile time or runtime? My understanding was that they're essentially a programming shortcut implemented at compile time.

                As far as this validator goes... it's not being called from my entity object. Very odd. Other org.hibernate.* validators -- no problem.