users@ejb-spec.java.net

[ejb-spec users] [jsr345-experts] Re: Bean Validation support for EJBs?

From: Stefan Heldt <stefan.heldt_at_holisticon.de>
Date: Wed, 29 Aug 2012 12:59:14 +0200

+1

Von: Florent BENOIT [mailto:Florent.Benoit_at_ow2.org]
Gesendet: Mittwoch, 29. August 2012 11:14
An: jsr345-experts_at_ejb-spec.java.net
Betreff: [jsr345-experts] Re: Bean Validation support for EJBs?

    Hi,

I also agree that BV should be supported by EJB spec. (with or without CDI)

Florent

On 08/29/2012 10:19 AM, Jean-Louis MONTEIRO wrote:
Hi,

Yes, agree with Antonio.
Method level validation was optional and is now part of BV 1.1.
It should work out of the box with or without CDI.

As an example, we already have it out of the box in OpenEJB and it's useful.

Here is an example
http://openejb.apache.org/examples-trunk/bean-validation-design-by-contract/

So, +1 to support BV for method level validation

Jean-Louis


2012/8/29 Antonio Goncalves <antonio.goncalves_at_gmail.com<mailto:antonio.goncalves_at_gmail.com>>
Hi all,

With the new Bean Validation 1.1 method-level validation I expect something to work out of the box (with or without CDI) :

@Stateless
public class AccountService {

    public Account get(@NotNull Account model) { }
}


As for Stateful bean the question is "is there a possible integration between BV and EJB like JPA or JSF" ? For example, in the following code, shall we automatically validate the bean on @Remove (like @PreRemove on JPA) :

@Stateful
public class ShoppingCart {

    @NotNull
    private List<CartItem> cartItems;

    @Remove
    public voide checkout { // validate cartItems ? }
}

I don't really see the point in something like that, but I might miss something. Could there be another possible integration ?

Antonio

On Wed, Aug 29, 2012 at 12:41 AM, Marina Vatkina <marina.vatkina_at_oracle.com<mailto:marina.vatkina_at_oracle.com>> wrote:
Experts,

As you know, EJB spec currently doesn't support Bean Validation. Do we want to change that?

Let me know if you think that:

a) BV should be supported for EJBs without CDI being enabled (probably with an opt-in flag to be backward compatible)
b) BV should be supported for EJBs only if CDI is enabled
c) there is no need for standardizing BV with respect to EJBs
d) you don't care either way :(


thanks,
-marina



--
Antonio Goncalves
Software architect and Java Champion
Web site<http://www.antoniogoncalves.org> | Twitter<http://twitter.com/agoncal> | LinkedIn<http://www.linkedin.com/in/agoncal> | Paris JUG<http://www.parisjug.org> | Devoxx France<http://www.devoxx.fr>