[Hibernate-JIRA] Created: (EJB-313) delete twice triggers detached entity error, but change to composite primary key and the exception is gone.
by Simon Ng (JIRA)
delete twice triggers detached entity error, but change to composite primary key and the exception is gone.
-----------------------------------------------------------------------------------------------------------
Key: EJB-313
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-313
Project: Hibernate Entity Manager
Issue Type: Bug
Affects Versions: 3.2.0.cr3
Environment: Windows XP Professional + Postgres 8.1 + Spring 2 + JPA + Hibernate 3.2.3
Reporter: Simon Ng
Attachments: DeleteTwice.zip
The attached file DeleteTwice.zip has the entire project; and the primary key is a composite primary key. Run the unit test and there is no exception, just an INFO level message of "handling transient entity in delete processing".
Next, delete RestaurantPK.java, and change Restaurant.java to use a simple primary key:
package blog.jpa.domain;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToOne;
@Entity
public class Restaurant {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
private String name;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
Change the onSetUpInTransaction to use different SQL statement to reflect a different table
protected void onSetUpInTransaction() throws Exception {
jdbcTemplate.execute("insert into restaurant (id, name) values (1, 'Burger Barn')");
jdbcTemplate.execute("insert into restaurant (id, name) values (2, 'Veggie Village')");
jdbcTemplate.execute("insert into restaurant (id, name) values (3, 'Dover Diner')");
}
drop the table restaurant and run the unit test again. Now there is an exception
[junit] Testcase: testDeleteRestaurant(blog.jpa.dao.JpaRestaurantDaoTests): Caused an ERROR
[junit] Removing a detached instance blog.jpa.domain.Restaurant#3; nested exception is java.lang.IllegalArgumentExce
ption: Removing a detached instance blog.jpa.domain.Restaurant#3
[junit] org.springframework.dao.InvalidDataAccessApiUsageException: Removing a detached instance blog.jpa.domain.Res
taurant#3; nested exception is java.lang.IllegalArgumentException: Removing a detached instance blog.jpa.domain.Restaura
nt#3
[junit] Caused by: java.lang.IllegalArgumentException: Removing a detached instance blog.jpa.domain.Restaurant#3
[junit] at org.hibernate.ejb.event.EJB3DeleteEventListener.performDetachedEntityDeletionCheck(EJB3DeleteEventLis
tener.java:45)
The java.lang.IllegalArgumentException is specified in the JPA spec.
--
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
15 years, 6 months
[Hibernate-JIRA] Created: (HV-184) ResourceBundlerMessageInterpolator fails to meet the spec in some issues
by Daniel Yokomizo (JIRA)
ResourceBundlerMessageInterpolator fails to meet the spec in some issues
------------------------------------------------------------------------
Key: HV-184
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-184
Project: Hibernate Validator
Issue Type: Bug
Components: engine, validators
Affects Versions: 4.0.0.Beta1
Environment: N/A
Reporter: Daniel Yokomizo
Priority: Blocker
Attachments: JavaxValidationBugsTest.java
As I was developing a MessageInterpolator to provide additional interpolation capabilities I discovered that ResourceBundlerMessageInterpolator fails to preserve unknown message parameters (i.e. if the message parameter is not a key in any of the resource bundles and isn't an annotation attribute). Actually the spec is silent about this situation but I don't think the current behavior is intended.
Additionally I discovered that ResourceBundlerMessageInterpolator also doesn't treat escaped curly braces as literals and it doesn't properly escape before calling java.util.regex.Matcher.appendReplacement(StringBuffer,String) and fails if the dollar sign (i.e. $) appears in certain places of the message.
There's a JUnit 4 test case attached that shows the three symptoms and fails all tests (but it should pass for a correct implementation).
--
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
15 years, 6 months
[Hibernate-JIRA] Created: (HHH-4046) <many-to-one../> with property-ref fails to bring lazily
by radhakrishna (JIRA)
<many-to-one../> with property-ref fails to bring lazily
--------------------------------------------------------
Key: HHH-4046
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4046
Project: Hibernate Core
Issue Type: Sub-task
Components: core
Affects Versions: 3.3.2
Reporter: radhakrishna
Priority: Critical
There are issues with using <one-to-one../> where it does not bring the entities lazily for its own reason.
But <many-to-one../> using property-ref is also getting eagerly loaded.
I tried both the mappings in the child mapping file,
<many-to-one name="parent" column="parent_ID" property-ref="someDummyParentId"
unique="true" class="ParentObj" />
<many-to-one name="parent" column="parent_ID" unique="true"
class="Parent" property-ref="someDummyParentID" lazy="proxy"
cascade="none" insert="false" update="false">
</many-to-one>
where I mentioned the someDummyParentID to the SAME PK of the parent, and it eagerly fetches
in the parent mapping file
<property name="dummyEcDisplaySettingId" column="parent_ID"
insert="false" update="false"></property>
If i mention the same <many-to-one as
<many-to-one name="parent" column="parent_ID"
unique="true" class="Parent" />
where parent_ID is the FK in the child table and obviously it joins with the PK of the Parent table, it works fine and brings the parent lazily by default, it is lazy="proxy"
--
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
15 years, 6 months
[Hibernate-JIRA] Commented: (HHH-1435) many-to-one lazy seems to be broken in 3.1.x
by radhakrishna (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1435?page=c... ]
radhakrishna commented on HHH-1435:
-----------------------------------
What is going on? I cannot get the <many-to-one to load lazily when I use property-ref with Hibernate-Version: 3.2.4.sp1?
"
Daniel Serodio added a comment - 20/Feb/06 12:46 PM
Besides the bug itself, I find the fact that the assertion was commented out a little preocupating. What is the purpose of the regression tests, if one comments out the a that shows that a bug has been introduced?
I've always considered the Hibernate QA process to be very trustworthy and thorough, but now I'm beginning to wonder if this is still true." :)
SOS
Krishna
> many-to-one lazy seems to be broken in 3.1.x
> --------------------------------------------
>
> Key: HHH-1435
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1435
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1.2
> Reporter: Frank Grimes
> Assignee: Steve Ebersole
> Priority: Critical
> Fix For: 3.2.0.alpha2, 3.1.3
>
>
> When trying to upgrade from hibernate-3.0.5 to hibernate-3.1.1, my many-to-one lazy associations stopped working. (they're being fetched right away)
> I noticed that the test for that functionality in org.hibernate.test.instrument.InstrumentTest was commented out at some point during 3.1 development.
> If I uncomment the assertion for the lazy loading of the many-to-one association, the test fails.
> The line in question is the following (line 160):
> //assertFalse(Hibernate.isPropertyInitialized(doc, "owner"));
> If this is/was a known issue, I didn't find any mention of it in either the forums or JIRA.
> It seems that both lazy="no-proxy" and lazy="proxy" fail on that test. (I tried modifying the mapping to see if maybe lazy="proxy" could be a possible migration path from the old lazy="true")
> Are there any plans to fix many-to-one lazy associations?
> FYI, I originally brought this issue up on the forums last week with no reply, hence the creation of this JIRA issue:
> http://forum.hibernate.org/viewtopic.php?t=954713
> Thanks.
--
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
15 years, 6 months
[Hibernate-JIRA] Created: (ANN-851) Unable to run tests under JDK 5 - JAXB missing
by Emmanuel Bernard (JIRA)
Unable to run tests under JDK 5 - JAXB missing
----------------------------------------------
Key: ANN-851
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-851
Project: Hibernate Annotations
Issue Type: Bug
Reporter: Emmanuel Bernard
Assignee: Hardy Ferentschik
Priority: Critical
Fix For: 3.5
Because Hibernate Annotations depends optionally on Bean Validation, we cannot run tests under JDK 5
Can you apply your magic and make sure that:
- in JDK 5, jaxb API + an impl is added as dependencies
- in JDK 6 it does nto blow up either
Exception:
org.hibernate.HibernateException: Unable to get the default Bean Validation factory
at org.hibernate.cfg.beanvalidation.BeanValidationActivator.activateBeanValidation(BeanValidationActivator.java:69)
at org.hibernate.cfg.AnnotationConfiguration.enableBeanValidation(AnnotationConfiguration.java:887)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:810)
at org.hibernate.test.annotations.TestCase.buildSessionFactory(TestCase.java:82)
at org.hibernate.test.annotations.TestCase.setUp(TestCase.java:94)
at junit.framework.TestCase.runBare(TestCase.java:125)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.textui.TestRunner.doRun(TestRunner.java:116)
at com.intellij.rt.execution.junit.IdeaTestRunner.doRun(IdeaTestRunner.java:94)
at junit.textui.TestRunner.doRun(TestRunner.java:109)
at com.intellij.rt.execution.junit.IdeaTestRunner.startRunnerWithArgs(IdeaTestRunner.java:22)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:118)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.hibernate.cfg.beanvalidation.BeanValidationActivator.activateBeanValidation(BeanValidationActivator.java:60)
... 17 more
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at org.hibernate.validation.engine.ConfigurationImpl.parseValidationXml(ConfigurationImpl.java:187)
at org.hibernate.validation.engine.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:116)
at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:109)
at org.hibernate.cfg.beanvalidation.TypeSafeActivator.getValidatorFactory(TypeSafeActivator.java:299)
at org.hibernate.cfg.beanvalidation.TypeSafeActivator.activateBeanValidation(TypeSafeActivator.java:50)
... 22 more
org.hibernate.HibernateException: Unable to get the default Bean Validation factory
at org.hibernate.cfg.beanvalidation.BeanValidationActivator.activateBeanValidation(BeanValidationActivator.java:69)
at org.hibernate.cfg.AnnotationConfiguration.enableBeanValidation(AnnotationConfiguration.java:887)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:810)
at org.hibernate.test.annotations.TestCase.buildSessionFactory(TestCase.java:82)
at org.hibernate.test.annotations.TestCase.setUp(TestCase.java:94)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.hibernate.cfg.beanvalidation.BeanValidationActivator.activateBeanValidation(BeanValidationActivator.java:60)
... 17 more
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at org.hibernate.validation.engine.ConfigurationImpl.parseValidationXml(ConfigurationImpl.java:187)
at org.hibernate.validation.engine.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:116)
at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:109)
at org.hibernate.cfg.beanvalidation.TypeSafeActivator.getValidatorFactory(TypeSafeActivator.java:299)
at org.hibernate.cfg.beanvalidation.TypeSafeActivator.activateBeanValidation(TypeSafeActivator.java:50)
... 22 more
--
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
15 years, 6 months