[Hibernate-JIRA] Created: (EJB-307) Unable to create the table for a class extending a 2 tables mapped abstract class
by Brice LEPORINI (JIRA)
Unable to create the table for a class extending a 2 tables mapped abstract class
----------------------------------------------------------------------------------
Key: EJB-307
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-307
Project: Hibernate Entity Manager
Issue Type: Bug
Components: EntityManager
Affects Versions: 3.2.1
Environment: JBoss 4.2.0 GA, WinXP SP2, Only using javax.persistence annotations
Reporter: Brice LEPORINI
persistence.xml:
<properties>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.show_sql" value="true" />
</properties>
One main abstract class mapped on 2 tables:
@Entity
@Table(name="T_CRI")
@SecondaryTable(name="T_CRI_FT",
pkJoinColumns=@PrimaryKeyJoinColumn(name="PK_IDCRI", referencedColumnName="PK_IDCRI"))
@Inheritance(strategy=InheritanceType.JOINED)
public abstract class CriFt implements Cri,Identified {
[.......]
}
Deployment with schema export works fine...
Now let's create a new class extending this one:
@Entity
@Table(name="T_CRI_FT_MAINTENANCE")
public class CriFtMaintenance extends CriFt implements Serializable, Identified, Cri {
[......]
}
Now deployment throws an exception:
09:41:23,359 INFO [SessionFactoryImpl] building session factory
09:41:23,437 ERROR [AssertionFailure] an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
org.hibernate.AssertionFailure: Table T_CRI_FT not found
If Inheritance strategy is anything else than JOINED, there is no problem.
Feel free to contact me in order to get more informations about environment.
--
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, 1 month
[Hibernate-JIRA] Created: (HHH-2712) OneToOne mapping with PrimaryKeyJoinColumn and CascadeType.ALL throws IdentifierGenerationException
by Colin Smith (JIRA)
OneToOne mapping with PrimaryKeyJoinColumn and CascadeType.ALL throws IdentifierGenerationException
---------------------------------------------------------------------------------------------------
Key: HHH-2712
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2712
Project: Hibernate3
Issue Type: Bug
Environment: Hibernate 3.2.4, Annotations 3.3.0
Reporter: Colin Smith
Customer has a 1-1 mapping with CustomerRiskProfile.
@Id
@GeneratedValue(strategy = GenerationType.TABLE, generator = "SEQUENTIAL_HILO_GENERATOR")
private Long id;
@OneToOne(cascade = CascadeType.ALL)
@PrimaryKeyJoinColumn
private CustomerRiskProfile customerRiskProfile;
CustomerRiskProfile has:
@Id
private Long id;
@OneToOne(mappedBy = "customerRiskProfile")
private Customer customer;
If I create a new Customer and a new CustomerRiskProfile, associate the two, then call session.save(customer), I get:
org.springframework.orm.hibernate3.HibernateSystemException: ids for this class must be manually assigned before calling save(): com.cantorcfds.domain.CustomerRiskProfile; nested exception is org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): com.cantorcfds.domain.CustomerRiskProfile
Caused by: org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): com.cantorcfds.domain.CustomerRiskProfile
at org.hibernate.id.Assigned.generate(Assigned.java:33)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:99)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:94)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499)
at org.hibernate.engine.CascadingAction$1.cascade(CascadingAction.java:218)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
at org.hibernate.event.def.AbstractSaveEventListener.cascadeAfterSave(AbstractSaveEventListener.java:456)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:334)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:121)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:94)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:495)
at org.springframework.orm.hibernate3.HibernateTemplate$16.doInHibernate(HibernateTemplate.java:689)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
at org.springframework.orm.hibernate3.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:686)
at com.cantorcfds.dao.HibernateCustomerDao.save(HibernateCustomerDao.java:36)
at com.cantorcfds.domain.TestSchemaLoad.testDataLoad(TestSchemaLoad.java:33)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
I would expect Hibernate to generate the Id for the Customer AND the CustomerRiskProfile before trying to save anything?
--
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, 1 month
[Hibernate-JIRA] Created: (HBX-733) Updated DAO code generation as discussed over the email
by Alex Kalinovsky (JIRA)
Updated DAO code generation as discussed over the email
-------------------------------------------------------
Key: HBX-733
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-733
Project: Hibernate Tools
Type: Patch
Components: hbm2java, ant
Versions: 3.1alpha5
Environment: I have tested the patch on the latest version of Hibernate Tools I got from SVN 2 weeks ago.
Reporter: Alex Kalinovsky
Attachments: dao_generation.patch
This should be a complete implementation of DAO generation according to the design we have discussed over the email. I've tested this on our project so the DAOs should be good to go, but of course a more diverse testing would be needed before releasing it to public. I'm open for recommendations and suggestions, so I see this as the first draft. Below is a list of files and comments. Contact me at kalinovsky(a)yahoo.com.
src/java/org/hibernate/tool/hbm2x
DAONewExporter.java This class is coded mainly to accept additional parameters such as dao package name and provide flexible
file naming that is used by Ant task. It would not be needed if I integrate my changes into GenericExporter.
src/templates/dao
crudDao.ftl template for regeneratable CRUD interface
crudDaoImpl.ftl template for regeneratable CRUD DAO implementation
dao.ftl template for customizable DAO interface that extends CRUD interface
daoImpl.ftl template for customizable DAO implementation that extends CRUD implementation
src/templates/dao/base
dao.ftl base interface for all DAOs
queryDao.ftl base interface for all read-only entities
crudDao.ftl base interface for all editable entities
src/templates/dao/base/hibernate
abstractDao.ftl base implementation of DAO using Hibernate
abstractQueryDao.ftl base implementation of DAO for read-only entities using Hibernate
abstractCrudDao.ftl base implementation of DAO for editable entities using Hibernate
src/testsupport
codegen.properties Test configuration to see DAO generation in action
codegen-build.xml Test build file that generates DAOs for Author and Article and compiles generated code
--
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, 1 month
[Hibernate-JIRA] Created: (HHH-2799) Default Scale value doesn't right
by Bliznets Roman (JIRA)
Default Scale value doesn't right
---------------------------------
Key: HHH-2799
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2799
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.0.ga
Environment: Name and version of the database you are using:MySQL 5.0.37
Reporter: Bliznets Roman
In my Mapping documents:
...
<property name="goodsNumeric" lazy="false" insert="true" update="true" not-null="false" unique="false" type="java.math.BigInteger">
<column not-null="false" unique="false" name="`goodsnumeric`" precision="5"/>
</property>
...
>From MySQL documentation
In standard SQL, the syntax DECIMAL(M) is equivalent to DECIMAL(M,0).
But In log and in database scale=2, it's have to be exactly 0.
Debug level Hibernate log excerpt:
12484 [main] DEBUG org.hibernate.tool.hbm2ddl.SchemaUpdate - create table `goodsitembasetype` (e_id bigint not null auto_increment, e_version integer not null, `goodsnumeric` numeric(5,2), `grossweightquantity` numeric(19,6), `netweightquantity` numeric(19,6), `invoicedcost` numeric(16,2), `customscost` numeric(16,2), `statisticalcost` numeric(16,2), primary key (e_id))
--
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, 2 months
[Hibernate-JIRA] Created: (HHH-2444) discriminator type="integer" blows up
by Mark Grand (JIRA)
discriminator type="integer" blows up
-------------------------------------
Key: HHH-2444
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2444
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.2
Environment: Hibernate 3.2.2, Postgresql 8.2
Reporter: Mark Grand
Attachments: z.cfg.xml, z.hbm.xml
If the type of discriminator is integer, SessionFactoryImpl.<init> blows up with
org.hibernate.MappingException: Could not format discriminator value to SQL string
...
Caused by: java.lang.NumberFormatException: For input string: "com.hytaps.dataDictionary.FieldDescription"
Here is the full log:
[main] INFO com.hytaps.main.Z - Entering main method.
[main] INFO com.hytaps.recordManager.HibernateSessionFactory - Creating hibernate session factory.
[main] INFO org.hibernate.cfg.Environment - Hibernate 3.2.2
[main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
[main] INFO org.hibernate.cfg.Environment - Bytecode provider name : cglib
[main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
[main] INFO org.hibernate.cfg.Configuration - configuring from resource: /z.cfg.xml
[main] INFO org.hibernate.cfg.Configuration - Configuration resource: /z.cfg.xml
[main] INFO org.hibernate.cfg.Configuration - Reading mappings from resource : com/hytaps/dataDictionary/z.hbm.xml
[main] INFO org.hibernate.cfg.HbmBinder - Mapping class: com.hytaps.dataDictionary.FieldDescription -> field_description
[main] INFO org.hibernate.cfg.HbmBinder - Mapping subclass: com.hytaps.dataDictionary.TimeFieldDescription -> field_description
[main] INFO org.hibernate.cfg.HbmBinder - Mapping class join: com.hytaps.dataDictionary.TimeFieldDescription -> time_field_description
[main] INFO org.hibernate.cfg.HbmBinder - Mapping subclass: com.hytaps.dataDictionary.ColorFieldDescription -> field_description
[main] INFO org.hibernate.cfg.HbmBinder - Mapping class join: com.hytaps.dataDictionary.ColorFieldDescription -> color_field_description
[main] INFO org.hibernate.cfg.Configuration - Configured SessionFactory: null
[main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)
[main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Hibernate connection pool size: 20
[main] INFO org.hibernate.connection.DriverManagerConnectionProvider - autocommit mode: false
[main] INFO org.hibernate.connection.DriverManagerConnectionProvider - using driver: org.postgresql.Driver at URL: jdbc:postgresql://127.0.0.1:5432/hytaps_db
[main] INFO org.hibernate.connection.DriverManagerConnectionProvider - connection properties: {user=hytaps, password=****}
[main] INFO org.hibernate.cfg.SettingsFactory - RDBMS: PostgreSQL, version: 8.2.0
[main] INFO org.hibernate.cfg.SettingsFactory - JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 8.2 JDBC3 with SSL (build 504)
[main] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.PostgreSQLDialect
[main] INFO org.hibernate.transaction.TransactionFactoryFactory - Using default transaction strategy (direct JDBC transactions)
[main] INFO org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
[main] INFO org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled
[main] INFO org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled
[main] INFO org.hibernate.cfg.SettingsFactory - JDBC batch size: 15
[main] INFO org.hibernate.cfg.SettingsFactory - JDBC batch updates for versioned data: disabled
[main] INFO org.hibernate.cfg.SettingsFactory - Scrollable result sets: enabled
[main] INFO org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): disabled
[main] INFO org.hibernate.cfg.SettingsFactory - Connection release mode: auto
[main] INFO org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1
[main] INFO org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled
[main] INFO org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled
[main] INFO org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
[main] INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory
[main] INFO org.hibernate.cfg.SettingsFactory - Query language substitutions: {}
[main] INFO org.hibernate.cfg.SettingsFactory - JPA-QL strict compliance: disabled
[main] INFO org.hibernate.cfg.SettingsFactory - Second-level cache: enabled
[main] INFO org.hibernate.cfg.SettingsFactory - Query cache: disabled
[main] INFO org.hibernate.cfg.SettingsFactory - Cache provider: org.hibernate.cache.NoCacheProvider
[main] INFO org.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: disabled
[main] INFO org.hibernate.cfg.SettingsFactory - Structured second-level cache entries: disabled
[main] INFO org.hibernate.cfg.SettingsFactory - Statistics: disabled
[main] INFO org.hibernate.cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled
[main] INFO org.hibernate.cfg.SettingsFactory - Default entity-mode: pojo
[main] INFO org.hibernate.cfg.SettingsFactory - Named query checking : enabled
[main] INFO org.hibernate.impl.SessionFactoryImpl - building session factory
[main] FATAL com.hytaps.main.Z - An exception is being thrown out of HytapsInstaller.main()
org.hibernate.MappingException: Could not format discriminator value to SQL string
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:307)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
at com.hytaps.recordManager.HibernateSessionFactory.rebuildSessionFactory(HibernateSessionFactory.java:81)
at com.hytaps.recordManager.HibernateSessionFactory.createSession(HibernateSessionFactory.java:61)
at com.hytaps.main.Z.main(Z.java:49)
Caused by: java.lang.NumberFormatException: For input string: "com.hytaps.dataDictionary.FieldDescription"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.<init>(Unknown Source)
at org.hibernate.type.IntegerType.stringToObject(IntegerType.java:55)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:300)
... 6 more
[main] INFO com.hytaps.main.Z - Exiting main method
--
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, 2 months
[Hibernate-JIRA] Created: (HHH-2432) Collection Mapping via "property-ref" on non-pk-column crashes
by Stefan Krinkel (JIRA)
Collection Mapping via "property-ref" on non-pk-column crashes
--------------------------------------------------------------
Key: HHH-2432
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2432
Project: Hibernate3
Type: Bug
Components: core
Environment: 3.2.2, Sybase DB
Reporter: Stefan Krinkel
Hi,
when using the following example, Hibernate attempts to pull a "getTownId()" on an Integer!
2 Tables, Village and Councillor. Village has a comp. ID (TownId, VillageId), Councillor uses
just the TownId-Part. To accomplish that, TOWN_ID is mapped twice (first in comp.key, second
as "townCode"), to be able to do a 'property-ref'.
When doing an ordinary "village.getCouncillors()" there's an IllegalArgumentException which
roots to BasicPropertyAccessor.java:145
public Object get(Object target) throws HibernateException {
try {
return method.invoke(target, null);
}
Here target is (Integer) townId and method is "VillageId.getTownId".
<id name="id" type="integer">
<column name="COUNCILLOR_ID" />
<generator class="identity"/>
</id>
<property name="TOWN" type="integer" >
<column name="TOWN_ID" not-null="true" />
</property>
==============================================
<composite-id name="VillageId" class="Table1Id">
<key-property name="townId" type="integer">
<column name="TOWN_ID" />
</key-property>
<key-property name="villageId" type="integer">
<column name="VILLAGE_ID" />
</key-property>
</composite-id>
<property name="townCode" type="integer" insert="false" update="false">
<column name="TOWN_ID" />
</property>
<bag name="councillors" outer-join="false" inverse="false" >
<key property-ref="townCode">
<column name="TOWN_ID" not-null="true" />
</key>
<one-to-many class="COUNCILLOR" />
</bag>
Needless to say, it's a legacy database, so wildly changing tables is out of question for me, it has to
work with hibernate.
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
17 years, 2 months