[Hibernate-JIRA] Commented: (HHH-1851) "special" identifier property in HQL unnecessaryily causing problems
by Gunther Schadow (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1851?page=c... ]
Gunther Schadow commented on HHH-1851:
--------------------------------------
Thank you, that makes me hopeful. I wish I could help but I don't seem to be clear about the usecase that Emanuel and you have in mind which makes this difficult. My one-line patch works for me. So, perhaps, just a little syntax hack in the HQL grammar and we can turn "id" or "hid" into "@id" and that way overcome any further issues with overlap with any user properties. As far as I can see there should be no such serious ripple effects from this than there would be from this "virtual='yes'" attribute.
> "special" identifier property in HQL unnecessaryily causing problems
> --------------------------------------------------------------------
>
> Key: HHH-1851
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1851
> Project: Hibernate3
> Type: Improvement
> Components: query-hql
> Versions: 3.0 alpha, 3.0 beta 1, 3.0 beta 2, 3.0 beta 3, 3.0 beta 4, 3.0 rc 1, 3.0 final, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.1 beta 1, 3.1 beta 2, 3.1 rc 1, 3.1 rc2, 3.1 rc3, 3.1, 3.1.1, 3.1.2, 3.1.3
> Environment: independent, all versions all databases.
> Reporter: Gunther Schadow
>
> Original Estimate: 1 hour
> Remaining: 1 hour
>
> I HAVE REPORTED THIS PROBLEM BEFORE IN HHH-1127. THEN IT WAS FLAGGED AS "DUPLICATE" AND CLOSED PLEASE TELL ME WHAT IS THE ID OF THE REPORT WHICH THIS SUPPOSEDLY DUPLICATES?
> When a user decides to use the name "id" as the name of a property, HQL queries break with unspecific exceptions, because HQL assumes "id" as reserved for the Hibernate id attribute defined in the hbm file using the <id .../> tag. This is bad design in our view, because it puts an unnecessary constraint and interference with the otherwise transparent "object persistence for idiomatic Java."
> For example, a mapping file may contain:
> <class name="MyObject">
> <id name="internalId" ... />
> <property name="id" .../>
> <property name="foo" .../>
> </class>
> And since even the <id .../> element has a @name property, why can't HQL use that name rather than shadowing a perfectly good identifier for a normal property?
> The HQL query
> from MyObject where id='123'
> and this would fail because 'id' in HQL means the 'internalId' property not the property called 'id'. But if I wanted to access the internalId I could just as well have sayd:
> from MyObject where internalId='123'
> I do not understand the value of this feature and it is causing us tremendous problems, because our object property names are fixed by some larger standards body and I can't just replace "id" with some other name just because of HQL!
> I am currently hacking every version of Hibernate by changing only one line in
> org.hibernate.persister.entity.EntityPersister
> from
> public static final String ENTITY_ID = "id";
> to
> public static final String ENTITY_ID = "hid";
> But that of course is a problem and also breaking it for anyone who uses "hid" as a normal property name.
> I really don't understand what the value of this feature is and I am asking you to drop it alltogether or turn it into some really weird name or some function, whatever, but this "special" id attribute really, really hurts.
> Please, if you close this issue again, at least comment about your rationale or link it with the bug where it had been discussed. Thank you!
--
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, 5 months
[Hibernate-JIRA] Commented: (ANN-382) Exception raising : Strange behaviour depending on package names
by Hani Suleiman (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-382?page=co... ]
Hani Suleiman commented on ANN-382:
-----------------------------------
I get this same error now when running svn, with a variety of PU's. In some cases, the tables reported aren't even the same, for example:
javax.persistence.PersistenceException: org.hibernate.AnnotationException: Foreign key circularity dependency involving the following tables: calendar_appointment, calendar_adjustment, calendar_recurrence
> Exception raising : Strange behaviour depending on package names
> ----------------------------------------------------------------
>
> Key: ANN-382
> URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-382
> Project: Hibernate Annotations
> Type: Bug
> Environment: Hibernate's annotations packaged in JBoss EJB 3.0 RC8- FD
> Microsoft SQL Server 2000
> Reporter: Pierre Fourès
> Assignee: Emmanuel Bernard
> Fix For: 3.2.0
> Attachments: BugEJB3.zip
>
>
> As described in hibernate forum (http://forum.hibernate.org/viewtopic.php?t=960763) and discussed with Emmanuel, I encounter a strange behaviour with annotations depending of my package's names.
> Supposing hibernate load classes by package alphabetical order; if it get the "parent" class first all works fine, if it get the "child" class first, it raise an exception !
> Here is a subset of my classes, cleaned of getters, setters and all unrelated things, then followed by the exception stack :
> ///////////////////////////////////////////////
> package fr.ifis.entity.field.card;
> import java.io.Serializable;
> import javax.persistence.Embeddable;
> import javax.persistence.Entity;
> import javax.persistence.Id;
> import javax.persistence.ManyToOne;
> import fr.ifis.entity.project.Card;
> @Entity
> public class CardField {
> @Id
> private PrimaryKey primaryKey = new PrimaryKey();
>
> // cardtmp is a trick used in order to wait for http://opensource.atlassian.com/projects/hibernate/browse/ANN-381 resolution
> @ManyToOne
> private Card cardtmp;
> @Embeddable
> private class PrimaryKey implements Serializable {
>
> @ManyToOne(optional = false)
> private Card card;
>
> @ManyToOne(optional = false)
> private CardKey key;
> }
> }
> ///////////////////////////////////////////////
> package fr.ifis.entity.field.card;
> import javax.persistence.Entity;
> import javax.persistence.GeneratedValue;
> import javax.persistence.Id;
> @Entity
> public class CardKey {
> @Id
> @GeneratedValue
> private int id;
> }
> ///////////////////////////////////////////////
> package fr.ifis.entity.project;
> import java.io.Serializable;
> import java.util.Set;
> import javax.persistence.CascadeType;
> import javax.persistence.Embeddable;
> import javax.persistence.Entity;
> import javax.persistence.FetchType;
> import javax.persistence.Id;
> import javax.persistence.ManyToOne;
> import javax.persistence.OneToMany;
> import fr.ifis.entity.field.card.CardField;
> @Entity
> public class Card {
> @Id
> private CardPrimaryKey primaryKey = new CardPrimaryKey();
>
> @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER, mappedBy="cardtmp") //
> private Set<CardField> fields;
>
> @Embeddable
> private class CardPrimaryKey implements Serializable {
>
> @ManyToOne(optional = false)
> private Project project;
>
> //An other @ManyToOne is also present in the real model
> //The problem still occurs even when i remove this relation, it was no use to kept it for describe the problem
> }
> }
> ///////////////////////////////////////////////
> package fr.ifis.entity.project;
> import javax.persistence.Entity;
> import javax.persistence.GeneratedValue;
> import javax.persistence.Id;
> @Entity
> public class Project {
> @Id
> @GeneratedValue
> private int id;
> }
> ///////////////////////////////////////////////
> [java] ERROR 29-06 19:42:18,272 (AbstractController.java:incrementState:350) -Error installing to Start: name=persistence.units:unitName=Refonte state=Create
> [java] org.hibernate.MappingException: Foreign key (FK6771BFAA1845E8B:CardField [])) must have same number of columns as the referenced primary key (Card [project_id])
> [java] at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:90)
> [java] at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:73)
> [java] at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:1182)
> [java] at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1089)
> [java] at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:302)
> [java] at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1034)
> [java] at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1015)
> [java] at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:154)
> [java] at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:751)
> [java] at org.hibernate.ejb.Ejb3Configuration.createContainerEntityManagerFactory(Ejb3Configuration.java:350)
> [java] at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:119)
> [java] at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264)
> [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> [java] at java.lang.reflect.Method.invoke(Method.java:585)
> [java] at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:55)
> [java] at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:107)
> [java] at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
> [java] at org.jboss.kernel.plugins.dependency.KernelControllerContextActions.dispatchJoinPoint(KernelControllerContextActions.java:100)
> [java] at org.jboss.kernel.plugins.dependency.KernelControllerContextActions$LifecycleAction.installAction(KernelControllerContextActions.java:582)
> [java] at org.jboss.kernel.plugins.dependency.KernelControllerContextActions$KernelControllerContextAction.install(KernelControllerContextActions.java:175)
> [java] at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
> [java] at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:226)
> [java] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:593)
> [java] at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:346)
> [java] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:438)
> [java] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:379)
> [java] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:225)
> [java] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:151)
> [java] at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:79)
> [java] at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:73)
> [java] at org.jboss.ejb3.MCKernelAbstraction.install(MCKernelAbstraction.java:91)
> [java] at org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:626)
> [java] at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:475)
> [java] at org.jboss.ejb3.embedded.EJB3StandaloneDeployer.start(EJB3StandaloneDeployer.java:460)
> [java] at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.scanClasspath(EJB3StandaloneBootstrap.java:291)
> [java] at fr.ifis.Main.main(Unknown Source)
> ///////////////////////////////////////////////
> Indeed, depending on the package names I get or not an excpetion !
> It doesn't work with the package fr.ifis.entity.project but if I rename the package in fr.ifis.entity.aproject and then move it "before" the field.card package, all works fine.
> In order to facilitate the identification of the problem, I also include as attachement the eclipse project of this problem repport.
> In order to keep reasonable the size of the attachement, I did not included the libraries nor the configuration files for launch ejb3-embedded. Thoses files are issued from the project simple-deployment included in JBoss EJB 3.0 RC8-FD. The only change i've done was to specify in embedded-jboss-beans.xml the properties of my database.
> Regards,
> Pierre.
--
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, 5 months
[Hibernate-JIRA] Commented: (ANN-382) Exception raising : Strange behaviour depending on package names
by Adrian Sampaleanu (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-382?page=co... ]
Adrian Sampaleanu commented on ANN-382:
---------------------------------------
Emmanuel,
This latest fix broke something (or maybe it's exposing a problem) for us. I'm getting the following:
org.hibernate.AnnotationException: Foreign key circularity dependency involving the following tables: MICRO_TASKS, TASKS
at org.hibernate.cfg.AnnotationConfiguration.processFkSecondPassInOrder(AnnotationConfiguration.java:373)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:281)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1211)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:871)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:797)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:908)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:875)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:396)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:240)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:132)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:237)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:153)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:225)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:114)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:801)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:592)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:392)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:240)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:132)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:237)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:153)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:307)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:240)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:132)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:237)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:153)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:225)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:114)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:801)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:592)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:392)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:240)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:132)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:237)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:153)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:225)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:114)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:801)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:592)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:392)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:240)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:132)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:237)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:153)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:225)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:114)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:801)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:592)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:392)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:240)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:132)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:237)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:153)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:199)
at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:667)
at org.springframework.context.support.AbstractApplicationContext.registerListeners(AbstractApplicationContext.java:511)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:334)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:92)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:77)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:82)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:78)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:156)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:548)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:352)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:240)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:132)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:237)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:153)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:254)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:337)
at org.springframework.context.access.ContextSingletonBeanFactoryLocator.initializeDefinition(ContextSingletonBeanFactoryLocator.java:136)
at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:380)
at org.springframework.web.context.ContextLoader.loadParentContext(ContextLoader.java:319)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:180)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3729)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4187)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:809)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:698)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
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:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
There doesn't seem to be a circular reference between the two mentioned tables. Does your fix detect indirect circularities? I ask because our object graph is pretty complex and it's pretty hard at a glance to determine if indeed there is a very roundabout circular reference. If you can tell me tthat it does detect these I'll spend some time to try to resolve the issue.
Thanks for any hints,
Adrian
> Exception raising : Strange behaviour depending on package names
> ----------------------------------------------------------------
>
> Key: ANN-382
> URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-382
> Project: Hibernate Annotations
> Type: Bug
> Environment: Hibernate's annotations packaged in JBoss EJB 3.0 RC8- FD
> Microsoft SQL Server 2000
> Reporter: Pierre Fourès
> Assignee: Emmanuel Bernard
> Fix For: 3.2.0
> Attachments: BugEJB3.zip
>
>
> As described in hibernate forum (http://forum.hibernate.org/viewtopic.php?t=960763) and discussed with Emmanuel, I encounter a strange behaviour with annotations depending of my package's names.
> Supposing hibernate load classes by package alphabetical order; if it get the "parent" class first all works fine, if it get the "child" class first, it raise an exception !
> Here is a subset of my classes, cleaned of getters, setters and all unrelated things, then followed by the exception stack :
> ///////////////////////////////////////////////
> package fr.ifis.entity.field.card;
> import java.io.Serializable;
> import javax.persistence.Embeddable;
> import javax.persistence.Entity;
> import javax.persistence.Id;
> import javax.persistence.ManyToOne;
> import fr.ifis.entity.project.Card;
> @Entity
> public class CardField {
> @Id
> private PrimaryKey primaryKey = new PrimaryKey();
>
> // cardtmp is a trick used in order to wait for http://opensource.atlassian.com/projects/hibernate/browse/ANN-381 resolution
> @ManyToOne
> private Card cardtmp;
> @Embeddable
> private class PrimaryKey implements Serializable {
>
> @ManyToOne(optional = false)
> private Card card;
>
> @ManyToOne(optional = false)
> private CardKey key;
> }
> }
> ///////////////////////////////////////////////
> package fr.ifis.entity.field.card;
> import javax.persistence.Entity;
> import javax.persistence.GeneratedValue;
> import javax.persistence.Id;
> @Entity
> public class CardKey {
> @Id
> @GeneratedValue
> private int id;
> }
> ///////////////////////////////////////////////
> package fr.ifis.entity.project;
> import java.io.Serializable;
> import java.util.Set;
> import javax.persistence.CascadeType;
> import javax.persistence.Embeddable;
> import javax.persistence.Entity;
> import javax.persistence.FetchType;
> import javax.persistence.Id;
> import javax.persistence.ManyToOne;
> import javax.persistence.OneToMany;
> import fr.ifis.entity.field.card.CardField;
> @Entity
> public class Card {
> @Id
> private CardPrimaryKey primaryKey = new CardPrimaryKey();
>
> @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER, mappedBy="cardtmp") //
> private Set<CardField> fields;
>
> @Embeddable
> private class CardPrimaryKey implements Serializable {
>
> @ManyToOne(optional = false)
> private Project project;
>
> //An other @ManyToOne is also present in the real model
> //The problem still occurs even when i remove this relation, it was no use to kept it for describe the problem
> }
> }
> ///////////////////////////////////////////////
> package fr.ifis.entity.project;
> import javax.persistence.Entity;
> import javax.persistence.GeneratedValue;
> import javax.persistence.Id;
> @Entity
> public class Project {
> @Id
> @GeneratedValue
> private int id;
> }
> ///////////////////////////////////////////////
> [java] ERROR 29-06 19:42:18,272 (AbstractController.java:incrementState:350) -Error installing to Start: name=persistence.units:unitName=Refonte state=Create
> [java] org.hibernate.MappingException: Foreign key (FK6771BFAA1845E8B:CardField [])) must have same number of columns as the referenced primary key (Card [project_id])
> [java] at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:90)
> [java] at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:73)
> [java] at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:1182)
> [java] at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1089)
> [java] at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:302)
> [java] at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1034)
> [java] at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1015)
> [java] at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:154)
> [java] at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:751)
> [java] at org.hibernate.ejb.Ejb3Configuration.createContainerEntityManagerFactory(Ejb3Configuration.java:350)
> [java] at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:119)
> [java] at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264)
> [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> [java] at java.lang.reflect.Method.invoke(Method.java:585)
> [java] at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:55)
> [java] at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:107)
> [java] at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
> [java] at org.jboss.kernel.plugins.dependency.KernelControllerContextActions.dispatchJoinPoint(KernelControllerContextActions.java:100)
> [java] at org.jboss.kernel.plugins.dependency.KernelControllerContextActions$LifecycleAction.installAction(KernelControllerContextActions.java:582)
> [java] at org.jboss.kernel.plugins.dependency.KernelControllerContextActions$KernelControllerContextAction.install(KernelControllerContextActions.java:175)
> [java] at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
> [java] at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:226)
> [java] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:593)
> [java] at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:346)
> [java] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:438)
> [java] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:379)
> [java] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:225)
> [java] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:151)
> [java] at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:79)
> [java] at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:73)
> [java] at org.jboss.ejb3.MCKernelAbstraction.install(MCKernelAbstraction.java:91)
> [java] at org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:626)
> [java] at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:475)
> [java] at org.jboss.ejb3.embedded.EJB3StandaloneDeployer.start(EJB3StandaloneDeployer.java:460)
> [java] at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.scanClasspath(EJB3StandaloneBootstrap.java:291)
> [java] at fr.ifis.Main.main(Unknown Source)
> ///////////////////////////////////////////////
> Indeed, depending on the package names I get or not an excpetion !
> It doesn't work with the package fr.ifis.entity.project but if I rename the package in fr.ifis.entity.aproject and then move it "before" the field.card package, all works fine.
> In order to facilitate the identification of the problem, I also include as attachement the eclipse project of this problem repport.
> In order to keep reasonable the size of the attachement, I did not included the libraries nor the configuration files for launch ejb3-embedded. Thoses files are issued from the project simple-deployment included in JBoss EJB 3.0 RC8-FD. The only change i've done was to specify in embedded-jboss-beans.xml the properties of my database.
> Regards,
> Pierre.
--
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, 5 months
[Hibernate-JIRA] Commented: (EJB-98) EntityManager.find() throws an org.hibernate.ObjectDeletedException if you find something deleted in the same TXA
by Michał Borowiecki (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/EJB-98?page=com... ]
Michał Borowiecki commented on EJB-98:
--------------------------------------
I think this issue was fixed with HHH-1818. Can you run your test case on the latest sources to verify?
> EntityManager.find() throws an org.hibernate.ObjectDeletedException if you find something deleted in the same TXA
> -----------------------------------------------------------------------------------------------------------------
>
> Key: EJB-98
> URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-98
> Project: Hibernate Entity Manager
> Type: Bug
> Components: EntityManager
> Versions: 3.1beta5
> Environment: Java 1.5.06/junit3.8.1,hibernate 3.1, entity manager 3.1beta5, hsqldb 1.8.01
> Reporter: Steve Loughran
> Fix For: 3.2.0
> Attachments: DefaultLoadEventListener.patch
>
>
> I have a junit test case that persists something, finds it, then deletes it and tries to find again.
> Second time round, find() fails with an ObjectDeletedException. This is the semantics of Session.load(), not EntityManager.find(), which is meant to return null if something cannot be found:
> public void testDeleteAndFindFailsWrong() throws Exception {
> Event event = createTestEvent();
> String key = event.getKey();
> EntityTransaction transaction = null;
> try {
> transaction = manager.getTransaction();
> transaction.begin();
> manager.persist(event);
> Event e2 = manager.find(Event.class, key);
> assertEquals(event, e2);
> manager.remove(e2);
> try {
> e2 = manager.find(Event.class, key);
> assertNull("The spec says that find should return null here", e2);
> } catch (ObjectDeletedException e) {
> fail("This is not in the spec"+e);
> }
> } finally {
> rollback(transaction);
> }
> }
--
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, 5 months
[Hibernate-JIRA] Closed: (HHH-1470) Enhance Hibernate-Mapping DTD Definition of type element
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1470?page=all ]
Steve Ebersole closed HHH-1470:
-------------------------------
Fix Version: 3.2.0.ga
Resolution: Fixed
Assign To: Steve Ebersole
trunk/3.2
> Enhance Hibernate-Mapping DTD Definition of type element
> --------------------------------------------------------
>
> Key: HHH-1470
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1470
> Project: Hibernate3
> Type: Improvement
> Environment: Hibernate 3.1.x
> Reporter: Michael Plöd
> Assignee: Steve Ebersole
> Priority: Trivial
> Fix For: 3.2.0.ga
>
>
> As discussed with Steve in http://forum.hibernate.org/viewtopic.php?t=955303
> Could you please update the DTD Definition of "Element" as follows:
> <!ELEMENT element (column|formula|type)*>
> <!ATTLIST element column CDATA #IMPLIED>
> <!ATTLIST element node CDATA #IMPLIED>
> <!ATTLIST element formula CDATA #IMPLIED>
> <!ATTLIST element type CDATA #IMPLIED>
> <!ATTLIST element length CDATA #IMPLIED>
> <!ATTLIST element precision CDATA #IMPLIED>
> <!ATTLIST element scale CDATA #IMPLIED>
> <!ATTLIST element not-null (true|false) "false">
> <!ATTLIST element unique (true|false) "false">
> Actually type should be enabled as a child element of Element allowing users to add a parameter to a parameterized UserType inside an Element definition. Right now users will have to create a typedef with the parameter and place the name of the typedef in the attribute type. In addition to that the attribute definition of type must be set to IMPLIED.
> This would enalbe a mapping like that:
> <set name="ples" table="MY_PLES_TABLE">
> <key column="myClassId"/>
> <element>
> <type name="my.comp.common.hibernate.PleType">
> <param name="type">my.comp.domain.PleElement</param>
> </type>
> </element>
> </set>
--
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, 5 months
[Hibernate-JIRA] Commented: (HHH-1470) Enhance Hibernate-Mapping DTD Definition of type element
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1470?page=c... ]
Steve Ebersole commented on HHH-1470:
-------------------------------------
two things:
(1)
the ELEMENT definition really needs to be:
<!ELEMENT element ( (column|formula)*, type? )>
(2) for future reference, please attach diffs as diff file.
thanks.
> Enhance Hibernate-Mapping DTD Definition of type element
> --------------------------------------------------------
>
> Key: HHH-1470
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1470
> Project: Hibernate3
> Type: Improvement
> Environment: Hibernate 3.1.x
> Reporter: Michael Plöd
> Priority: Trivial
>
>
> As discussed with Steve in http://forum.hibernate.org/viewtopic.php?t=955303
> Could you please update the DTD Definition of "Element" as follows:
> <!ELEMENT element (column|formula|type)*>
> <!ATTLIST element column CDATA #IMPLIED>
> <!ATTLIST element node CDATA #IMPLIED>
> <!ATTLIST element formula CDATA #IMPLIED>
> <!ATTLIST element type CDATA #IMPLIED>
> <!ATTLIST element length CDATA #IMPLIED>
> <!ATTLIST element precision CDATA #IMPLIED>
> <!ATTLIST element scale CDATA #IMPLIED>
> <!ATTLIST element not-null (true|false) "false">
> <!ATTLIST element unique (true|false) "false">
> Actually type should be enabled as a child element of Element allowing users to add a parameter to a parameterized UserType inside an Element definition. Right now users will have to create a typedef with the parameter and place the name of the typedef in the attribute type. In addition to that the attribute definition of type must be set to IMPLIED.
> This would enalbe a mapping like that:
> <set name="ples" table="MY_PLES_TABLE">
> <key column="myClassId"/>
> <element>
> <type name="my.comp.common.hibernate.PleType">
> <param name="type">my.comp.domain.PleElement</param>
> </type>
> </element>
> </set>
--
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, 5 months