[Hibernate-JIRA] Resolved: (HHH-1774) Component parameters bound incorrectly
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1774?page=all ]
Steve Ebersole resolved HHH-1774:
---------------------------------
Resolution: Fixed
See org.hibernate.test.hql.ASTParserLoadingTest#testComponentParameterBinding
> Component parameters bound incorrectly
> --------------------------------------
>
> Key: HHH-1774
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1774
> Project: Hibernate3
> Type: Bug
> Components: query-hql
> Environment: Hibernate 3.1.3 / 3.2.0 cr1 / 3.2.9 cr2
> Database: PostgreSQL 8.0 and Oracle 7.3.4
> Reporter: Regis Pires Magalhaes
> Assignee: Steve Ebersole
> Fix For: 3.2.1
> Attachments: CompositeIdTest.java
>
>
> Hibernate is generating a wrong SQL related to a composite-id HQL.
> The details of the problem are described below...
> MAPPING:
> <hibernate-mapping>
> <class name="Cobrador" table="cobrador">
> <composite-id name="id" class="CobradorId">
> <key-property name="empresa"/>
> <key-property name="matricula"/>
> </composite-id>
> <property name="nome" type="string"/>
> </class>
> </hibernate-mapping>
> HQL:
> from Cobrador cobrador
> where cobrador = :cobrador
> GENERATED SQL:
> select cobrador0_.empresa as empresa3_,
> cobrador0_.matricula as matricula3_,
> cobrador0_.nome as nome3_,
> from cobrador cobrador0_
> where (cobrador0_.empresa, cobrador0_.matricula)=?
> PARAMETERS BINDING:
> DEBUG 13/05/2006 10:32:18 [org.hibernate.type.IntegerType:80] - binding '1' to parameter: 1
> DEBUG 13/05/2006 10:32:18 [org.hibernate.type.IntegerType:80] - binding '1234' to parameter: 2
> Note that 2 parameters are binded, but there is just a single parameter in the generated SQL.
> DATABASE EXCEPTION:
> org.postgresql.util.PSQLException: The column index is out of range: 2, number of columns: 1
> The generated SQL should be:
> select cobrador0_.empresa as empresa3_,
> cobrador0_.matricula as matricula3_,
> cobrador0_.nome as nome3_,
> from cobrador cobrador0_
> where (cobrador0_.empresa, cobrador0_.matricula)=(?, ?)
--
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, 6 months
[Hibernate-JIRA] Created: (ANN-464) AbstractEntityManagerImpl.joinTransaction() has dead code block
by Barry Kaplan (JIRA)
AbstractEntityManagerImpl.joinTransaction() has dead code block
---------------------------------------------------------------
Key: ANN-464
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-464
Project: Hibernate Annotations
Type: Bug
Versions: 3.2.0.cr3
Reporter: Barry Kaplan
In the method joinTransaction(boolean ignoreJoining) there is the snippet:
joinableCMTTransaction.markForJoined();
session.isOpen(); //register to the Tx
if ( joinableCMTTransaction.getStatus() == JoinableCMTTransaction.JoinStatus.NOT_JOINED ) {
...
else
if ( joinableCMTTransaction.getStatus() == JoinableCMTTransaction.JoinStatus.MARKED_FOR_JOINED ) {
throw new AssertionFailure( "Transaction MARKED_FOR_JOINED after isOpen() call" );
}
The method joinableCMTTransaction.markForJoined() ensure that joinableCMTTransaction.getStatus() is either JoinStatus.JOINED or JoinStatus.MARKED_FOR_JOINED, ie:
public void markForJoined() {
if ( status != JoinStatus.JOINED ) status = JoinStatus.MARKED_FOR_JOINED;
}
Hence the if-block can never be entered.
I'm not sure what the implications of this are
In my program when joinableCMTTransaction.markForJoined() is invoked status != JoinStatus.JOINED is true, hence status gets assigned JoinStatus.MARKED_FOR_JOINED and the exception is always thrown.
I ran into this problem (not this issues problems though) when using the Geronimo transaction manager via jencks. Using JbossTM with everthing all others things unchanged I don't see the below exception.
--
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, 6 months
[Hibernate-JIRA] Created: (ANN-467) Inheritence of Embedded objects (@Embeddable)
by Jean Paul Ebejer (JIRA)
Inheritence of Embedded objects (@Embeddable)
----------------------------------------------
Key: ANN-467
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-467
Project: Hibernate Annotations
Type: Bug
Environment: JBoss 4.0.4, MYSQL 5.0.18, Java JDK 1.5.0_06
Reporter: Jean Paul Ebejer
Hi there @Hibernate (must be a pretty often repeated joke in here...)
I have an @Embeddable object AllocationId which extends another @Embeddable
object (GenericId). AllocationId, is simply a marker class and has NO attributes in it,
while all attributes (String id; which I want to persist) are in GenericId (inherited in AllocationId).
I get the following exception:
org.hibernate.AnnotationException: com.xxx.yyy.AllocationId has no persistent id property
at org.hibernate.cfg.AnnotationBinder.bindId(AnnotationBinder.java:1714)
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1171)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:706)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:452)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:268)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1039)
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1207)
at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:154)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:844)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:382)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:126)
at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264)
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.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 sun.reflect.GeneratedMethodAccessor144.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
Any Ideas ?
Code snippets as follow:
@Embeddable
public final class AllocationId extends GenericId {
// ... serial UID here - removed as considered somewhat sensitive ...
/**
* @param id
*/
public AllocationId(final String id) {
super(id);
}
}
@Embeddable
public abstract class GenericId implements Serializable {
/**
* The actual Id
*/
protected String id; // THIS IS NOT BEING 'SEEN' AS INSIDE AllocationId
/**
* Constructor to create a generic Id.
* Syntactic checks are performed here (not null and empty string)
*
* @param allocationId The allocation Id
*/
protected GenericId(final String id) {
validate(id);
this.id = id;
}
/**
* Performs syntactic checking of the generic id
*
* @param id may not be null or empty ""
*/
private void validate(final String id) throws IllegalArgumentException {
if (id == null) {
throw new IllegalArgumentException("id cannot be null");
}
if (id.trim().length() == 0) {
throw new IllegalArgumentException("id cannot be length 0");
}
}
/**
* @return the id
*/
public String getId() {
return this.id;
}
@Override
public String toString() {
return getId();
}
// some less interesting code here .equals overrides etc.
}
Let me know.
Many Thanks - for your attention and for your GREAT product,
Malta (MT).
--
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, 6 months