[hibernate-dev] [Validator] method level validation

2010-09-27 Thread Hardy Ferentschik
Hi,

forwarding this email to hibernate-dev to get some more feedback.

Here are some of my thoughts. The method level validation is suggested in  
Appendix C of the Bean Validation specification. The method signatures  
there all return a set of ConstraintViolations.
The question is how binding these signatures are.

Root bean and property path are indeed questionable for method level  
validation. By extending ConstraintViolation you still have to deal with  
these values. Maybe instead of
extending we should have a new interface MethodConstraintViolation.

Emmanuel, do you have some more feedback on what was discussed regarding  
appendix C?

--Hardy

--- Forwarded message ---
From: "Gunnar Morling" 
To: "Hardy Ferentschik" 

while working on method-level validation I wondered how to represent the  
failing validation of method parameters. I think  
javax.validation.ConstraintViolation in its current form is only partly  
suitable for the needs of parameter/return value validation:

* The concept of property path seems not to fit right. How would the  
property path look for a failing parameter constraint? One could come up  
with something like "MyBean.MyMethod(String,Int).Parameters[1]" but I  
can't say I'd like that
  * The concept of a root bean does only fit partly. I think one would need  
a safe reference to the "root method" and the parameter index. A direct  
reference to the class hosting the validated method seems only partly  
useful (and could anytimes be retrieved from a Method reference).

I therefore prototyped this into this direction:

* Created a MethodConstraintViolation that extends ConstraintViolation by  
adding fields the causing method and the parameter index (one surely would  
add a flag or something in case of return value validation)
  * In case a constraint directly at one of a method's parameters fail,  
ConstraintViolation#rootBean and propertyPath are null (but method and  
parameterIndex are set)
* In case a "cascading" constraint fails (meaning in this context, a  
parameter is annotated with @Valid and the referenced bean has constraints  
itself which in turn fail), method and parameterIndex are set, rootBean  
and propertyPath refer to parameter bean itself, *not* the class hosting  
the validated method

WDYT, is this the right way to go? Maybe we should brainstorm a bit on IRC?




___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev


[hibernate-dev] Dialect documentation

2010-09-27 Thread Norman Bauer
Could anyone provide me with links to any guidance docouments/articles on
creating a dialect? I have a fairly non standard database that I need to
hook into any guidance would be greatly appreciated.

Thanks,
Norm
___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev


[hibernate-dev] Annotation name for column-level read/write expression

2010-09-27 Thread Emmanuel Bernard
Hey guys,
I've implemented 
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4510 and 
committed it. It basically looks like that

@Entity
class CreditCard {
   @Column(name="credit_card_num")
   @ReadWriteExpression(
  forColumn="credit_card_num", 
  read="decrypt(credit_card_num)", 
  write="encrypt(?)")
   public String getCreditCardNumber() { return creditCardNumber; }
   public void setCreditCardNumber(String number) { this.creditCardNumber = 
number; }
   private String creditCardNumber;
}

However, I am not super happy about @ReadWriteExpression as a name. 
@ColumnReadWriteExpression is the most correct name but quite mouthful. 

Anybody gets a better idea?

Emmanuel

___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev


Re: [hibernate-dev] Annotation name for column-level read/write expression

2010-09-27 Thread Paul Benedict
I am not happy about @ReadWriteExpression either. Why not just
@ReadExpression and @WriteExpression? I don't even think you need the
forColumn attribute -- it could be derived out of the metadata.

On Mon, Sep 27, 2010 at 5:10 PM, Emmanuel Bernard
 wrote:
> Hey guys,
> I've implemented 
> http://opensource.atlassian.com/projects/hibernate/browse/HHH-4510 and 
> committed it. It basically looks like that
>
> @Entity
> class CreditCard {
>   @Column(name="credit_card_num")
>   @ReadWriteExpression(
>      forColumn="credit_card_num",
>      read="decrypt(credit_card_num)",
>      write="encrypt(?)")
>   public String getCreditCardNumber() { return creditCardNumber; }
>   public void setCreditCardNumber(String number) { this.creditCardNumber = 
> number; }
>   private String creditCardNumber;
> }
>
> However, I am not super happy about @ReadWriteExpression as a name. 
> @ColumnReadWriteExpression is the most correct name but quite mouthful.
>
> Anybody gets a better idea?
>
> Emmanuel
>
> ___
> hibernate-dev mailing list
> hibernate-dev@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>

