[Hibernate-JIRA] Created: (HV-353) Support inheritance for marker interfaces
by Marc Schipperheyn (JIRA)
Support inheritance for marker interfaces
-----------------------------------------
Key: HV-353
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-353
Project: Hibernate Validator
Issue Type: Improvement
Components: annotation-processor
Affects Versions: 4.1.0.Final
Reporter: Marc Schipperheyn
Assignee: Hardy Ferentschik
Currently, constraints use marker interface specified in the group attribute to determine whether a constraint is active for a certain context.
Unfortunately, group membership doesn't seem to support inheritance which would greatly reduce the number of markers required (and processing since you need less markers).
E.g. (contrived)
public interface CheckVehicle{}
public interface CheckCar extends CheckVehicle{}
public interface CheckBicycle extends CheckVehicle{}
//bean
@AssertTrue(groups={CheckVehicle.class})
Boolean workingBrakes()
@NotNull(groups={CheckBicycle.class})
String brakeType()
If the active group is CheckBicycle, it should validate both workingBrakes and brakeType.
It should be a relatively simply change as well.
--
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
13 years, 7 months
[Hibernate-JIRA] Created: (HV-374) NoSuchMethodError on Persistence.getPersistenceUtil() on WebLogic 10.3.3 (11g)
by Vitaly Polonetsky (JIRA)
NoSuchMethodError on Persistence.getPersistenceUtil() on WebLogic 10.3.3 (11g)
------------------------------------------------------------------------------
Key: HV-374
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-374
Project: Hibernate Validator
Issue Type: Bug
Affects Versions: 4.1.0.Final
Environment: WebLogic 10.3.3 (11g)
Reporter: Vitaly Polonetsky
Assignee: Hardy Ferentschik
The latest WebLogic comes with hybrid configuration of JPA 1.0 with some features of JPA 2.0:
https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&doctype=FAQ...
This causes a problem with the way Hibernate Validator checks for existence of JPA 2.0:
org.hibernate.validator.engine.resolver.DefaultTraversableResolver.detectJPA() checks for existance of javax.persistence.PersistenceUtil class (which exists only in JPA 2.0), but org.hibernate.validator.engine.resolver.JPATraversableResolver will not use it directly, instead it will use javax.persistence.Persistence.getPersistenceUtil() (the class exists for JPA 1.0, but the method is available only at JPA 2.0).
This check is good for situations where either full JPA 1.0 or full 2.0 implementation is available, but is cases like we have in WebLogic it leads to an Error:
java.lang.NoSuchMethodError: javax.persistence.Persistence.getPersistenceUtil()Ljavax/persistence/PersistenceUtil;
at org.hibernate.validator.engine.resolver.JPATraversableResolver.isReachable(JPATraversableResolver.java:62)
at org.hibernate.validator.engine.resolver.DefaultTraversableResolver.isReachable(DefaultTraversableResolver.java:94)
at org.hibernate.validator.engine.resolver.SingleThreadCachedTraversableResolver.isReachable(SingleThreadCachedTraversableResolver.java:47)
at org.hibernate.validator.engine.ValidatorImpl.isValidationRequired(ValidatorImpl.java:757)
at org.hibernate.validator.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:324)
at org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForRedefinedDefaultGroup(ValidatorImpl.java:273)
at org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:256)
at org.hibernate.validator.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:210)
at org.hibernate.validator.engine.ValidatorImpl.validate(ValidatorImpl.java:119)
...
I would suggest a possible way to overcome this situation in Hibernate Validator:
To check for existence of JPA 2.0, check the existence of Persistence.getPersistenceUtil() method, instead of checking for the existence of PersistenceUtil class. This will disable the use of JPA 2.0 features inside HV when the method is not available.
--
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
13 years, 7 months
[Hibernate-JIRA] Created: (HHH-5734) Restrict update or delete using Criteria
by Joachim Durchholz (JIRA)
Restrict update or delete using Criteria
----------------------------------------
Key: HHH-5734
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5734
Project: Hibernate Core
Issue Type: New Feature
Components: core
Reporter: Joachim Durchholz
I'd like to do something like
session
.createCriteria (MyEntity.class)
.add (Restrictions.eq ("someField", someValue))
.createQuery ("update set updatedField = :newValue")
(afterwards adding parameters and executing the thing, of course).
Currently, I need to do something like
session.createQuery ("update MyEntity set updatedField = :newValue where someField = :someValue")
To make the use case convincing, let me say that:
* some Restrictions are determined by the GUI, others by the application logic;
* the Restriction sets are merged at some point;
* before firing off the query, I need to check whether there's any Restriction at all to see whether I need a WHERE in the first place, then I need to wrap each Restriction's toSqlString result in parentheses and intersperse them with ANDs.
* This also means I'm forced to use SQL instead of HQL, meaning I need pass around SQL metadata together with a Restriction object to be able to actually generate SQL from it.
* One of the points of using Hibernate is not having to generate SQL (or HQL) on the fly, since that's somewhat error-prone. This works beautifully for SELECT, but not for UPDATE (or DELETE: having Criteria support for DELETE would be sweet, too).
The createQuery call above is probably not the way to go, it could be better to have something like createUpdate ("set updatedField = :newValue"), or maybe even something like addUpdate ("updatedField", ":newValue").
The result of such a call could be an Update object that embodies an UPDATE call, similarly to Criteria which embodies a SELECT.
Again, this could be extended to having createDelete, and a Delete type that embodies DELETE statements.
--
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
13 years, 7 months
[Hibernate-JIRA] Created: (HHH-2097) LAZY property results in org.hibernate.TransientObjectException after merge
by Reto Urfer (JIRA)
LAZY property results in org.hibernate.TransientObjectException after merge
---------------------------------------------------------------------------
Key: HHH-2097
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2097
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.0.cr4
Environment: Hibernate3.2 cr4 with Annotations cr2 and EntityManager cr2, Oracle10g R2, WindowsXP
Reporter: Reto Urfer
Priority: Critical
Attachments: BugLazyPropertyMerge.zip
Entity1 has a property e2 which references Entity2. This property is defined as follows.
@ManyToOne(fetch = FetchType.LAZY, optional = false)
private Entity2 e2;
If you have an instance e1 of Entity1 which has not initialized property e2 and you merge e1 to the EntityManager within a transaction, then you get the following exception during commit:
Exception in thread "main" javax.persistence.RollbackException: Error while commiting the transaction
at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:63)
at com.test.Test.main(Test.java:42)
Caused by: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.test.Entity1.e2 -> com.test.Entity2
at org.hibernate.engine.CascadingAction$9.noCascade(CascadingAction.java:350)
at org.hibernate.engine.Cascade.cascade(Cascade.java:139)
at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:130)
at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:121)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:65)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:53)
... 1 more
I added a small Testproject to reproduce this bug.
--
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
13 years, 7 months