[Hibernate-JIRA] Created: (ANN-511) Two level @Valid annotation doesn't work
by Rakesh Kalra (JIRA)
Two level @Valid annotation doesn't work
-----------------------------------------
Key: ANN-511
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-511
Project: Hibernate Annotations
Type: Bug
Components: validator
Versions: 3.2.1
Environment: hibernate-annotations 3.2.1.ga
Reporter: Rakesh Kalra
I have object depth of 3: Form, Member, Address. I get the following exception when initializing ClassValidator:
java.lang.NullPointerException
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:142)
at org.hibernate.validator.ClassValidator.createChildValidator(ClassValidator.java:252)
at org.hibernate.validator.ClassValidator.initValidator(ClassValidator.java:216)
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:149)
at org.hibernate.validator.ClassValidator.createChildValidator(ClassValidator.java:252)
at org.hibernate.validator.ClassValidator.initValidator(ClassValidator.java:216)
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:134)
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:105)
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:97)
...
This works fine with 3.2.0.ga.
I think the problem is in the following constructor, where instance level "reflectionManager" is not being initialized.
protected ClassValidator(
XClass beanXClass, ResourceBundle resourceBundle, MessageInterpolator userInterpolator,
Map<XClass, ClassValidator> childClassValidators, ReflectionManager reflectionManager
) {
this.beanClass = reflectionManager.toClass( beanXClass );
this.messageBundle = resourceBundle == null ?
getDefaultResourceBundle() :
resourceBundle;
this.defaultMessageBundle = ResourceBundle.getBundle( DEFAULT_VALIDATOR_MESSAGE );
this.userInterpolator = userInterpolator;
this.childClassValidators = childClassValidators;
initValidator( beanXClass, childClassValidators );
}
The other constructor initializes reflectionManager.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
17 years, 5 months
[Hibernate-JIRA] Created: (ANN-514) Validator doesn't support validation based on value of other fields in the object
by Rakesh Kalra (JIRA)
Validator doesn't support validation based on value of other fields in the object
---------------------------------------------------------------------------------
Key: ANN-514
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-514
Project: Hibernate Annotations
Type: Improvement
Components: validator
Versions: 3.2.1
Environment: Hibernate Annotations 3.2.1
Reporter: Rakesh Kalra
I really like Hibernate Validator. In the absense of this framework, I was going to write something similar.
But, I see a major limitation. If validation of a field depends on the value of another field in the same object,
hibernate validator doesn't have a way to handle this.
The simplest example is when the validator is used for forms. Forms sometimes have fields like "email" and "retypeEmail".
It would be great to be able to write a custom annotation:
@Match(property="retypeEmail")
public String getEmail(){
return email;
}
where, getRetypeEmail() is also available in the same object.
Another example is where validation of a credit card number, depends on the credit card type
This feature can be implemented, by exposing the object being validated to the isValid() method.
Without changing the signature of this method, the object can be exposed via some kind
of a ValidationContext object, which is stored as a ThreadLocal variable.
Please let me know the best work around, until this feature can be implemented.
Regards,
Rakesh
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
17 years, 5 months
[Hibernate-JIRA] Created: (ANN-516) @OrderBy added to wrong table in inheritance relationship
by Martijn Reuvers (JIRA)
@OrderBy added to wrong table in inheritance relationship
---------------------------------------------------------
Key: ANN-516
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-516
Project: Hibernate Annotations
Type: Bug
Versions: 3.2.1
Environment: Hibernate 3.2.1 GA release, 3.2.1 GA release for hibernate-annotations. Oracle database 10 Release 2.
Reporter: Martijn Reuvers
Attachments: orderby_testcase.zip
Hi Emmanuel,
As promised by John (I forgot my account so he filed the forum :/), hereby a working isolated testcase.
It seems an invalid order-by clause is generated for an inheritance relationship in the following example-case:
Person
OrganisationUser (extends Person)
Organisation has * OrganisationUsers
The method in organisation:
@OneToMany (mappedBy="organisation",
fetch=FetchType.LAZY,
cascade={CascadeType.PERSIST,CascadeType.MERGE})
@OrderBy (value="firstName")
public Set<OrganisationUser> getOrganisationUsers() {
return organisationUsers;
}
The order-by attribute firstName is declared in Person, however the generated sql-query tries to order-by on the organisation-user table. Attached a fully working JDeveloper 10.1.3 project (zipped), if you want to use another IDE, just get the sources out of /database/src, /model/src and /test/src and you're good to go as well. I did not attach any libraries (as these are big), they were in the /libs/src directory, the libraries used to compile and run in that directory are:
ant-antlr-1.6.5.jar
antlr-2.7.6.jar
asm-attrs.jar
asm.jar
cglib-2.1.3.jar
commons-collections-2.1.1.jar
commons-logging-1.0.4.jar
dms.jar (oracle!)
dom4j-1.6.1.jar
ehcache-1.2.3.jar
ejb3-persistence.jar
hibernate-annotations.jar
hibernate3.jar
jta.jar
ojdbc14dms.jar (oracle!)
All are from the hibernate / hibernate annotations distribution releases, with the exception of oracle jdbc drivers. To get quickly started locate the: OrderByTest source file and hibernate.cfg.xml to change your connection, tables.sql contains a script you can directly run in Oracle to get the needed tables.
OrderByTest contains code to fill the tables with some test data and then runs the tests (see comments in OrderByTest).
If you have questions, just let me know.
Thanks!
Martijn
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
17 years, 5 months
[Hibernate-JIRA] Commented: (HHH-1423) ParameterParser bug - ordinal parameter mismatch
by Carl Lindberg (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1423?page=c... ]
Carl Lindberg commented on HHH-1423:
------------------------------------
I have a situation where a portion of HQL is dynamically generated, potentially including the problem attribute names, so as far as I can tell there is no workaround I can use short of not allowing the substring "call" to be part of any attribute name. Is there any hope of getting this patch into a release? It's still a problem in 3.2.1.
> ParameterParser bug - ordinal parameter mismatch
> -------------------------------------------------
>
> Key: HHH-1423
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1423
> Project: Hibernate3
> Type: Bug
> Components: query-hql
> Versions: 3.1.2
> Environment: Windows XP SP2, JDK 1.5.0_06-b05, Spring 1.2.6, antlr-2.7.6rc1
> Reporter: Artur Wronski
> Priority: Critical
> Attachments: HHH1423Test.java, ParameterParser.2.patch, ParameterParser.3.patch, ParameterParser.patch, RecognizerBug.java
>
>
> There is still problem with ParameterParser. The same was in Hibernate 3.1.1
> Runnable TestCase in attachment.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
17 years, 6 months