You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by hwaastad <he...@waastad.org> on 2016/09/19 08:23:30 UTC

7.0.1 and validation

Hi,
quick check with you guys regarding jax-rs validation.

if I do a @valid in a simple model validation is ok

However, if I extend this model, validation is not working on submodel.

https://github.com/hwaastad/TomeeJaxrsValidation.git

in 1.7.x this is working with "ejb strategy".

br hw





--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/7-0-1-and-validation-tp4680145.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: 7.0.1 and validation

Posted by hwaastad <he...@waastad.org>.
Sorry guys,

Lost in translation here....meaning I totally screwed up params in method so
everything IS ok.

I think I was a little bit tired after solving another issue (which comes in
my next post..stay tuned :-))

/hw



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/7-0-1-and-validation-tp4680145p4680157.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: 7.0.1 and validation

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Lombok c1n play a role there

Le 19 sept. 2016 16:17, "Steve Goldsmith" <sg...@gmail.com> a écrit :

> This works for me in 7.0.1:
>
> public class BaseDto implements Serializable {
>
>     /**
>      * Serial UID.
>      */
>     private static final long serialVersionUID = 6528044487061552972L;
>     /**
>      * Customer GUID.
>      */
>     @NotNull
>     @SuppressWarnings("checkstyle:magicnumber") // No need for constants
> here
>     @Size(min = 36, max = 36)
>     private String customerGuid;
>     /**
>      * MAS/ODN IP address.
>      */
>     @NotNull
>     private String hostName;
>
>     /**
>      * Default constructor.
>      */
>     public BaseDto() {
>         super();
>     }
>
>     /**
>      * Construct DTO and populate params.
>      *
>      * @param customerGuid Customer GUID.
>      * @param hostName MAS/ODN IP address.
>      * @param maxAgeMs Maximum age in MS.
>      * @param transId Transaction ID.
>      */
>     @ConstructorProperties({"customerGuid", "hostName", "maxAgeMs",
> "transId"})
>     public BaseDto(final String customerGuid, final String hostName,
>             final Long maxAgeMs, final Long transId) {
>         this.customerGuid = customerGuid;
>         this.hostName = hostName;
>         this.maxAgeMs = maxAgeMs;
>         this.transId = transId;
>     }
>
> Then:
>
> public class CustStbDto extends BaseDto {
>
>     /**
>      * Serial UID.
>      */
>     private static final long serialVersionUID = 854397785671571437L;
>
>     /**
>      * Account Id.
>      */
>     @NotNull
>     private String accountId;
>
> On Mon, Sep 19, 2016 at 4:23 AM, hwaastad <he...@waastad.org> wrote:
>
> > Hi,
> > quick check with you guys regarding jax-rs validation.
> >
> > if I do a @valid in a simple model validation is ok
> >
> > However, if I extend this model, validation is not working on submodel.
> >
> > https://github.com/hwaastad/TomeeJaxrsValidation.git
> >
> > in 1.7.x this is working with "ejb strategy".
> >
> > br hw
> >
> >
> >
> >
> >
> > --
> > View this message in context: http://tomee-openejb.979440.
> > n4.nabble.com/7-0-1-and-validation-tp4680145.html
> > Sent from the TomEE Users mailing list archive at Nabble.com.
> >
>
>
>
> --
> Steven P. Goldsmith
>

Re: 7.0.1 and validation

Posted by Steve Goldsmith <sg...@gmail.com>.
This works for me in 7.0.1:

public class BaseDto implements Serializable {

    /**
     * Serial UID.
     */
    private static final long serialVersionUID = 6528044487061552972L;
    /**
     * Customer GUID.
     */
    @NotNull
    @SuppressWarnings("checkstyle:magicnumber") // No need for constants
here
    @Size(min = 36, max = 36)
    private String customerGuid;
    /**
     * MAS/ODN IP address.
     */
    @NotNull
    private String hostName;

    /**
     * Default constructor.
     */
    public BaseDto() {
        super();
    }

    /**
     * Construct DTO and populate params.
     *
     * @param customerGuid Customer GUID.
     * @param hostName MAS/ODN IP address.
     * @param maxAgeMs Maximum age in MS.
     * @param transId Transaction ID.
     */
    @ConstructorProperties({"customerGuid", "hostName", "maxAgeMs",
"transId"})
    public BaseDto(final String customerGuid, final String hostName,
            final Long maxAgeMs, final Long transId) {
        this.customerGuid = customerGuid;
        this.hostName = hostName;
        this.maxAgeMs = maxAgeMs;
        this.transId = transId;
    }

Then:

public class CustStbDto extends BaseDto {

    /**
     * Serial UID.
     */
    private static final long serialVersionUID = 854397785671571437L;

    /**
     * Account Id.
     */
    @NotNull
    private String accountId;

On Mon, Sep 19, 2016 at 4:23 AM, hwaastad <he...@waastad.org> wrote:

> Hi,
> quick check with you guys regarding jax-rs validation.
>
> if I do a @valid in a simple model validation is ok
>
> However, if I extend this model, validation is not working on submodel.
>
> https://github.com/hwaastad/TomeeJaxrsValidation.git
>
> in 1.7.x this is working with "ejb strategy".
>
> br hw
>
>
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.
> n4.nabble.com/7-0-1-and-validation-tp4680145.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>



-- 
Steven P. Goldsmith