[Hibernate-JIRA] Created: (ANN-446) @OneToMany association in 3.2.0.cr2 does not work with simple element types.
by Mike Brock (JIRA)
@OneToMany association in 3.2.0.cr2 does not work with simple element types.
----------------------------------------------------------------------------
Key: ANN-446
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-446
Project: Hibernate Annotations
Type: Bug
Versions: 3.2.0.cr2
Environment: Hibernate 3.20.CR4
Reporter: Mike Brock
Hibernate has always allowed, as far as I can remember to map simple elements as unmapped entities in a OneToMany association (such as Strings, Integers, etc).
In fact, hibernate-annotations 3.2.0.cr1 allowed this:
@OneToMany(targetEntity = String.class)
private Set<String> roles;
As of this latest release, we get a complaint that String is not a mapped entity. Is this intentional or a bug? Previously, hibernate would create a simple two column join table in such an association in a key-value arrangement to deal with this.
I am aware that @CollectionOfElements can be used to deal with this type of association in the hibernate-annotations package.
Does it's existence imply that the Java Persistence API does not have support for this type of association?
--
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
18 years, 3 months
[Hibernate-JIRA] Commented: (HHH-1598) SchemaValidator fails when using boolean with HSQL
by Alexander Kiel (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1598?page=c... ]
Alexander Kiel commented on HHH-1598:
-------------------------------------
This issue is discussed here: http://forum.hibernate.org/viewtopic.php?p=2324183#2324183
> SchemaValidator fails when using boolean with HSQL
> --------------------------------------------------
>
> Key: HHH-1598
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1598
> Project: Hibernate3
> Type: Bug
> Components: core
> Versions: 3.1.3
> Environment: HSQL 1.8.0.2
> Reporter: objective
> Priority: Minor
> Attachments: Cat.zip
>
>
> chemaValidator fails when using boolean with HSQL
> Table.validateColumns() fails with table with column type="boolean". The table is created automatically using hbm2ddl.
> HSQL 1.8.0.2
> Exception in thread "main" org.hibernate.HibernateException: Wrong column type: abc, expected: bit
> at org.hibernate.mapping.Table.validateColumns(Table.java:219)
> at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:965)
> at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:116)
> at HsqlHibernateBit.main(HsqlHibernateBit.java:10)
> 20:26:31 [ main] INFO [Environment ] - Hibernate 3.1.3
> 20:26:31 [ main] INFO [Environment ] - hibernate.properties not found
> 20:26:31 [ main] INFO [Environment ] - using CGLIB reflection optimizer
> 20:26:31 [ main] INFO [Environment ] - using JDK 1.4 java.sql.Timestamp handling
> 20:26:32 [ main] INFO [Configuration ] - configuring from resource: hibernate-HSQL.cfg.xml
> 20:26:32 [ main] INFO [Configuration ] - Configuration resource: hibernate-HSQL.cfg.xml
> 20:26:32 [ main] DEBUG [DTDEntityResolver ] - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd]
> 20:26:32 [ main] DEBUG [DTDEntityResolver ] - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
> 20:26:32 [ main] DEBUG [DTDEntityResolver ] - located [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in classpath
> 20:26:32 [ main] DEBUG [Configuration ] - hibernate.connection.driver_class=org.hsqldb.jdbcDriver
> 20:26:32 [ main] DEBUG [Configuration ] - hibernate.connection.url=jdbc:hsqldb:mem:cat
> 20:26:32 [ main] DEBUG [Configuration ] - hibernate.connection.username=sa
> 20:26:32 [ main] DEBUG [Configuration ] - hibernate.connection.password=
> 20:26:32 [ main] DEBUG [Configuration ] - hibernate.connection.pool_size=1
> 20:26:32 [ main] DEBUG [Configuration ] - hibernate.dialect=org.hibernate.dialect.HSQLDialect
> 20:26:32 [ main] DEBUG [Configuration ] - hibernate.show_sql=false
> 20:26:32 [ main] DEBUG [Configuration ] - hibernate.hbm2ddl.auto=update
> 20:26:32 [ main] INFO [Configuration ] - Configured SessionFactory: null
> 20:26:32 [ main] INFO [Configuration ] - Reading mappings from resource: Cat.hbm.xml
> 20:26:32 [ main] DEBUG [DTDEntityResolver ] - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
> 20:26:32 [ main] DEBUG [DTDEntityResolver ] - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
> 20:26:32 [ main] DEBUG [DTDEntityResolver ] - located [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath
> 20:26:32 [ main] INFO [HbmBinder ] - Mapping class: Cat -> Cat
> 20:26:32 [ main] DEBUG [HbmBinder ] - Mapped property: abc -> abc
> 20:26:32 [ main] DEBUG [Configuration ] - Preparing to build session factory with filters : {}
> 20:26:32 [ main] DEBUG [Configuration ] - processing extends queue
> 20:26:32 [ main] DEBUG [Configuration ] - processing collection mappings
> 20:26:32 [ main] DEBUG [Configuration ] - processing native query and ResultSetMapping mappings
> 20:26:32 [ main] DEBUG [Configuration ] - processing association property references
> 20:26:32 [ main] DEBUG [Configuration ] - processing foreign key constraints
> 20:26:32 [ main] INFO [riverManagerConnectionProvider] - Using Hibernate built-in connection pool (not for production use!)
> 20:26:32 [ main] INFO [riverManagerConnectionProvider] - Hibernate connection pool size: 1
> 20:26:32 [ main] INFO [riverManagerConnectionProvider] - autocommit mode: false
> 20:26:32 [ main] INFO [riverManagerConnectionProvider] - using driver: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:mem:cat
> 20:26:32 [ main] INFO [riverManagerConnectionProvider] - connection properties: {user=sa, password=}
> 20:26:32 [ main] DEBUG [riverManagerConnectionProvider] - total checked-out connections: 0
> 20:26:32 [ main] DEBUG [riverManagerConnectionProvider] - opening new JDBC connection
> 20:26:33 [ main] DEBUG [riverManagerConnectionProvider] - created connection to: jdbc:hsqldb:mem:cat, Isolation Level: 0
> 20:26:33 [ main] INFO [SettingsFactory ] - RDBMS: HSQL Database Engine, version: 1.8.0
> 20:26:33 [ main] INFO [SettingsFactory ] - JDBC driver: HSQL Database Engine Driver, version: 1.8.0
> 20:26:33 [ main] DEBUG [riverManagerConnectionProvider] - returning connection to pool, pool size: 1
> 20:26:33 [ main] INFO [Dialect ] - Using dialect: org.hibernate.dialect.HSQLDialect
> 20:26:33 [ main] INFO [TransactionFactoryFactory] - Using default transaction strategy (direct JDBC transactions)
> 20:26:33 [ main] INFO [ransactionManagerLookupFactory] - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
> 20:26:33 [ main] INFO [SettingsFactory ] - Automatic flush during beforeCompletion(): disabled
> 20:26:33 [ main] INFO [SettingsFactory ] - Automatic session close at end of transaction: disabled
> 20:26:33 [ main] INFO [SettingsFactory ] - JDBC batch size: 15
> 20:26:33 [ main] INFO [SettingsFactory ] - JDBC batch updates for versioned data: disabled
> 20:26:33 [ main] INFO [SettingsFactory ] - Scrollable result sets: enabled
> 20:26:33 [ main] DEBUG [SettingsFactory ] - Wrap result sets: disabled
> 20:26:33 [ main] INFO [SettingsFactory ] - JDBC3 getGeneratedKeys(): disabled
> 20:26:33 [ main] INFO [SettingsFactory ] - Connection release mode: auto
> 20:26:33 [ main] INFO [SettingsFactory ] - Default batch fetch size: 1
> 20:26:33 [ main] INFO [SettingsFactory ] - Generate SQL with comments: disabled
> 20:26:33 [ main] INFO [SettingsFactory ] - Order SQL updates by primary key: disabled
> 20:26:33 [ main] INFO [SettingsFactory ] - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
> 20:26:33 [ main] INFO [ASTQueryTranslatorFactory] - Using ASTQueryTranslatorFactory
> 20:26:33 [ main] INFO [SettingsFactory ] - Query language substitutions: {}
> 20:26:33 [ main] INFO [SettingsFactory ] - Second-level cache: enabled
> 20:26:33 [ main] INFO [SettingsFactory ] - Query cache: disabled
> 20:26:33 [ main] INFO [SettingsFactory ] - Cache provider: org.hibernate.cache.EhCacheProvider
> 20:26:33 [ main] INFO [SettingsFactory ] - Optimize cache for minimal puts: disabled
> 20:26:33 [ main] INFO [SettingsFactory ] - Structured second-level cache entries: disabled
> 20:26:33 [ main] DEBUG [SQLExceptionConverterFactory] - Using dialect defined converter
> 20:26:33 [ main] INFO [SettingsFactory ] - Statistics: disabled
> 20:26:33 [ main] INFO [SettingsFactory ] - Deleted entity synthetic identifier rollback: disabled
> 20:26:33 [ main] INFO [SettingsFactory ] - Default entity-mode: pojo
> 20:26:33 [ main] INFO [SessionFactoryImpl ] - building session factory
> 20:26:33 [ main] DEBUG [SessionFactoryImpl ] - Session factory constructed with filter configurations : {}
> 20:26:33 [ main] DEBUG [SessionFactoryImpl ] - instantiating session factory with properties:
> 20:26:33 [ main] DEBUG [CacheManager ] - Creating new CacheManager with default config
> 20:26:33 [ main] DEBUG [CacheManager ] - Configuring ehcache from classpath.
> 20:26:33 [ main] WARN [Configurator ] - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/C:/idea-workspace/replication/lib/ehcache-1.1.jar!/ehcache-failsafe.xml
> 20:26:33 [ main] DEBUG [Configuration$DiskStore] - Disk Store Path: C:\DOCUME~1\obj\LOCALS~1\Temp\
> 20:26:34 [ main] DEBUG [AbstractEntityPersister] - Static SQL for entity: Cat
> 20:26:34 [ main] DEBUG [AbstractEntityPersister] - Version select: select id from Cat where id =?
> 20:26:34 [ main] DEBUG [AbstractEntityPersister] - Snapshot select: select cat_.id, cat_.abc as abc0_ from Cat cat_ where cat_.id=?
> 20:26:34 [ main] DEBUG [AbstractEntityPersister] - Insert 0: insert into Cat (abc, id) values (?, ?)
> 20:26:34 [ main] DEBUG [AbstractEntityPersister] - Update 0: update Cat set abc=? where id=?
> 20:26:34 [ main] DEBUG [AbstractEntityPersister] - Delete 0: delete from Cat where id=?
> 20:26:34 [ main] DEBUG [AbstractEntityPersister] - Identity insert: insert into Cat (abc, id) values (?, null)
> 20:26:34 [ main] DEBUG [EntityLoader ] - Static select for entity Cat: select cat0_.id as id0_0_, cat0_.abc as abc0_0_ from Cat cat0_ where cat0_.id=?
> 20:26:34 [ main] DEBUG [EntityLoader ] - Static select for entity Cat: select cat0_.id as id0_0_, cat0_.abc as abc0_0_ from Cat cat0_ where cat0_.id=?
> 20:26:34 [ main] DEBUG [EntityLoader ] - Static select for entity Cat: select cat0_.id as id0_0_, cat0_.abc as abc0_0_ from Cat cat0_ where cat0_.id=?
> 20:26:34 [ main] DEBUG [EntityLoader ] - Static select for entity Cat: select cat0_.id as id0_0_, cat0_.abc as abc0_0_ from Cat cat0_ where cat0_.id=?
> 20:26:34 [ main] DEBUG [EntityLoader ] - Static select for action ACTION_MERGE on entity Cat: select cat0_.id as id0_0_, cat0_.abc as abc0_0_ from Cat cat0_ where cat0_.id=?
> 20:26:34 [ main] DEBUG [EntityLoader ] - Static select for action ACTION_REFRESH on entity Cat: select cat0_.id as id0_0_, cat0_.abc as abc0_0_ from Cat cat0_ where cat0_.id=?
> 20:26:34 [ main] DEBUG [SessionFactoryObjectFactory] - initializing class SessionFactoryObjectFactory
> 20:26:34 [ main] DEBUG [SessionFactoryObjectFactory] - registered: 4028810f0a271205010a27120a650000 (unnamed)
> 20:26:34 [ main] INFO [SessionFactoryObjectFactory] - Not binding factory to JNDI, no JNDI name configured
> 20:26:34 [ main] DEBUG [SessionFactoryImpl ] - instantiated session factory
> 20:26:34 [ main] INFO [SchemaUpdate ] - Running hbm2ddl schema update
> 20:26:34 [ main] INFO [SchemaUpdate ] - fetching database metadata
> 20:26:34 [ main] DEBUG [riverManagerConnectionProvider] - total checked-out connections: 0
> 20:26:34 [ main] DEBUG [riverManagerConnectionProvider] - using pooled JDBC connection, pool size: 0
> 20:26:34 [ main] INFO [SchemaUpdate ] - updating schema
> 20:26:34 [ main] DEBUG [Configuration ] - processing extends queue
> 20:26:34 [ main] DEBUG [Configuration ] - processing collection mappings
> 20:26:34 [ main] DEBUG [Configuration ] - processing native query and ResultSetMapping mappings
> 20:26:34 [ main] DEBUG [Configuration ] - processing association property references
> 20:26:34 [ main] DEBUG [Configuration ] - processing foreign key constraints
> 20:26:34 [ main] INFO [DatabaseMetadata ] - table not found: Cat
> 20:26:34 [ main] INFO [DatabaseMetadata ] - table not found: Cat
> 20:26:34 [ main] DEBUG [SchemaUpdate ] - create table Cat (id bigint generated by default as identity (start with 1), abc bit, primary key (id))
> 20:26:34 [ main] INFO [SchemaUpdate ] - schema update complete
> 20:26:34 [ main] DEBUG [riverManagerConnectionProvider] - returning connection to pool, pool size: 1
> 20:26:34 [ main] DEBUG [SessionFactoryImpl ] - Checking 0 named HQL queries
> 20:26:34 [ main] DEBUG [SessionFactoryImpl ] - Checking 0 named SQL queries
> 20:26:34 [ main] INFO [Dialect ] - Using dialect: org.hibernate.dialect.HSQLDialect
> 20:26:34 [ main] INFO [SchemaValidator ] - Running schema validator
> 20:26:34 [ main] INFO [SchemaValidator ] - fetching database metadata
> 20:26:34 [ main] INFO [riverManagerConnectionProvider] - Using Hibernate built-in connection pool (not for production use!)
> 20:26:34 [ main] INFO [riverManagerConnectionProvider] - Hibernate connection pool size: 1
> 20:26:34 [ main] INFO [riverManagerConnectionProvider] - autocommit mode: false
> 20:26:34 [ main] INFO [riverManagerConnectionProvider] - using driver: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:mem:cat
> 20:26:34 [ main] INFO [riverManagerConnectionProvider] - connection properties: {user=sa, password=}
> 20:26:34 [ main] DEBUG [riverManagerConnectionProvider] - total checked-out connections: 0
> 20:26:34 [ main] DEBUG [riverManagerConnectionProvider] - opening new JDBC connection
> 20:26:34 [ main] DEBUG [riverManagerConnectionProvider] - created connection to: jdbc:hsqldb:mem:cat, Isolation Level: 0
> 20:26:34 [ main] DEBUG [Configuration ] - processing extends queue
> 20:26:34 [ main] DEBUG [Configuration ] - processing collection mappings
> 20:26:34 [ main] DEBUG [Configuration ] - processing native query and ResultSetMapping mappings
> 20:26:34 [ main] DEBUG [Configuration ] - processing association property references
> 20:26:34 [ main] DEBUG [Configuration ] - processing foreign key constraints
> 20:26:34 [ main] INFO [TableMetadata ] - table found: PUBLIC.CAT
> 20:26:34 [ main] INFO [TableMetadata ] - columns: [abc, id]
> 20:26:34 [ main] DEBUG [riverManagerConnectionProvider] - returning connection to pool, pool size: 1
> 20:26:34 [ main] INFO [riverManagerConnectionProvider] - cleaning up connection pool: jdbc:hsqldb:mem:cat
> Exception in thread "main" org.hibernate.HibernateException: Wrong column type: abc, expected: bit
> at org.hibernate.mapping.Table.validateColumns(Table.java:219)
> at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:965)
--
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
18 years, 3 months
[Hibernate-JIRA] Created: (HHH-2111) HQL: Traversal of many-to-one relationship incorrectly results in inner join
by Matt Sgarlata (JIRA)
HQL: Traversal of many-to-one relationship incorrectly results in inner join
----------------------------------------------------------------------------
Key: HHH-2111
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2111
Project: Hibernate3
Type: Bug
Components: query-hql
Versions: 3.1.3
Reporter: Matt Sgarlata
Attachments: ScorecardNodeHDao.hbm.xml
Here is my HQL query:
select
count(*)
from
com.spider.cms.hdao.IScorecardNode sn
where
sn.nodeType in (0, 1, 2, 3) or
(
sn.nodeType = 5 and
sn.sourceNode.nodeType between 0 and 3
)
This is resulting in this SQL
select
count(*) as col_0_0_
from
scorecardnodes scorecardn0_,
scorecardnodes scorecardn1_
where
scorecardn0_.sourcenodeid=scorecardn1_.scorecardnodeid
and (
scorecardn0_.nodetype in (
0 , 1 , 2 , 3
)
or (scorecardn0_.nodetype=5
and (
scorecardn1_.nodetype between 0 and 3
))
)
The inner join in the SQL query is causing fewer result to be returned than expected. The first part of the where clause in the HQL query makes no mention of the sourceNode property, and so the returned results should include all scorecard nodes with the requested node type, regardless of whether or not they have an associated source node. The inner join is causing only rows to be returned if they have a source node associated with them. It's as if the query was written like this:
select
count(*)
from
com.spider.cms.hdao.IScorecardNode sn
where
(
sn.sourceNode is not null and
sn.nodeType in (0, 1, 2, 3)
) or
(
sn.nodeType = 5 and
sn.sourceNode.nodeType between 0 and 3
)
Attached is the relevant mapping information.
--
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
18 years, 3 months