[Hibernate-JIRA] Created: (HV-509) Property path is wrong for cascaded validation of class-level constraints
by Gunnar Morling (JIRA)
Property path is wrong for cascaded validation of class-level constraints
-------------------------------------------------------------------------
Key: HV-509
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-509
Project: Hibernate Validator
Issue Type: Bug
Components: engine
Affects Versions: 4.2.0.Final
Reporter: Gunnar Morling
Fix For: 4.3.0.next
If a bean is validated which has a collection-typed member annotated with {{@Valid}} and of a type which itself has a class-level constraint, then the property pathes of the violations of that class-level constraint are wrong. The following shows an example:
{code:java}
public class FooTest {
@ValidFoo
private static class Foo {}
@Constraint(validatedBy = { ValidFooValidator.class })
@Target({ TYPE })
@Retention(RUNTIME)
public @interface ValidFoo {
String message() default "{ValidFoo.message}";
Class<?>[] groups() default { };
Class<? extends Payload>[] payload() default { };
}
public static class ValidFooValidator implements ConstraintValidator<ValidFoo, Foo> {
public void initialize(ValidFoo annotation) {}
public boolean isValid(Foo foo, ConstraintValidatorContext context) {
return false;
}
}
private static class Bar {
@Valid
private List<Foo> foos = Arrays.asList(new Foo(), new Foo());
}
@Test
public void testBar() {
Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
Set<ConstraintViolation<Bar>> violations = validator.validate(new Bar());
//fails as pathes currently are "foos[1]", "foos[1]"
ConstraintViolationAssert.assertCorrectPropertyPaths(violations, "foos[0]", "foos[1]");
}
}
{code}
The cause seems to be that the same {{PathImpl}} instance is used within both violations. When the 2nd violation is created, the index of the shared {{PathImpl}} instance originally created for the first violation is set from 0 to 1.
I think this can be circumvented by creating a copy of the path in the constructor of {{ConstraintValidatorContextImpl}}.
Forum reference: https://forum.hibernate.org/viewtopic.php?f=9&t=1011952
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 11 months
[Hibernate-JIRA] Created: (HHH-2965) When using Criteria.setResultTransformer(CriteriaSpecification.ALIAS_TO_ENTITY_MAP) method aliases need to be optional
by Ittai Zeidman (JIRA)
When using Criteria.setResultTransformer(CriteriaSpecification.ALIAS_TO_ENTITY_MAP) method aliases need to be optional
----------------------------------------------------------------------------------------------------------------------
Key: HHH-2965
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2965
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.2
Environment: 3.2.2 Oracle 10G
Reporter: Ittai Zeidman
Priority: Critical
now when using the CriteriaSpecification- ALIAS_TO_ENTITY_MAP the convertion to map is using the aliases array, if it does not find an alias for the property it is not included in the map. I think that if no alias is defined then the propertyName attribute needs to be assigned as the key for the value in the hashmap.
I came across this issue as i have many mapped entities in my system and when using projections i need to use the resultTransformer. this is critical as when using aliases it is duplicated not only to the select clause but to the where clause only which is another open bug (#HB-1331). If one bug is closed then the other can be considered as minor as i can give aliases to every property i need if it does not affect my where clause.
--
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
12 years, 11 months
[Hibernate-JIRA] Created: (JPA-14) OPTIMISTIC_FORCE_INCREMENT is not incrementing version field of non-dirty entities
by Behrang Saeedzadeh (JIRA)
OPTIMISTIC_FORCE_INCREMENT is not incrementing version field of non-dirty entities
----------------------------------------------------------------------------------
Key: JPA-14
URL: http://opensource.atlassian.com/projects/hibernate/browse/JPA-14
Project: Java Persistence API
Issue Type: Bug
Environment: MySQL 5.1.53 with InnoDB, Hibernate 3.1.6 Final, Java 1.6.0_22
Reporter: Behrang Saeedzadeh
According to the JPA 2 spec:
{quote}
If transaction T1 calls {{lock(entity, LockModeType.OPTIMISTIC_FORCE_INCREMENT)}} on a versioned object, the entity manager must avoid the phenomena P1 and P2 (as with {{LockModeType.OPTIMISTIC}}) and must also force an update (increment) to the entity's version column. A forced version update may be performed immediately, or may be deferred until a flush or commit. If an entity is removed before a deferred version update was to have been applied, the forced version update
is omitted.
{quote}
However, Hibernate is not incrementing the version field when the entity is not altered in the transaction:
{code}
final EntityManager em = factory.createEntityManager();
em.getTransaction().begin();
VersionedEntity entity = em.find(VersionedEntity.class, id);
em.lock(entity, LockModeType.PESSIMISTIC_FORCE_INCREMENT);
em.getTransaction().commit();
em.close();
{code}
However, the spec says ??must also force an update (increment) to the entity's version column?? and does not give the option to ignore updating the version number if the entity was not dirty.
--
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
12 years, 11 months
[Hibernate-JIRA] Created: (HHH-6042) To much columns in select queries after creating criteria with join
by Karol Kowalczyk (JIRA)
To much columns in select queries after creating criteria with join
-------------------------------------------------------------------
Key: HHH-6042
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6042
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.2.6
Environment: <dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.2.6.ga</version>
</dependency>
Any database
Reporter: Karol Kowalczyk
Attachments: AbstractEntityJoinWalker.java, Loader.java
When I create criteria for any class with any value of property of association f.e.:
java code:
eventDCriteria = DetachedCriteria.forClass(Event.class);
personDCriteria = eventDCriteria.createCriteria("participants");
personDCriteria.add(Expression.eq("age", 41));
List<Event> events=(List<Event>)getHibernateTemplate().findByCriteria(eventDCriteria, 0, 2);
class mappings:
<class name="Event" table="EVENTS">
<id name="id" column="EVENT_ID">
<generator class="native"/>
</id>
<property name="date" type="timestamp" column="EVENT_DATE"/>
<property name="title"/>
<set name="participants" table="PERSON_EVENT" inverse="true">
<key column="EVENT_ID"/>
<many-to-many column="PERSON_ID" class="Person"/>
</set>
</class>
<class name="Person" table="PERSON">
<id name="id" column="PERSON_ID">
<generator class="native"/>
</id>
<property name="age"/>
<property name="firstname"/>
<property name="lastname"/>
<set name="events" table="PERSON_EVENT" >
<key column="PERSON_ID"/>
<many-to-many column="EVENT_ID" class="Event"/>
</set>
<set name="emailAddresses" table="PERSON_EMAIL_ADDR" >
<key column="PERSON_ID"/>
<element type="string" column="EMAIL_ADDR"/>
</set>
</class>
a Hibernate still creates select query f.e.:
select e.EVENT_ID, e.EVENT_DATE, e.title, pe.EVENT_ID, pe.PERSON_ID, p.PERSON_ID, p.age, p.firstname, ...
from EVENTS e
inner join PERSON_EVENT pe on pe.EVENT_ID=e.EVENT_ID
inner join PERSON p on p.PERSON_ID=pe.PERSON_ID
where p.age=?;
Why this hibernates query have UNNECESSARY list of columns: pe.EVENT_ID, pe.PERSON_ID, p.PERSON_ID, p.age, p.firstname, ...?
This query is not INDEXONLY for any databases.
More EFFECTIVE query is:
select e.EVENT_ID, e.EVENT_DATE, e.title
from EVENTS e
inner join PERSON_EVENT pe on pe.EVENT_ID=e.EVENT_ID
inner join PERSON p on p.PERSON_ID=pe.PERSON_ID
where p.age=?;
A prepared only for my two changes in hibernate: Loader.java and AbstractEntityJoinWalker.java to get more effective selects.
--
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
12 years, 11 months
[Hibernate-JIRA] Created: (HSEARCH-886) Provide the ability to configure specific paths to index within @IndexEmbedded as an alternative to depth
by Zach Kurey (JIRA)
Provide the ability to configure specific paths to index within @IndexEmbedded as an alternative to depth
---------------------------------------------------------------------------------------------------------
Key: HSEARCH-886
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-886
Project: Hibernate Search
Issue Type: New Feature
Components: engine, mapping
Reporter: Zach Kurey
Frequently its desirable to index a particular embedded type differently depending on the use case of the referencing type that is the primary subject being indexed. Additionally, depth in general causes many more paths to be included in a document than necessary for a particular index. This makes tuning of indexing to eliminate problem paths difficult, and sometimes impossible if a particular object model re-uses a lot of types.
The proposal/improvement has already been discussed more in depth here: http://www.mail-archive.com/hibernate-dev@lists.jboss.org/msg06548.html, and what follows reflects some of that discussion.
As an example of how specific paths could be configured for indexing:
@Indexed
class A{
@IndexEmbedded(
depth=0,
@IndexPaths(paths={"d.one", "d.two"})
)
private C see;
}
@Indexed
class B{
@IndexEmbedded(
depth=0,
@IndexPaths(paths={"foo"})
)
private C see;
}
class C{
@IndexEmbedded
private Collection<D> d;
@Field
private int foo;
}
class D{
@Field
int one;
@Field
int two;
}
Index A would contain: d.one, and d.two
Index B would contain: foo, but would NOT contain anything from path 'd'.
Perhaps indexing path 'd' has a performance impact that is desirable to eliminate for B, but acceptable or necessary for A. This ability would also help to eliminate the bloat of unnecessary fields in lucene documents; which may not itself be a performance problem, but leaves a lot of things to rule out when tracking down indexing issues(both performance or content).
Lastly. To be clear, the above proposal(which really Sanne came up with in the email thread) does not conflict with depth. Here are some further examples of how depth may interact with explicit paths:
@IndexEmbedded(depth=3, paths={"a.b.c.d.e"})
Says to index all paths up to depth 3, but additionally index path 'a.b.c.d.e'.
@IndexEmbedded(depth=0, paths={"a.b.c.d.e"})
Says to only index path 'a.b.c.d.e'
@IndexEmbedded( paths={"a.b.c.d.e"})
Default behavior, depth is unlimited, specifying a.b.c.d.e is redundant in this case.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 11 months
[Hibernate-JIRA] Created: (HSEARCH-728) Backport MassIndexer to 3.1.X
by Chris Hornsey (JIRA)
Backport MassIndexer to 3.1.X
-----------------------------
Key: HSEARCH-728
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-728
Project: Hibernate Search
Issue Type: Task
Components: massindexer
Affects Versions: 3.1.1.GA
Environment: Hibernate 3.3.X and any jboss server platform prior to 6.0.
Reporter: Chris Hornsey
Anyone using a non JPA2 version of hibernate is unable to utilize the capabilities of the MassIndexer introduced in version 3.2 of search. At a cursory glance I can not determine a dependency of the new indexer on JPA2.
It would be very beneficial to make this available as utilizing hibernate search on existing application and manually indexing is obviously difficult with this new massindexer.
Also anyone who chooses to use a supported version of jboss is excluded from this functionality until most likely 2012.
If this is not possible i would appreciate an explanation of the dependencies the massindexer has on search 3.2.
--
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
12 years, 11 months