-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Possible problem with nested <component> and queries
PostPosted: Tue Jul 12, 2005 5:55 am 
Newbie

Joined: Tue Jul 12, 2005 5:41 am
Posts: 7
Hi all,

I'm trying to get this working:

Code:
package com.finantix.engineering.tests.hibernate3.mapping.lim.bl.pom.nested.components.impl;

public class P {
      private String fieldoid$;
   public void setOid$(String id) {
      this.fieldoid$ = id;
   }
   public String getOid$() {
      return this.fieldoid$;
   }

    private S fields;
    public S getS() {
        return this.fields;
    }
    public void setS(S param) {
        this.fields = param;
    }
   
    public boolean equals(Object o) {
        boolean result = false;
        try {
            P other = (P) o;
            return getOid$().equals(other.getOid$());
        } catch (Throwable t) {
        }
        return result;
    }

    public int hashCode() {
        return (getOid$() != null ? getOid$().hashCode() : super.hashCode());
    }
}


package com.finantix.engineering.tests.hibernate3.mapping.lim.bl.pom.nested.components.impl;

import com.finantix.stdlib.lang.lim.bl.pom.impl.ID;

public class S {
      private String fieldoid$;
   public void setOid$(String id) {
      this.fieldoid$ = id;
   }
   public String getOid$() {
      return this.fieldoid$;
   }
   
    private ID fieldi;
    public ID getI() {
        return this.fieldi;
    }
    public void setI(ID param) {
        this.fieldi = param;
    }
   
    public boolean equals(Object o) {
        boolean result = false;
        try {
            S other = (S) o;
            return getOid$().equals(other.getOid$());
        } catch (Throwable t) {
        }
        return result;
    }

    public int hashCode() {
        return (getOid$() != null ? getOid$().hashCode() : super.hashCode());
    }
}


package com.finantix.stdlib.lang.lim.bl.pom.impl;


public class ID {
      private String fieldoid$;
   public void setOid$(String id) {
      this.fieldoid$ = id;
   }
   public String getOid$() {
      return this.fieldoid$;
   }
   
    private java.math.BigInteger fieldid;
    public java.math.BigInteger getId$() {
        return this.fieldid;
    }
    public void setId$(java.math.BigInteger param) {
        this.fieldid = param;
    }
   
    public boolean equals(Object o) {
        boolean result = false;
        try {
            ID other = (ID) o;
            return getOid$().equals(other.getOid$());
        } catch (Throwable t) {
        }
        return result;
    }

    public int hashCode() {
        return (getOid$() != null ? getOid$().hashCode() : super.hashCode());
    }
}


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping auto-import="false" default-cascade="none">
  <class name="com.finantix.engineering.tests.hibernate3.mapping.lim.bl.pom.nested.components.impl.P" proxy="com.finantix.engineering.tests.hibernate3.mapping.lim.bl.pom.nested.components.impl.P" table="P">
    <composite-id>
      <key-property name="oid$" type="com.finantix.foundation.connector.hibernate3.primitives.basic.CharStringType">
        <column name="oid$" sql-type="char(35)"/>
      </key-property>
    </composite-id>
    <component class="com.finantix.engineering.tests.hibernate3.mapping.lim.bl.pom.nested.components.impl.S" name="s">
      <component class="com.finantix.stdlib.lang.lim.bl.pom.impl.ID" name="i">
        <property name="id$" type="com.finantix.foundation.connector.hibernate3.primitives.basic.IntegerType">
          <column name="s_i_id"  length="0"/>
        </property>
      </component>
    </component>
  </class>
</hibernate-mapping>


The query I'm performing is the following:

select p.s.i from com.finantix.engineering.tests.hibernate3.mapping.lim.bl.pom.nested.components.impl.P p

But I get the following exception:

2005-07-12 11:18:09,923 ERROR Sys.BC - 143: Full stack trace is: org.hibernate.QueryException: could not resolve property: i of: com.finantix.engineering.tests.hibernate3.mapping.lim.bl.pom.nested.components.impl.P [select p.s.i from com.finantix.engineering.tests.hibernate3.mapping.lim.bl.pom.nested.components.impl.P p ]
at org.hibernate.persister.entity.AbstractPropertyMapping.throwPropertyException(AbstractPropertyMapping.java:43)
at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:37)
at org.hibernate.persister.entity.BasicEntityPersister.getSubclassPropertyTableNumber(BasicEntityPersister.java:1111)
at org.hibernate.persister.entity.BasicEntityPropertyMapping.toColumns(BasicEntityPropertyMapping.java:31)
at org.hibernate.persister.entity.BasicEntityPersister.toColumns(BasicEntityPersister.java:1086)
at org.hibernate.hql.ast.FromElementType.toColumns(FromElementType.java:298)
at org.hibernate.hql.ast.FromElement.toColumns(FromElement.java:353)
at org.hibernate.hql.ast.DotNode.getColumns(DotNode.java:91)
at org.hibernate.hql.ast.DotNode.initText(DotNode.java:200)
at org.hibernate.hql.ast.DotNode.resolve(DotNode.java:181)
at org.hibernate.hql.ast.FromReferenceNode.resolve(FromReferenceNode.java:87)
at org.hibernate.hql.ast.FromReferenceNode.resolve(FromReferenceNode.java:83)
at org.hibernate.hql.ast.DotNode.resolveSelectExpression(DotNode.java:534)
at org.hibernate.hql.ast.HqlSqlWalker.resolveSelectExpression(HqlSqlWalker.java:474)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExpr(HqlSqlBaseWalker.java:1527)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExprList(HqlSqlBaseWalker.java:1467)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectClause(HqlSqlBaseWalker.java:1041)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:380)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:201)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:151)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:884)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:834)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at com.finantix.foundation.connector.hibernate3.actions.Query.performQuery(Query.java:58)
at com.finantix.foundation.connector.hibernate3.actions.Query.performQuery(Query.java:26)
at com.finantix.engineering.tests.hibernate3.mapping.lim.hibernate3.bc.impl.MappingInteractionImpl.doSvcLoadPs$$(MappingInteractionImpl.java:24)
at com.finantix.engineering.tests.hibernate3.mapping.lim.core.bc.MappingInteractionImpl.execute(MappingInteractionImpl.java:36)
at com.finantix.foundation.connector.ConnectorDispatcher.execute(ConnectorDispatcher.java:117)
at com.finantix.foundation.connector.ConnectorDispatcher.execute(ConnectorDispatcher.java:55)
at com.finantix.foundation.interaction.InteractionManager.interactionExecute(InteractionManager.java:28)
at com.finantix.engineering.tests.hibernate3.mapping.ker.nested.components.SvcImpl.loadPs$com£finantix£stdlib£lang£Collection$com£finantix£stdlib£lang£ID$(SvcImpl.java:45)
at com.finantix.test.engineering.hibernate3.mapping.nested.components.Main.main(Main.java:20)

It looks like the nested property "i" is seen as a property of P instead of as a property of S. Does it make sense? Is it a bug?

TIA


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.