[Hibernate-JIRA] Created: (HHH-1988) Repeated column chack fails with SingleTable inheritance, biut not with TablePerClass
by Sergey Vladimirov (JIRA)
Repeated column chack fails with SingleTable inheritance, biut not with TablePerClass
-------------------------------------------------------------------------------------
Key: HHH-1988
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1988
Project: Hibernate3
Type: Bug
Components: metamodel
Versions: 3.2.0.cr3
Environment: HA last from SVN, HEM last from SVN, MySQL
Reporter: Sergey Vladimirov
Not sure about component.
Parent class introduce field, which is also discriminator field.
Hibernate reports error in child class if and only if strategy = InheritanceType.SINGLE_TABLE
org.hibernate.MappingException: Repeated column in mapping for entity: ru.arptek.arpsite.data.discriminator.IntegerSingleChild column: type (should be mapped with insert="false" update="false")
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:590)
at org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(PersistentClass.java:612)
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:630)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:405)
at org.hibernate.mapping.SingleTableSubclass.validate(SingleTableSubclass.java:43)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1026)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1211)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:631)
at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:760)
at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:627)
at ru.arptek.arpsite.data.AbstractHibernateJUnitTest.setUp(AbstractHibernateJUnitTest.java:89)
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 org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Test cas works with strategy = InheritanceType.TABLE_PER_CLASS
--
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: (HHH-2733) .executeUpdate() Wrong SQL translation
by Giuseppe Manara (JIRA)
.executeUpdate() Wrong SQL translation
---------------------------------------
Key: HHH-2733
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2733
Project: Hibernate3
Issue Type: Bug
Components: core
Environment: hibernate3
Reporter: Giuseppe Manara
I set :
Query myQuery = mySession.createQuery("update antiric.elaborazioni.model.ArcuniA aa set aa.aunCanDes = (select distinct can.canDes from antiric.tabelle.model.TabCan can, antiric.tabelle.model.TabCsi csi where can.idCanCsi=csi.id and can.canCod=aa.aunTcan and csi.csiCod=aa.aunTcsi) where aa.aunCanDes is null and aa.aunTipSta=1");
...
When I do :
myQuery.executeUpdate();
I get
org.hibernate.exception.SQLGrammarException: could not execute update query
org.postgresql.util.PSQLException: ERROR: column reference "id" is ambiguous !!!!!!
the sql property of the SQLGrammarException is:
"update ARCUNIA set aunCanDes=(select distinct tabcan1_.canDes from TABCAN tabcan1_, TABCSI tabcsi2_ where idCanCsi=id and canCod=aunTcan and csiCod=aunTcsi) where (aunCanDes is null) and aunTipSta=?"
... as you can see,
my original " .. can.idCanCsi=csi.id .." is converted into ".. idCanCsi=id .." and that's why the error
P.S.:
nothing to do with the JOIN .. ON clause ; it seems not supported from .createQuery("..")
best reguards,
giuseppe
--
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-1365) NPE AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:372) when trying to load a class defined in a signed/sealed JAR
by Nicole Buss (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1365?page=c... ]
Nicole Buss commented on HHH-1365:
----------------------------------
cglib-2.2_beta1.jar fixed the problem for my application.
http://sourceforge.net/project/showfiles.php?group_id=56933&package_id=98...
> NPE AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:372) when trying to load a class defined in a signed/sealed JAR
> ----------------------------------------------------------------------------------------------------------------------------------
>
> Key: HHH-1365
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1365
> Project: Hibernate3
> Issue Type: Bug
> Affects Versions: 3.1
> Environment: Java1.5.06 Ant1.7alpha, hibernate 3.1
> Reporter: Steve Loughran
> Priority: Minor
> Attachments: cglib-src-2.1_3.patch, hibernate-hack.jar
>
>
> I'm testing what happens to hibernate when running against a signed JAR. The answer is: most tests pass. What fails is this test (Apache 2.0 license, BTW)
> public void testDetachedObject() throws Exception {
> Event event = createTestEvent();
> session.save(event);
> session.flush();
> closeSession();
> //here the event is detached.
> //we change it outside an operation.
> String text = "modified";
> event.setText(text);
> session = getSessionFactory().openSession();
> Event merged=(Event) session.merge(event);
> assertEquals(event, merged);
> session.flush();
> closeSession();
> session = getSessionFactory().openSession();
> Event loaded = (Event) session.load(Event.class, event.getKey());
> assertEquals(text, loaded.getText());
> assertEquals(event, loaded);
> }
> the session.load operation is failing, with the short stack trace of:
> java.lang.NullPointerException
> at org.hibernate.tuple.AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:372)
> at org.hibernate.persister.entity.AbstractEntityPersister.createProxy(AbstractEntityPersister.java:3121)
> at org.hibernate.event.def.DefaultLoadEventListener.createProxyIfNecessary(DefaultLoadEventListener.java:232)
> at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:173)
> at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
> at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:869)
> at org.hibernate.impl.SessionImpl.load(SessionImpl.java:788)
> at org.hibernate.impl.SessionImpl.load(SessionImpl.java:781)
> at d1.persist.test.SessionTest.testDetachedObject(SessionTest.java:155)
> The root cause is probably contained in the info that gets printed when the session starts up, complaining that things cant be added to sealed classes
> [junit] 2261 ERROR org.hibernate.proxy.BasicLazyInitializer - CGLIB Enhancement failed: d1.persist.Event
> [junit] net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
> [junit] at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237)
> [junit] at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
> [junit] at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
> [junit] at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:126)
> [junit] at org.hibernate.proxy.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:41)
> [junit] at org.hibernate.tuple.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:161)
> [junit] at org.hibernate.tuple.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:131)
> [junit] at org.hibernate.tuple.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
> [junit] at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:64)
> [junit] at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:257)
> [junit] at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:412)
> [junit] at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:108)
> [junit] at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
> [junit] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:215)
> [junit] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1154)
> [junit] at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:375)
> [junit] at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:533)
> [junit] at org.hibernate.ejb.Ejb3Configuration.createFactory(Ejb3Configuration.java:109)
> [junit] at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:155)
> [junit] at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:82)
> [junit] at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37)
> [junit] at d1.persist.PersistTools.createManagerFactory(PersistTools.java:82)
> [junit] at d1.persist.PersistTools.createDefaultManagerFactory(PersistTools.java:76)
> [junit] at d1.persist.test.Ejb3TestBase.setUp(Ejb3TestBase.java:27)
> [junit] at junit.framework.TestCase.runBare(TestCase.java:125)
> [junit] at junit.framework.TestResult$1.protect(TestResult.java:106)
> [junit] at junit.framework.TestResult.runProtected(TestResult.java:124)
> [junit] at junit.framework.TestResult.run(TestResult.java:109)
> [junit] at junit.framework.TestCase.run(TestCase.java:118)
> [junit] at junit.framework.TestSuite.runTest(TestSuite.java:208)
> [junit] at junit.framework.TestSuite.run(TestSuite.java:203)
> [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:328)
> [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:736)
> [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:605)
> [junit] Caused by: java.lang.reflect.InvocationTargetException
> [junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [junit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> [junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> [junit] at java.lang.reflect.Method.invoke(Method.java:585)
> [junit] at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384)
> [junit] at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219)
> [junit] ... 33 more
> [junit] Caused by: java.lang.SecurityException: class "d1.persist.Event$$EnhancerByCGLIB$$55c8eae8_2"'s signer information does not match signer information of other classes in the same package
> [junit] at java.lang.ClassLoader.checkCerts(ClassLoader.java:775)
> [junit] at java.lang.ClassLoader.preDefineClass(ClassLoader.java:487)
> [junit] at java.lang.ClassLoader.defineClass(ClassLoader.java:614)
> [junit] ... 39 more
> [junit] 2262 WARN org.hibernate.tuple.PojoEntityTuplizer - could not create proxy factory for:d1.persist.Event
> [junit] org.hibernate.HibernateException: CGLIB Enhancement failed: d1.persist.Event
> [junit] at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:132)
> [junit] at org.hibernate.proxy.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:41)
> [junit] at org.hibernate.tuple.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:161)
> [junit] at org.hibernate.tuple.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:131)
> [junit] at org.hibernate.tuple.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
> [junit] at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:64)
> [junit] at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:257)
> [junit] at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:412)
> [junit] at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:108)
> [junit] at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
> [junit] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:215)
> [junit] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1154)
> [junit] at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:375)
> [junit] at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:533)
> [junit] at org.hibernate.ejb.Ejb3Configuration.createFactory(Ejb3Configuration.java:109)
> [junit] at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:155)
> [junit] at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:82)
> [junit] at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37)
> [junit] at d1.persist.PersistTools.createManagerFactory(PersistTools.java:82)
> [junit] at d1.persist.PersistTools.createDefaultManagerFactory(PersistTools.java:76)
> [junit] at d1.persist.test.Ejb3TestBase.setUp(Ejb3TestBase.java:27)
> [junit] at junit.framework.TestCase.runBare(TestCase.java:125)
> [junit] at junit.framework.TestResult$1.protect(TestResult.java:106)
> [junit] at junit.framework.TestResult.runProtected(TestResult.java:124)
> [junit] at junit.framework.TestResult.run(TestResult.java:109)
> [junit] at junit.framework.TestCase.run(TestCase.java:118)
> [junit] at junit.framework.TestSuite.runTest(TestSuite.java:208)
> [junit] at junit.framework.TestSuite.run(TestSuite.java:203)
> [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:328)
> [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:736)
> [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:605)
> [junit] Caused by: net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
> [junit] at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237)
> [junit] at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
> [junit] at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
> [junit] at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:126)
> [junit] ... 30 more
> [junit] Caused by: java.lang.reflect.InvocationTargetException
> [junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [junit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> [junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> [junit] at java.lang.reflect.Method.invoke(Method.java:585)
> [junit] at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384)
> [junit] at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219)
> [junit] ... 33 more
> [junit] Caused by: java.lang.SecurityException: class "d1.persist.Event$$EnhancerByCGLIB$$55c8eae8_2"'s signer information does not match signer information of other classes in the same package
> [junit] at java.lang.ClassLoader.checkCerts(ClassLoader.java:775)
> [junit] at java.lang.ClassLoader.preDefineClass(ClassLoader.java:487)
> [junit] at java.lang.ClassLoader.defineClass(ClassLoader.java:614)
> [junit] ... 39 more
> No doubt there is some way to configure hibernate to create proxies in a different package, and I shall seek that option out. All I want to note here is that NPEs are not the best way to report failure.
--
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: (HHH-2714) Three typos in code examples
by Jan Hustak (JIRA)
Three typos in code examples
----------------------------
Key: HHH-2714
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2714
Project: Hibernate3
Issue Type: Bug
Components: documentation
Affects Versions: 3.2.4.sp1
Reporter: Jan Hustak
Priority: Trivial
Attachments: hibernate-docs.patch
I have found a few apparent typos in code examples in the documentation:
- in section 6.3.2. "Bidirectional associations":
<class name="Item">
<id name="id" column="CATEGORY_ID"/>
should probably be
<class name="Item">
<id name="id" column="ITEM_ID"/>
- in section 10.4.1.2 "Queries that return tuples":
Object[] tuple = (Object[]) kittensAndMothers.next();
Cat kitten = tuple[0];
Cat mother = tuple[1];
should probably be
Object[] tuple = (Object[]) kittensAndMothers.next();
Cat kitten = (Cat) tuple[0];
Cat mother = (Cat) tuple[1];
- in section 11.3.2 "Application version checking":
if ( oldVersion!=foo.getVersion ) throw new StaleObjectStateException();
should probably be
if ( oldVersion != foo.getVersion() ) throw new StaleObjectStateException();
I've attached a patch that takes care of these; it was done against CVS earlier today.
--
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-635) Hib doesn't share allocated sequence values between different classes
by Adam Wozniak (JIRA)
Hib doesn't share allocated sequence values between different classes
---------------------------------------------------------------------
Key: ANN-635
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-635
Project: Hibernate Annotations
Issue Type: Improvement
Affects Versions: 3.3.0.ga
Reporter: Adam Wozniak
Attachments: Zbbb.java, Zccc.java
Hello Everybody
This is my first issue here, so I don't know if my issue will be classified as a bug or an improvement only.
My config:
hibernate-3.2.4.sp1
hibernate-annotations-3.3.0.GA
hibernate-entitymanager-3.3.1.GA
I use Oracle database. I have 2 entity classes (Zbbb and Zccc).
Those 2 classes map two database table: ZBBB and ZCCC.
Both tables have identical structure:
ID - NUMBER (primary key)
TEXT - VARCHAR2(10)
Identifiers for both tables are generated by _ONE_ (the same) Oracle sequence.
For both entities I have following annotations:
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "my_generator")
@javax.persistence.SequenceGenerator(
name = "my_generator"
, sequenceName = "SEQ_DEPT"
, allocationSize=2)
Note, that allocationSize is set: 2.
When I am creating and persisting 2 Zbbb and 2 Zccc entities like this:
{ Zccc entity = new Zccc(); em.persist(entity); } // DB HIT!
{ Zccc entity = new Zccc(); em.persist(entity); }
{ Zbbb entity = new Zbbb(); em.persist(entity); } // DB HIT!
{ Zbbb entity = new Zbbb(); em.persist(entity); }
... everything is OK because I have 2 hits to database sequence only.
But when I am creating and persisting 1 Zbbb and 3 Zccc entities like this:
{ Zbbb entity = new Zbbb(); em.persist(entity); }
{ Zccc entity = new Zccc(); em.persist(entity); }
{ Zccc entity = new Zccc(); em.persist(entity); }
{ Zccc entity = new Zccc(); em.persist(entity); }
... I have 3 hits do database sequence.
I would expect, that Hibernate should recognize that Zbbb and Zccc are suing the same database sequence and should share all cached values between entities of those two classes.
Do I do something wrong?
Kind regards,
Adam Wozniak
--
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