___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev


[hibernate-dev] Transaction API

2010-09-27 Thread Steve Ebersole
Currently there is a big discrepancy between the documentation for some
of the methods on org.hibernate.Transaction and the actual code.
Specifically the methods isActive(), wasRolledBack() and wasCommitted()
explicitly state that they only account for the "local state" of the
transaction object, not the underlying transaction.

However, the code explicitly checks the current status of JTA
transactions to responded to these methods.

We need to fix one or the other.  Personally I do not follow the use of
these methods too much, so asking for feedback on which way is more
useful.

-- 
Steve Ebersole 
http://hibernate.org

___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev


Re: [hibernate-dev] Annotation name for column-level read/write expression

2010-09-27 Thread Steve Ebersole
@Wrapper( 
forColumn="credit_card_num", 
read="decrypt(credit_card_num)",  
write="encrypt(?)"
)

@ReadWrapper( forColumn="credit_card_num",
expression="decrypt(credit_card_num)" )
@WriteWrapper( forColumn="credit_card_num", expression="encrypt(?)" )



On Tue, 2010-09-28 at 00:10 +0200, Emmanuel Bernard wrote:
> Hey guys,
> I've implemented 
> http://opensource.atlassian.com/projects/hibernate/browse/HHH-4510 and 
> committed it. It basically looks like that
> 
> @Entity
> class CreditCard {
>@Column(name="credit_card_num")
>@ReadWriteExpression(
>   forColumn="credit_card_num", 
>   read="decrypt(credit_card_num)", 
>   write="encrypt(?)")
>public String getCreditCardNumber() { return creditCardNumber; }
>public void setCreditCardNumber(String number) { this.creditCardNumber = 
> number; }
>private String creditCardNumber;
> }
> 
> However, I am not super happy about @ReadWriteExpression as a name. 
> @ColumnReadWriteExpression is the most correct name but quite mouthful. 
> 
> Anybody gets a better idea?
> 
> Emmanuel
> 
> ___
> hibernate-dev mailing list
> hibernate-dev@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev

-- 
Steve Ebersole 
http://hibernate.org

___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev


Re: [hibernate-dev] Annotation name for column-level read/write expression

2010-09-27 Thread Steve Ebersole
Is the 'forColumn' attribute required if a single column value?


On Mon, 2010-09-27 at 22:53 -0500, Steve Ebersole wrote:
> @Wrapper( 
> forColumn="credit_card_num", 
> read="decrypt(credit_card_num)",  
> write="encrypt(?)"
> )
> 
> @ReadWrapper( forColumn="credit_card_num",
> expression="decrypt(credit_card_num)" )
> @WriteWrapper( forColumn="credit_card_num", expression="encrypt(?)" )
> 
> 
> 
> On Tue, 2010-09-28 at 00:10 +0200, Emmanuel Bernard wrote:
> > Hey guys,
> > I've implemented 
> > http://opensource.atlassian.com/projects/hibernate/browse/HHH-4510 and 
> > committed it. It basically looks like that
> > 
> > @Entity
> > class CreditCard {
> >@Column(name="credit_card_num")
> >@ReadWriteExpression(
> >   forColumn="credit_card_num", 
> >   read="decrypt(credit_card_num)", 
> >   write="encrypt(?)")
> >public String getCreditCardNumber() { return creditCardNumber; }
> >public void setCreditCardNumber(String number) { this.creditCardNumber = 
> > number; }
> >private String creditCardNumber;
> > }
> > 
> > However, I am not super happy about @ReadWriteExpression as a name. 
> > @ColumnReadWriteExpression is the most correct name but quite mouthful. 
> > 
> > Anybody gets a better idea?
> > 
> > Emmanuel
> > 
> > ___
> > hibernate-dev mailing list
> > hibernate-dev@lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/hibernate-dev
> 

-- 
Steve Ebersole 
http://hibernate.org

___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev