[Hibernate-JIRA] Created: (HHH-3478) @NaturalId queries not flushed from cache using EntityManager.remove(); exception results from query
by Elias Ross (JIRA)
@NaturalId queries not flushed from cache using EntityManager.remove(); exception results from query
----------------------------------------------------------------------------------------------------
Key: HHH-3478
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3478
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.3.0.SP1
Environment: Java 1.5, Maven dependencies:
[INFO] (root)
[INFO] | \- org.hibernate:hibernate-validator:jar:3.1.0.GA:compile
[INFO] +- commons-codec:commons-codec:jar:1.3:compile
[INFO] +- javax.persistence:persistence-api:jar:1.0:compile
[INFO] +- org.hibernate:hibernate-core:jar:3.3.0.SP1:compile
[INFO] | +- antlr:antlr:jar:2.7.6:compile
[INFO] | +- commons-collections:commons-collections:jar:3.1:compile
[INFO] | \- dom4j:dom4j:jar:1.6.1:compile
[INFO] | \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] +- org.hibernate:hibernate-annotations:jar:3.4.0.GA:compile
[INFO] | \- org.hibernate:ejb3-persistence:jar:1.0.2.GA:compile
[INFO] +- org.hibernate:hibernate-commons-annotations:jar:3.3.0.ga:compile
[INFO] | \- org.hibernate:hibernate:jar:3.2.1.ga:compile
[INFO] | +- net.sf.ehcache:ehcache:jar:1.2.3:compile
[INFO] | +- asm:asm-attrs:jar:1.5.3:compile
[INFO] | +- cglib:cglib:jar:2.1_3:compile
[INFO] | \- asm:asm:jar:1.5.3:compile
[INFO] +- org.hibernate:hibernate-entitymanager:jar:3.4.0.GA:compile
[INFO] | \- javassist:javassist:jar:3.4.GA:compile
[INFO] +- javax.transaction:jta:jar:1.0.1B:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.5.2:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.5.2:compile
[INFO] +- hsqldb:hsqldb:jar:1.8.0.10:test
[INFO] \- junit:junit:jar:4.4:test
Reporter: Elias Ross
Attachments: Dummy.java, DummyTest.java, persistence.xml
See attached test case and entity.
Current Result:
javax.persistence.EntityNotFoundException: Unable to find com.autodesk.lbs.cs.Dummy with id 1
at org.hibernate.ejb.Ejb3Configuration$Ejb3EntityNotFoundDelegate.handleEntityNotFound(Ejb3Configuration.java:113)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:171)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:223)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:126)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:905)
at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:873)
at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:590)
at org.hibernate.type.ManyToOneType.assemble(ManyToOneType.java:219)
at org.hibernate.cache.StandardQueryCache.get(StandardQueryCache.java:155)
at org.hibernate.loader.Loader.getResultFromQueryCache(Loader.java:2184)
at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2147)
at org.hibernate.loader.Loader.list(Loader.java:2117)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:118)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1596)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:306)
at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:328)
at com.autodesk.lbs.cs.DummyTest.naturalKeyCachedQuery(DummyTest.java:69)
at com.autodesk.lbs.cs.DummyTest.naturalKeyCachedQuery(DummyTest.java:61)
at com.autodesk.lbs.cs.DummyTest.testQuery(DummyTest.java:49)
It's expected that a cache invalidation occurs with an entity's natural key when it is removed.
I'll investigate a solution.
--
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
14 years, 5 months
[Hibernate-JIRA] Created: (HHH-3526) hbm2ddl.auto validate error on sequences in different schema
by Andres Galeano (JIRA)
hbm2ddl.auto validate error on sequences in different schema
------------------------------------------------------------
Key: HHH-3526
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3526
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Environment: Hibernate 3.3.1 GA & Oracle 9i Database
Reporter: Andres Galeano
Hello,
My situation is that I have an persistent object and matching hbm that reference a table and sequence in a different oracle schema. When I set the "hibernate.hbm2ddl.auto" property to "validate", a hibernate error message claims that the sequence does not exist, although it does and is accessible.
>From stepping through the code
in class: org.hibernate.tool.hbm2ddl.DatabaseMetadata
in method: public boolean isSequence(Object key)
This code parses the 'key', in this case sequence name, by '.' and searches to see if the last element is contained in the list of sequences. So if I prefix my sequence name with the schema name it belongs to, it's ignored. This doesn't seem right to me.
The code also seems to ignore the "schema" attribute of the "hibernate-mapping/class" element when validating sequence generators. To me this seems wrong as well.
Since the 'list of sequences' is only for the current schema, at least in the case of Oracle9Dialect, the validate fails, even though the sequence does exist and seems to be properly specified to me.
------------------------------------------------------------
Excerpt from my hbm.xml file:
------------------------------------------------------------
...
...
<hibernate-mapping>
<class name="bus.Accesspurpose" table="ACCESSPURPOSE" schema="WISH">
<id name="id" type="int">
<column name="ACCESSPURPOSEID" />
<generator class="sequence">
<!-- Prefixed with schema for database validation. -->
<param name="sequence">WISH.SEQ_ACCESSPURPOSEID</param>
</generator>
</id>
...
...
------------------------------------------------------------
Full stack trace.
------------------------------------------------------------
2008-10-08 10:47:15,375 ERROR Thread-1 org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SecurityManager' defined in class path resource [bus/wishdb-service-context.xml]: Cannot resolve reference to bean 'SecurityManagerDao' while setting bean property 'securityManagerDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SecurityManagerDao' defined in class path resource [db/wishdb-data-context.xml]: Cannot resolve reference to bean 'mySessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in class path resource [db/pp-app-data-context.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Missing sequence or table: WISH.SEQ_ACCESSPURPOSEID
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1172)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:940)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:437)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:383)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:353)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:169)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:400)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:736)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:369)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:825)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:714)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SecurityManagerDao' defined in class path resource [db/wishdb-data-context.xml]: Cannot resolve reference to bean 'mySessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in class path resource [db/pp-app-data-context.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Missing sequence or table: WISH.SEQ_ACCESSPURPOSEID
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1172)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:940)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:437)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:383)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:353)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:169)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
... 41 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in class path resource [db/pp-app-data-context.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Missing sequence or table: WISH.SEQ_ACCESSPURPOSEID
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1260)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:438)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:383)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:353)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:169)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
... 53 more
Caused by: org.hibernate.HibernateException: Missing sequence or table: WISH.SEQ_ACCESSPURPOSEID
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1127)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:139)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:349)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:799)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:733)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1288)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1257)
... 62 more
-----------------------------------------------------------
_________________
Thanks,
- Andy
See also the forums post:
http://forum.hibernate.org/viewtopic.php?t=991326
--
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
14 years, 5 months
[Hibernate-JIRA] Created: (HHH-3231) org.hibernate.id.enhanced.TableGenerator throws "IllegalArgumentException: alias not found: tbl" under Oracle
by Király Attila (JIRA)
org.hibernate.id.enhanced.TableGenerator throws "IllegalArgumentException: alias not found: tbl" under Oracle
-------------------------------------------------------------------------------------------------------------
Key: HHH-3231
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3231
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.6
Environment: Hibernate 3.2.6GA, Oracle 10g
Reporter: Király Attila
Attachments: hibernate_etg_ora.zip
org.hibernate.id.enhanced.TableGenerator always throws the following exception if I want to save a new object to Oracle:
java.lang.IllegalArgumentException: alias not found: tbl
at org.hibernate.sql.ForUpdateFragment.<init>(ForUpdateFragment.java:36)
at org.hibernate.dialect.Dialect.applyLocksToSql(Dialect.java:970)
at org.hibernate.id.enhanced.TableGenerator.configure(TableGenerator.java:194)
at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:104)
I attach an example to this case. The example is loosely based on the tutorial example, that comes with Hibernate. It contains a Person object that is saved to db using the enhanced.TableGenerator as id generator. To keep the zip small only the jars of jdbc driver are included, the jars needed from hibernate distribution are listed in lib/readme.txt.
The zip also contains a modified TableGenerator that works with Oracle. This version was made by forum user stomp and more information about it can be read here: http://forum.hibernate.org/viewtopic.php?t=980933
It changes the 194th row of TableGenerator from
this.query = dialect.applyLocksToSql( query, lockMap, CollectionHelper.EMPTY_MAP );
to
this.query = dialect.applyLocksToSql( query, lockMap, Collections.singletonMap("tbl", new String[] {valueColumnName}) );
--
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
14 years, 5 months
[Hibernate-JIRA] Created: (HHH-3609) Invalid list re-ordering with IndexColumn and OneToMany association
by Martin Kovacik (JIRA)
Invalid list re-ordering with IndexColumn and OneToMany association
-------------------------------------------------------------------
Key: HHH-3609
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3609
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Environment: Hibernate 3.3.1, Hibernate Tools 3.2.0, H2 database 1.0.69
Reporter: Martin Kovacik
I want to map unidirectional OneToMany ordered list using annotations. My mapping is:
public class Invoice {
// ...
@OneToMany(cascade = CascadeType.ALL)
@JoinTable(
name = "INVOICE_ITEM",
joinColumns = {@JoinColumn(name = "invoice_id")},
inverseJoinColumns = {@JoinColumn(name = "item_id")}
)
@Cascade(value = org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
@IndexColumn(name = "item_order")
private List<Item> items = new ArrayList<Item>();
}
The mapping of Item is not important here because I just want the association from Invoice to collection of Items to be unidirectional.
The problem what hbm2ddl generates:
create table INVOICE_ITEM (
invoice_id int8 not null,
item_id int8 not null,
item_order int4 not null,
primary key (invoice_id, item_order),
unique (item_id)
);
alter table INVOICE_ITEM
add constraint FK89837AD3EDA329D
foreign key (item_id)
references ITEM;
alter table INVOICE_ITEM
add constraint FK89837AD76A8E2D7
foreign key (invoice_id)
references INVOICE;
Another problem is how hibernate handles list re-ordering. If I want to change the item order (by manipulating invoice.items list) and then persist the changes hibernate tries to execute following sql:
update
INVOICE_ITEM
set
item_id=2
where
invoice_id=1
and item_order=0
update
INVOICE_ITEM
set
item_id=1
where
invoice_id=1
and item_order=1
However this causes DB to complain about unique item_id constraint (which was generated by hibernate). IMHO hibernate should update just the item_order column.
I think that this bug is related to ANN-679 (http://opensource.atlassian.com/projects/hibernate/browse/ANN-679).
--
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
14 years, 5 months