[Hibernate-JIRA] Created: (HHH-2967) Cast to date in Formula still doesn't work
by Frederic Leitenberger (JIRA)
Cast to date in Formula still doesn't work
------------------------------------------
Key: HHH-2967
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2967
Project: Hibernate3
Issue Type: Bug
Components: query-criteria, query-hql, query-sql
Affects Versions: 3.2.5
Environment: Hibernate-Version: 3.2.5.ga
Oracle 9i/10g
Reporter: Frederic Leitenberger
Priority: Minor
Similar to HHH-473.
Oracle 10g supports trunc(TS). (TS is a timestamp)
Oracle 9i only supports trunc(cast(TS as date)) [and 10g supports this still too].
Therefore i need to add the cast to the Forumla.
@Basic
@Column(nullable = false, updatable = false)
@Temporal(TemporalType.TIMESTAMP)
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
@Formula(value = "trunc(cast(created as date))")
public Date getDate() {
return date
}
public void setDate(Date date {
this.date= date
}
This results in the following query:
select
eventlog0_.id as id9_0_,
eventlog0_.created as created9_0_,
.........
trunc(cast(eventlog0_.created as eventlog0_.date)) as formula6_0_
from
ICCS6.EventLog eventlog0_
where
eventlog0_.id=?
The alias in front of "date" is obviously misplaced there.
I also tried renaming the formula (since it was called "date"), but this didn't change the result.
--
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
16 years, 6 months
[Hibernate-JIRA] Created: (HV-252) HV with XML config tells me "Invalid property path." even though I know there is such a property.
by Ed Burns (JIRA)
HV with XML config tells me "Invalid property path." even though I know there is such a property.
-------------------------------------------------------------------------------------------------
Key: HV-252
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-252
Project: Hibernate Validator
Issue Type: Bug
Components: engine
Affects Versions: 4.0.0.GA
Environment: Java 6 on Mac OSX 10.5.8
Reporter: Ed Burns
Attachments: integration-test-servlet.war
I will attach a test war, but here is a summary of the problem. I am configuring my BV with the following XML
<?xml version=\'1.0\' encoding=\'UTF-8\'?>
<constraint-mappings xmlns=\"http://jboss.org/xml/ns/javax/validation/mapping\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xsi:schemaLocation=\"http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd\">
<default-package>integration_test_servlet</default-package>
<bean class=\"Person\" ignore-annotations=\"true\">
<field name=\"firstName\" ignore-annotations=\"true\">
<constraint annotation=\"javax.validation.constraints.NotNull\" />
</field>
<field name=\"lastName\" ignore-annotations=\"true\">
<constraint annotation=\"javax.validation.constraints.NotNull\" />
</field>
<getter name=\"listOfString\" ignore-annotations=\"true\">
<constraint annotation=\"javax.validation.constraints.NotNull\" />
</getter>
</bean>
</constraint-mappings>
My POJO looks like this:
package integration_test_servlet;
import java.util.List;
import javax.validation.constraints.NotNull;
public class Person {
@NotNull
private String firstName;
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
@NotNull
private String lastName;
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
private List<String> listOfString;
@NotNull
public List<String> getListOfString() {
return listOfString;
}
public void setListOfString(List<String> listOfString) {
this.listOfString = listOfString;
}
}
And I'm trying to validate like this:
List<String> listOfString = new ArrayList<String>();
listOfString.add("one");
listOfString.add("two");
listOfString.add("three");
Set<ConstraintViolation<Person>> violations =
beanValidator.validateValue(Person.class, "listOfString", listOfString);
But this causes the following exception:
java.lang.IllegalArgumentException: Invalid property path. There is no property listOfString in entity integration_test_servlet.Person
The same test, but with no XML configuration, relying instead on the Annotations, works ok.
--
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
16 years, 6 months