[Hibernate-JIRA] Created: (HB-1571) XML Mapping properties number of items have to match all SP's return-property items
by Lawrence Loh (JIRA)
XML Mapping properties number of items have to match all SP's return-property items
-----------------------------------------------------------------------------------
Key: HB-1571
URL: http://opensource.atlassian.com/projects/hibernate/browse/HB-1571
Project: Hibernate2
Type: Bug
Environment: NHibernate 1.2beta2
Reporter: Lawrence Loh
Attachments: GenericLookup999.hbm.xml
NHibernate tracker's link is down. So I submit this through this. Hope this offended anybody.
Please review the attached document.
Here is the sample of the mapping file -
...
<id name="ID" column="ID" unsaved-value="0" type="int">
<generator class="native"/>
</id>
<property name="Name" column="Name" not-null="false" type="System.String" />
<property name="Code" column="Code" not-null="true" type="System.String" />
<property name="Description" column="Description" not-null="true" type="System.String" />
</class>
<sql-query name="usp_GetActivityTypes">
<return class="BusinessObject.GenericLookup,BusinessObject">
<return-property name="ID" column="ID"/>
<return-property name="Code" column="Code"/>
<return-property name="Description" column="Description"/>
</return>
exec usp_GetActivityTypes ?
</sql-query>
Note - property "Name" is not in return-property in the stored procedures.
Here is the exception is being thrown -
NHibernate.ADOException: could not execute query[SQL: exec usp_GetActivityTypes ?] ---> System.IndexOutOfRangeException: Name0_0_
at System.Data.ProviderBase.FieldNameLookup.GetOrdinal(String fieldName)
at System.Data.SqlClient.SqlDataReader.GetOrdinal(String name)
at NHibernate.Driver.NHybridDataReader.GetOrdinal(String name)
at NHibernate.Type.NullableType.NullSafeGet(IDataReader rs, String name)
**** Important***
I would expect that number of "return-property" should not be relevent/dependent on number of properties declared.. In this case it does.
--
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
19 years
[Hibernate-JIRA] Created: (EJB-229) merge fails with detached obj in 1:1 relationship
by Juergen Zimmermann (JIRA)
merge fails with detached obj in 1:1 relationship
-------------------------------------------------
Key: EJB-229
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-229
Project: Hibernate Entity Manager
Type: Bug
Components: EntityManager
Versions: 3.2.0.cr2
Environment: JBoss 4.0.5CR1, Hibernate 3.2.0CR4, Hibernate EntityManager 3.2.0CR2, PostgreSQL 8.1.4, JDK 1.5.0_08
Reporter: Juergen Zimmermann
I'm using Hibernate EntityManager 3.2CR2 inside JBoss EJB3 CR9.
I'm invoking em.merge() with a detached object. The detached object has a 1:1 relationship with another detached object. The fetch strategy is the default strategy for 1:1 relationships. However, merge() fails and yields the stack trace below.
When I enforce loading the referenced (and also detached) object, e.g. by em.find(), then there is no problem in invoking merge() afterwards.
javax.ejb.EJBException: java.lang.ClassCastException: de.hska.kundenverwaltung.db.Firmenkunde
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.RoleBasedAuthorizationInterceptor.invoke(RoleBasedAuthorizationInterceptor.java:167)
at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptor.invoke(RoleBasedAuthorizationInterceptor.java:108)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:131)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:263)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:412)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
Caused by: java.lang.ClassCastException: de.hska.kundenverwaltung.db.Firmenkunde
at org.hibernate.type.LongType.set(LongType.java:42)
at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:83)
at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:65)
at org.hibernate.loader.Loader.bindPositionalParameters(Loader.java:1513)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1575)
at org.hibernate.loader.Loader.doQuery(Loader.java:661)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1784)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)
at org.hibernate.loader.entity.EntityLoader.loadByUniqueKey(EntityLoader.java:85)
at org.hibernate.persister.entity.AbstractEntityPersister.loadByUniqueKey(AbstractEntityPersister.java:1581)
at org.hibernate.type.EntityType.loadByUniqueKey(EntityType.java:365)
at org.hibernate.type.EntityType.resolve(EntityType.java:306)
at org.hibernate.type.EntityType.replace(EntityType.java:207)
at org.hibernate.type.TypeFactory.replace(TypeFactory.java:437)
at org.hibernate.event.def.DefaultMergeEventListener.copyValues(DefaultMergeEventListener.java:340)
at org.hibernate.event.def.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:267)
at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:120)
at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:53)
at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:677)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:661)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:665)
--
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
19 years
[Hibernate-JIRA] Created: (EJB-237) merge() causes version to increase
by Olli Blackburn (JIRA)
merge() causes version to increase
----------------------------------
Key: EJB-237
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-237
Project: Hibernate Entity Manager
Type: Bug
Components: EntityManager
Versions: 3.2.0.cr2
Environment: Core 3.2 CR4
EM 3.2 CR2
HSQLDB 1.8.0.2 in memory
Reporter: Olli Blackburn
Attachments: Playpen.zip
I'm finding that calling merge() on an unmodified entity results in the entity being marked dirty and hence its version number is increased and an SQL UPDATE performed on it.
See the attached test case (packaged as a complete eclipse 3.2 project). Set EJB3_HOME, HIBERNATE_HOME and HSQLDB_HOME in your eclipse workspace preferences and then run the included PojoTest launcher to see it run.
The test populates the DB, does a select by name, merge, merge and select by name again. Each of these five steps is in its own Tx and entity manager. The pojo is not being modified (by my code) between the merge calls(), yet I get the following output (each print is before the commit following the operation):
findByUniqueName: pojo1 version=0
merge: pojo1 version=0
merge: pojo1 version=1
findByUniqueName: pojo1 version=2
--
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
19 years
[Hibernate-JIRA] Created: (EJB-226) JarVistor.getVisitor does not handle paths containing spaces correctly for an exploded par
by Michael Falco (JIRA)
JarVistor.getVisitor does not handle paths containing spaces correctly for an exploded par
------------------------------------------------------------------------------------------
Key: EJB-226
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-226
Project: Hibernate Entity Manager
Type: Bug
Components: EntityManager
Versions: 3.2.0.cr2
Environment: Hibernate 3.2.0, Hibernate Annotations 3.2.0.cr2 on Windows XP
Reporter: Michael Falco
I found from the JIRA database that EJB-178 and EJB-181 were written regarding the issue of the Entity Manager not handling paths with spaces in them correctly, and they both are in the 'resolved' state. However, in 3.2.0.cr2 of the EntityManager, I still get this error when running the PackagedEntityManagerTest testExplodedPar JUnit test from a root directory that contains spaces:
12:20:34,331 DEBUG JarVisitor:192 - Searching mapped entities in jar/par: file:/D:/User%20Data/Eclipse_Workspaces/Test/HibernateEntityManagerTest/build/testresources/explodedpar.par
12:20:34,346 WARN FileZippedJarVisitor:37 - Unable to find file (ignored): file:/D:/User%20Data/Eclipse_Workspaces/Test/HibernateEntityManagerTest/build/testresources/explodedpar.par
java.util.zip.ZipException: Access is denied
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:203)
at java.util.jar.JarFile.<init>(JarFile.java:132)
at java.util.jar.JarFile.<init>(JarFile.java:70)
at org.hibernate.ejb.packaging.FileZippedJarVisitor.doProcessElements(FileZippedJarVisitor.java:34)
at org.hibernate.ejb.packaging.JarVisitor.getMatchingEntries(JarVisitor.java:215)
at org.hibernate.ejb.Ejb3Configuration.addMetadataFromVisitor(Ejb3Configuration.java:251)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:227)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:120)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37)
at org.hibernate.ejb.test.PackagedEntityManagerTest.testExplodedPar(PackagedEntityManagerTest.java:110)
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 junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
After looking at the EJB-178 and EJB-181 errors and the code, it appears that what happened was that EJB-178 was closed as a duplicate of EJB-181, but they are not the same error. It is the same jarUrl.getFile() call that causes the problem, but it is in different code: EJB-178 covers the org.hibernate.ejb.packaging.JarVisitor.getVisitor() method, whereas EJB-181 covers the org.hibernate.ejb.packaging.ExplodedJarVisitor.doProcessElements() .
The source code shows that EJB-181 was fixed but EJB-178 was not. I put the fix in to the JarVisitor.getVisitor() method (changed jar Url.getFile() to jarUrl.toURI().getSchemeSpecificPart() and added exception handling) and rebuilt the Entity Manager jar. I then reran the PackagedEntityManagerTest testExplodedPar JUnit test using the new jar, and the JUnit passed.
--
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
19 years
[Hibernate-JIRA] Resolved: (ANN-249) @Range does not support Float/Doubles
by Emmanuel Bernard (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-249?page=all ]
Emmanuel Bernard resolved ANN-249:
----------------------------------
Resolution: Won't Fix
I agree with Guilherme. I don't see real number ranges as useful as integer number ranges. But you can easily write your own validator
> @Range does not support Float/Doubles
> -------------------------------------
>
> Key: ANN-249
> URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-249
> Project: Hibernate Annotations
> Type: Improvement
> Components: validator
> Versions: 3.1beta8
> Environment: Java1.5.0_06, Hibernate 3.1.2, Annotations 3.1b8
> IBM OS/400 DB2 Database
> Reporter: Ben Ludkiewicz
> Priority: Minor
>
>
> I am trying to use the Hibernate Validator to annotate a Float property (a price) but @Range, @Min, and @Max don't seem to support it. When I try adding an 'f' to the end of the number (9999.99f) or cast it ( (float)9999.99 ) I get an type mismatch error saying 'cannot convert a float to an int' (for @Min, @Max) or '... a long' (for @Range). I also tried using a Double instead of a Float and I get the same errors. The Annotations 3.1b8 reference stats that @Min, @Max, and @Range can be applied on a "property (numeric or string representation of a numeric)."
> I posted this on the forums and got the following response from Emannuel:
> [quote="emmanuel"]
> acutally the contraints works on Number but the boundaries have to be of type int currently.
> Open a JIRA issue if it's still an issue for you.
> [/quote]
> Therefore, I am opening this JIRA issue.
--
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
19 years
[Hibernate-JIRA] Resolved: (ANN-37) Support for SQL Overriding (László Benke, Assaf Berg)
by Emmanuel Bernard (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-37?page=all ]
Emmanuel Bernard resolved ANN-37:
---------------------------------
Resolution: Fixed
Applied, thanks.
I have added @SQLDeleteAll
Annotations can be placed on collections too
I kept @Loader.namedQuery, since you can use HQL queries too
> Support for SQL Overriding (László Benke, Assaf Berg)
> -----------------------------------------------------
>
> Key: ANN-37
> URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-37
> Project: Hibernate Annotations
> Type: Improvement
> Components: binder
> Versions: 3.1beta3
> Reporter: Emmanuel Bernard
> Assignee: Emmanuel Bernard
> Priority: Trivial
> Fix For: 3.2.1
> Attachments: custom_entity_loader.patch, customsqlannotations.patch, customsqlannotationsusingcheck.patch
>
>
> @SqlInsert(statement="", callable=false),
> @SqlUpdate(statement="", callable=false),
> @SqlDelete(statement="", callable=false),
> @Loader(namedQuery="")
--
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
19 years
[Hibernate-JIRA] Updated: (ANN-37) Support for SQL Overriding (László Benke, Assaf Berg)
by Emmanuel Bernard (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-37?page=all ]
Emmanuel Bernard updated ANN-37:
--------------------------------
Summary: Support for SQL Overriding (László Benke, Assaf Berg) (was: @SqlInsert(), @SqlUpdate(), @SqlDelete(), @Loader())
Assign To: Emmanuel Bernard
> Support for SQL Overriding (László Benke, Assaf Berg)
> -----------------------------------------------------
>
> Key: ANN-37
> URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-37
> Project: Hibernate Annotations
> Type: Improvement
> Components: binder
> Versions: 3.1beta3
> Reporter: Emmanuel Bernard
> Assignee: Emmanuel Bernard
> Priority: Trivial
> Fix For: 3.2.1
> Attachments: custom_entity_loader.patch, customsqlannotations.patch, customsqlannotationsusingcheck.patch
>
>
> @SqlInsert(statement="", callable=false),
> @SqlUpdate(statement="", callable=false),
> @SqlDelete(statement="", callable=false),
> @Loader(namedQuery="")
--
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
19 years
[Hibernate-JIRA] Created: (ANN-473) uniqueConstraints on super class members
by Anthony Patricio (JIRA)
uniqueConstraints on super class members
----------------------------------------
Key: ANN-473
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-473
Project: Hibernate Annotations
Type: Bug
Components: binder
Versions: 3.2.0.ga
Reporter: Anthony Patricio
Priority: Minor
Attachments: testcase.zip
very similar to that addressed in the following JIRA using hibernate annotations 3.2.0.CR2
http://opensource.atlassian.com/projects/hibernate/browse/ANN-95
The super class contains the members we are using for defining the constraint.
The Super class:
----------------------------------------------------
@Entity(name="xpmComponent")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class Component...
@NotNull
@Length(max=40)
@Index(name="manufacturerPartNumber")
public String getManufacturerPartNumber() {
return manufacturerPartNumber;
}
@ManyToOne
@NotNull
@JoinColumn(name="manufacturerId")
public Manufacturer getManufacturer() {
return manufacturer;
}
...
The Entity w/ Unique Constraint:
----------------------------------------------------
@Entity
@Name("xpmProduct")
@Table(name = "xPM_Product",
uniqueConstraints={@UniqueConstraint(
columnNames={"manufacturerPartNumber", "manufacturerId"})})
public class PersistentProduct extends Component...
The Exception which occurs upon deployment
----------------------------------------------------
java.lang.NullPointerException
at org.hibernate.mapping.UniqueKey.sqlConstraintString(UniqueKey.java:20)
at org.hibernate.mapping.Table.sqlCreateString(Table.java:436)
at org.hibernate.cfg.Configuration.generateSchemaCreationScript(Configuration.java:779)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:74)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:311)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1218)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:688)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:127)
at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264)
at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
at org.jboss.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:102)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.start()V(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
runnable testcase attached.
--
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
19 years