[Hibernate-JIRA] Created: (HHH-2472) Error in HSQLDB Sequence Syntax
by Aaron Mulder (JIRA)
Error in HSQLDB Sequence Syntax
-------------------------------
Key: HHH-2472
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2472
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.2
Reporter: Aaron Mulder
I am using Hibernate via JPA. My persistence.xml has this:
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="hibernate.dialect"
value="org.hibernate.dialect.HSQLDialect"/>
</properties>
My Entity has this:
@SequenceGenerator(name = "GeneratePCSequence", sequenceName = "GEN_PC_SEQUENCE")
...
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "GeneratePCSequence")
private int id;
My DDL has this:
create sequence GEN_PC_SEQUENCE start with 100000 increment by 1;
The result I get when creating a new entity of this type is this:
java.sql.SQLException: Table not found in statement [select next value for GEN_PC_SEQUENCE from dual_GEN_PC_SEQUENCE]
org.hsqldb.jdbc.Util.throwError(Unknown Source)
org.hsqldb.jdbc.jdbcPreparedStatement.<init>(Unknown Source)
org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source)
org.apache.commons.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:185)
org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareStatement(PoolingDataSource.java:278)
org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:497)
org.hibernate.jdbc.AbstractBatcher.prepareSelectStatement(AbstractBatcher.java:123)
org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:73)
org.hibernate.id.SequenceHiLoGenerator.generate(SequenceHiLoGenerator.java:58)
org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:99)
org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:212)
The "from dual_GEN_PC_SEQUENCE" looks sketchy to me, but I'm not real sure.
--
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, 11 months
[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
16 years, 11 months
[Hibernate-JIRA] Created: (HHH-2122) optimization patch based on pmd rules
by Xavier Le Vourch (JIRA)
optimization patch based on pmd rules
-------------------------------------
Key: HHH-2122
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2122
Project: Hibernate3
Type: Patch
Environment: latest svn source
Reporter: Xavier Le Vourch
Priority: Minor
Attachments: Optimizations.patch
I've run pmd with a custom ruleset and made a few optimization changes:
Double.valueOf(x).doubleValue() -> Double.parseDouble(x)
append("x") -> append('x')
x != null && x instanceof X -> x instanceof X
list.toArray uses correctly sized array as argument
new String(str) -> str
if (expr == false) -> if (!expr)
append(s1 + s2) -> append(s1).append(s2)
loop over array to add to list -> list.addAll(Arrays.asList(<array>))
extra ; removed
name.toLowerCase().equals("rowid") -> name.equalsIgnoreCase("rowid")
use of System.arraycopy instead of loop
I could break the patch in several parts if that makes it easier to analyze.
Xavier
--
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, 11 months
[Hibernate-JIRA] Created: (ANN-526) Property xyz has an unbound type - is that so?
by Sebastian Kirsch (JIRA)
Property xyz has an unbound type - is that so?
----------------------------------------------
Key: ANN-526
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-526
Project: Hibernate Annotations
Type: Bug
Versions: 3.2.1
Reporter: Sebastian Kirsch
Priority: Minor
Attachments: Hibernate ANN-526.zip
I get this "Property reference has an unbound type and no explictit target entity" exception and I think this is not exactly true. I'm not sure if this is a bug or a feature requests though.
Have a look at the attached files and read on.
I guess the model ist pretty easy to understand. The AbstractGeneric allows my to have concrete entities referring to specifc other subclasses - as seen in ConcreteOther and ConcreteSelf. The test case "workingClasses" shows us that Hibernate may work with this model - note that the class AbstractGeneric itslef was NOT added to the configuration.
Now for the problem: The class OtherEntity is a completly different entity, but it refers to instances of AbstractGeneric - to any subclass of it actually, as AbstractGeneric is obviously abstract.
If you run the test case "otherClass" the first part states that Hibernate doesn't know AbstractGeneric - which is fine, so I add that class to the configuration and try to build a session factory again. Now we receive the beforementioned exception.
That's the situation. So is AbstractGeneric really an unbound type? I'd say it is not - T has an upper bound which should be good enough to work with - we know the table and the PK...
--
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, 11 months
[Hibernate-JIRA] Created: (ANN-480) Query by Example in annotation form
by M N G (JIRA)
Query by Example in annotation form
-----------------------------------
Key: ANN-480
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-480
Project: Hibernate Annotations
Type: New Feature
Environment: jdk >= 1.5, hibernate >= 3, ant > 1.5
Reporter: M N G
Priority: Minor
Attachments: searchable.tar.gz
Interested in adsorbing this framework I built?
Takes all the work out of creating a Criteria. Similar to how Query by Example, this small framework I wrote builds Criteria from annotated pojos.
A pojo is annotated to map hibernate bean mappings to methods. The annotated pojo's class is registered in the Registry, which uses reflecting to define the signatures to create the Criteria for the pojo. The values to search for are set in the pojo and the pojo is passed to the Builder. The Builder uses the registry to create the Criteria delimited by the values in the annotated pojo.
Not entirely mature yet (does not support all Criteria Restrictions) and the handling of sorting results is a bit unwieldy. It works tho.
Attached is a copy of the framework. It includes a unit test that kick starts a HSQL database to demostrate the framework.
--
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, 11 months