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.  [ 2 posts ] 
Author Message
 Post subject: Fetch collection of collections
PostPosted: Tue Feb 27, 2007 12:44 pm 
Newbie

Joined: Tue Feb 27, 2007 12:31 pm
Posts: 8
Location: nyc
it seems i can't do a fetch on a one-to-many relation of a setup of objects that were fetched using a one to many from the parent. why?

if you look at the HQL below, i am doing a fetch on a one-to-many relationship from the base object Fund (f.classes set of type FundClass) and am then attempting to fetch a one-to-many relationship on those objects (f.classes.series is a set of type Series)

is there an alternative way to structure this query?

Hibernate version:
3.2.1

Mapping documents:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
  <class table="Fund" name="com.fds.white.Fund">
    <id unsaved-value="-1" access="property" name="id">
      <generator class="native"/>
    </id>
    <many-to-one column="parentCo" lazy="proxy" access="property" name="parentCompany"/>
    <property name="client" access="property"/>
    <property name="name" access="property"/>
    <property name="baseCurrency" access="property"/>
    <property name="domicile" access="property"/>
    <property name="fiscalYearEnd" access="property"/>
    <property name="objectStartDate" access="property"/>
    <property name="historicalDataStart" access="property"/>
    <property name="incDate" access="property"/>
    <component name="authShareOrCapital" access="property">
      <property name="strNumber" access="property" column="authShareOrCapitalAmt"/>
    </component>
    <property name="sharesNumberOfDecimals" access="property"/>
    <property name="navNumberOfDecimals" access="property"/>
    <property name="erisaInvestors" access="property"/>
    <property name="deminimusRule" access="property"/>
    <property name="exemptionStatus" access="property"/>
    <property name="formOfEntity" access="property"/>
    <property name="freqEstimates" access="property"/>
    <property name="freqFinal" access="property"/>
    <property name="incentiveFeeCalc" access="property"/>
    <property name="relationship" access="property"/>
    <many-to-one not-null="false" column="principalOffice" lazy="false" access="property" cascade="all" name="principal"/>
    <many-to-one not-null="false" column="registeredOffice" lazy="false" access="property" cascade="all" name="registered"/>
    <set access="property" lazy="true" inverse="true" sort="natural" cascade="all" name="valuationPeriods">
      <key column="parentFund"/>
      <one-to-many class="com.fds.white.Period"/>
    </set>
    <property name="redemptionMethod" access="property"/>
    <property name="voided" access="property"/>
    <joined-subclass name="com.fds.white.FundClassHolding" table="ClassHoldingFund">
      <key/>
      <set access="property" lazy="true" inverse="true" cascade="all" name="classes">
        <key column="parentFund"/>
        <one-to-many class="com.fds.white.FundClass"/>
      </set>
      <joined-subclass name="com.fds.white.EqualizationFund" table="EQFund">
        <key/>
      </joined-subclass>
      <joined-subclass name="com.fds.white.SeriesOfSharesFund" table="SoSFund">
        <key/>
      </joined-subclass>
    </joined-subclass>
    <joined-subclass name="com.fds.white.PartnershipFund" table="PartnerFund">
      <key/>
      <set access="property" lazy="true" inverse="true" cascade="all" name="sidePockets">
        <key column="parentPF"/>
        <one-to-many class="com.fds.white.SidePocket"/>
      </set>
      <joined-subclass name="com.fds.white.NonTranchingPartnershipFund" table="NonTPFund">
        <key/>
        <set access="property" lazy="true" inverse="true" cascade="all" name="partners">
          <key column="parentPartnershipFund"/>
          <one-to-many class="com.fds.white.Partner"/>
        </set>
      </joined-subclass>
      <joined-subclass name="com.fds.white.TranchingPartnershipFund" table="TPFund">
        <key/>
        <set access="property" lazy="true" inverse="true" cascade="all" name="tranches">
          <key column="parentPartnershipFund"/>
          <one-to-many class="com.fds.white.Tranche"/>
        </set>
      </joined-subclass>
    </joined-subclass>
  </class>
</hibernate-mapping>


<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
  <class table="FundClass" name="com.fds.white.FundClass">
    <id unsaved-value="-1" access="property" name="id">
      <generator class="native"/>
    </id>
    <set access="property" lazy="true" inverse="true" cascade="all" name="series">
      <key column="fundClass"/>
      <one-to-many class="com.fds.white.Series"/>
    </set>
    <property name="name" access="property"/>
    <many-to-one not-null="false" column="parentFund" lazy="proxy" access="property" name="parent"/>
    <many-to-one not-null="false" column="parentSidePocket" lazy="proxy" access="property" name="parentSidePocket"/>
    <property name="currency" access="property"/>
    <many-to-one not-null="false" column="roll_to_series" lazy="false" access="property" name="rollToSeries"/>
    <property name="hotPL" access="property"/>
    <property name="longName" access="property"/>
    <property name="externalID" access="property"/>
    <one-to-one name="feeParameters" cascade="all" property-ref="parentFC" access="property"/>
    <one-to-one name="termParameters" cascade="all" property-ref="parentFC" access="property"/>
    <property name="voided" access="property"/>
  </class>
</hibernate-mapping>


<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
  <class table="Investable" name="com.fds.white.InvestableEntity">
    <id unsaved-value="-1" access="property" name="id">
      <generator class="native"/>
    </id>
    <property name="name" access="property"/>
    <property name="longName" access="property"/>
    <one-to-one name="feeParameters" cascade="all" property-ref="parentIE" access="property"/>
    <one-to-one name="termParameters" cascade="all" property-ref="parentIE" access="property"/>
    <set access="property" lazy="true" inverse="true" cascade="all" name="lots">
      <key column="fkInvestable"/>
      <one-to-many class="com.fds.white.Lot"/>
    </set>
    <property name="sideletter" access="property"/>
    <property name="initialTradeDate" access="property"/>
    <property name="externalID" access="property"/>
    <joined-subclass name="com.fds.white.Partner" table="Partner">
      <key/>
      <many-to-one not-null="true" column="parentPartnershipFund" lazy="proxy" access="property" name="parentPartnershipFund"/>
      <many-to-one not-null="true" lazy="false" access="property" name="legalEntity"/>
      <property name="hotPL" access="property"/>
      <property name="baseCurrency" access="property"/>
    </joined-subclass>
    <joined-subclass name="com.fds.white.Series" table="Series">
      <key/>
      <many-to-one not-null="true" column="fundClass" lazy="proxy" access="property" name="fundClass"/>
      <set table="Series_AssetValue" access="property" lazy="true" cascade="all" name="assetValues">
        <key column="series_id"/>
        <many-to-many column="av_id" unique="true" class="com.fds.white.AssetValue"/>
      </set>
    </joined-subclass>
    <joined-subclass name="com.fds.white.Tranche" table="Tranche">
      <key/>
      <many-to-one not-null="true" column="parentPartnershipFund" lazy="proxy" access="property" name="parentPartnershipFund"/>
    </joined-subclass>
  </class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
this the hql. the code is just a list();
Code:
"SELECT DISTINCT f " +
            "FROM SeriesOfSharesFund f " +
            "LEFT OUTER JOIN FETCH f.valuationPeriods " +
            "LEFT OUTER JOIN FETCH f.classes " +
            "LEFT OUTER JOIN FETCH f.classes.series " +
            "WHERE f.id=?"


Full stack trace of any exception that occurs:
Code:
org.hibernate.hql.ast.QuerySyntaxException: illegal syntax near collection: series [SELECT DISTINCT f FROM com.fds.white.SeriesOfSharesFund f LEFT OUTER JOIN FETCH f.valuationPeriods LEFT OUTER JOIN FETCH f.classes LEFT OUTER JOIN FETCH f.classes.series WHERE f.id=?]
   at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:31)
   at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:24)
   at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59)
   at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:235)
   at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
   at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
   at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
   at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
   at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
   at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
   at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
   at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
   at com.fds.hibernate.HibernateDAOManager.find(HibernateDAOManager.java:184)
   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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:203)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:162)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:209)
   at $Proxy1.find(Unknown Source)
   at com.fds.white.transactions.modules.subscriptions.Subscriptions.subscribe(Subscriptions.java:70)
   at com.fds.white.transactions.TransactionsImpl.subscribeSOS(TransactionsImpl.java:223)
   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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
   at $Proxy6.subscribeSOS(Unknown Source)
   at com.fds.white.transactions.RemoteTransactions.subscribeSOS(RemoteTransactions.java:38)
   at acceptance.white.remote.transactions.RemoteSOSSubscription.testRemoteSOSSubscription(RemoteSOSSubscription.java:15)
   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 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)



Name and version of the database you are using:
Sybase ASE 12.5

The generated SQL (show_sql=true):
none generated. parser probelm:
Code:
11:37:39,230 main ERROR PARSER:33 -  illegal syntax near collection: series


Debug level Hibernate log excerpt:
Code:
11:43:39,347 main DEBUG SessionImpl:220 - opened session at timestamp: 4802947560845312
11:43:39,354 main DEBUG ConnectionManager:415 - opening JDBC connection
11:43:39,359 main DEBUG DriverManagerConnectionProvider:93 - total checked-out connections: 0
11:43:39,364 main DEBUG DriverManagerConnectionProvider:99 - using pooled JDBC connection, pool size: 0
11:43:39,382 main DEBUG JDBCTransaction:54 - begin
11:43:39,388 main DEBUG JDBCTransaction:59 - current autocommit status: false
11:43:39,393 main DEBUG JDBCContext:210 - after transaction begin
11:43:39,400 main DEBUG QueryPlanCache:70 - unable to locate HQL query plan in cache; generating (SELECT DISTINCT f FROM SeriesOfSharesFund f LEFT OUTER JOIN FETCH f.valuationPeriods LEFT OUTER JOIN FETCH f.classes LEFT OUTER JOIN FETCH f.classes.series WHERE f.id=?)
11:43:39,416 main DEBUG QueryTranslatorImpl:246 - parse() - HQL: SELECT DISTINCT f FROM com.fds.white.SeriesOfSharesFund f LEFT OUTER JOIN FETCH f.valuationPeriods LEFT OUTER JOIN FETCH f.classes LEFT OUTER JOIN FETCH f.classes.series WHERE f.id=?
11:43:39,475 main DEBUG AST:266 - --- HQL AST ---
\-[QUERY] 'query'
    +-[SELECT_FROM] 'SELECT_FROM'
    |  +-[FROM] 'FROM'
    |  |  +-[RANGE] 'RANGE'
    |  |  |  +-[DOT] '.'
    |  |  |  |  +-[DOT] '.'
    |  |  |  |  |  +-[DOT] '.'
    |  |  |  |  |  |  +-[IDENT] 'com'
    |  |  |  |  |  |  \-[IDENT] 'fds'
    |  |  |  |  |  \-[IDENT] 'white'
    |  |  |  |  \-[IDENT] 'SeriesOfSharesFund'
    |  |  |  \-[ALIAS] 'f'
    |  |  +-[JOIN] 'JOIN'
    |  |  |  +-[LEFT] 'LEFT'
    |  |  |  +-[OUTER] 'OUTER'
    |  |  |  +-[FETCH] 'FETCH'
    |  |  |  \-[DOT] '.'
    |  |  |     +-[IDENT] 'f'
    |  |  |     \-[IDENT] 'valuationPeriods'
    |  |  +-[JOIN] 'JOIN'
    |  |  |  +-[LEFT] 'LEFT'
    |  |  |  +-[OUTER] 'OUTER'
    |  |  |  +-[FETCH] 'FETCH'
    |  |  |  \-[DOT] '.'
    |  |  |     +-[IDENT] 'f'
    |  |  |     \-[IDENT] 'classes'
    |  |  \-[JOIN] 'JOIN'
    |  |     +-[LEFT] 'LEFT'
    |  |     +-[OUTER] 'OUTER'
    |  |     +-[FETCH] 'FETCH'
    |  |     \-[DOT] '.'
    |  |        +-[DOT] '.'
    |  |        |  +-[IDENT] 'f'
    |  |        |  \-[IDENT] 'classes'
    |  |        \-[IDENT] 'series'
    |  \-[SELECT] 'SELECT'
    |     +-[DISTINCT] 'DISTINCT'
    |     \-[IDENT] 'f'
    \-[WHERE] 'WHERE'
       \-[EQ] '='
          +-[DOT] '.'
          |  +-[IDENT] 'f'
          |  \-[IDENT] 'id'
          \-[PARAM] '?'

11:43:39,483 main DEBUG ErrorCounter:68 - throwQueryException() : no errors
11:43:39,489 main DEBUG HqlSqlBaseWalker:111 - select << begin [level=1, statement=select]
11:43:39,497 main DEBUG FromElement:105 - FromClause{level=1} :  com.fds.white.SeriesOfSharesFund (f) -> seriesofsh0_
11:43:39,506 main DEBUG FromReferenceNode:51 - Resolved :  f -> seriesofsh0_.SeriesOfSharesFund
11:43:39,513 main DEBUG DotNode:541 - getDataType() : valuationPeriods -> org.hibernate.type.SortedSetType(com.fds.white.Fund.valuationPeriods)
11:43:39,519 main DEBUG FromElementFactory:360 - createEntityAssociation() : One to many - path = f.valuationPeriods role = com.fds.white.Fund.valuationPeriods associatedEntityName = com.fds.white.Period
11:43:39,526 main DEBUG FromElement:105 - FromClause{level=1} :  com.fds.white.Period (no alias) -> valuationp1_
11:43:39,533 main DEBUG FromClause:233 - addJoinByPathMap() : f.valuationPeriods -> Period valuationp1_
11:43:39,542 main DEBUG DotNode:265 - dereferenceCollection() : Created new FROM element for f.valuationPeriods : Period valuationp1_
11:43:39,552 main DEBUG FromReferenceNode:51 - Resolved :  f.valuationPeriods -> .
11:43:39,565 main DEBUG HqlSqlWalker:330 - createFromJoinElement() : -- join tree --
\-[JOIN_FRAGMENT] FromElement: 'Period valuationp1_' FromElement{explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=null,role=com.fds.white.Fund.valuationPeriods,tableName=Period,tableAlias=valuationp1_,origin=SoSFund seriesofsh0_,colums={seriesofsh0_.SeriesOfSharesFund ,className=com.fds.white.Period}}

11:43:39,573 main DEBUG FromReferenceNode:51 - Resolved :  f -> seriesofsh0_.SeriesOfSharesFund
11:43:39,581 main DEBUG DotNode:541 - getDataType() : classes -> org.hibernate.type.SetType(com.fds.white.FundClassHolding.classes)
11:43:39,588 main DEBUG FromElementFactory:360 - createEntityAssociation() : One to many - path = f.classes role = com.fds.white.FundClassHolding.classes associatedEntityName = com.fds.white.FundClass
11:43:39,604 main DEBUG FromElement:105 - FromClause{level=1} :  com.fds.white.FundClass (no alias) -> classes2_
11:43:39,612 main DEBUG FromClause:233 - addJoinByPathMap() : f.classes -> FundClass classes2_
11:43:39,619 main DEBUG DotNode:265 - dereferenceCollection() : Created new FROM element for f.classes : FundClass classes2_
11:43:39,626 main DEBUG FromReferenceNode:51 - Resolved :  f.classes -> .
11:43:39,637 main DEBUG HqlSqlWalker:330 - createFromJoinElement() : -- join tree --
\-[JOIN_FRAGMENT] FromElement: 'FundClass classes2_' FromElement{explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=null,role=com.fds.white.FundClassHolding.classes,tableName=FundClass,tableAlias=classes2_,origin=SoSFund seriesofsh0_,colums={seriesofsh0_.SeriesOfSharesFund ,className=com.fds.white.FundClass}}

11:43:39,644 main DEBUG FromReferenceNode:51 - Resolved :  f -> seriesofsh0_.SeriesOfSharesFund
11:43:39,651 main DEBUG DotNode:541 - getDataType() : classes -> org.hibernate.type.SetType(com.fds.white.FundClassHolding.classes)
11:43:39,672 main DEBUG FromElementFactory:360 - createEntityAssociation() : One to many - path = f.classes role = com.fds.white.FundClassHolding.classes associatedEntityName = com.fds.white.FundClass
11:43:39,688 main DEBUG FromElement:105 - FromClause{level=1} :  com.fds.white.FundClass (no alias) -> classes3_
11:43:39,696 main DEBUG FromClause:233 - addJoinByPathMap() : f.classes -> FundClass classes3_
11:43:39,703 main DEBUG DotNode:265 - dereferenceCollection() : Created new FROM element for f.classes : FundClass classes3_
11:43:39,709 main DEBUG FromReferenceNode:51 - Resolved :  f.classes -> .
11:43:39,716 main DEBUG DotNode:541 - getDataType() : series -> org.hibernate.type.SetType(com.fds.white.FundClass.series)
11:43:39,740 main ERROR PARSER:33 -  illegal syntax near collection: series
11:43:39,754 main DEBUG ErrorCounter:28 -  illegal syntax near collection: series
illegal syntax near collection: series
   at org.hibernate.hql.ast.tree.DotNode.checkLhsIsNotCollection(DotNode.java:485)
   at org.hibernate.hql.ast.tree.DotNode.resolve(DotNode.java:199)
   at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:94)
   at org.hibernate.hql.ast.HqlSqlWalker.createFromJoinElement(HqlSqlWalker.java:318)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.joinElement(HqlSqlBaseWalker.java:3275)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3067)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2945)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:544)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
   at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
   at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
   at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
   at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
   at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
   at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
   at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
   at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
   at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
   at com.fds.hibernate.HibernateDAOManager.find(HibernateDAOManager.java:184)
   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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:203)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:162)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:209)
   at $Proxy1.find(Unknown Source)
   at com.fds.white.transactions.modules.subscriptions.Subscriptions.subscribe(Subscriptions.java:70)
   at com.fds.white.transactions.TransactionsImpl.subscribeSOS(TransactionsImpl.java:223)
   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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
   at $Proxy6.subscribeSOS(Unknown Source)
   at com.fds.white.transactions.RemoteTransactions.subscribeSOS(RemoteTransactions.java:38)
   at acceptance.white.remote.transactions.RemoteSOSSubscription.testRemoteSOSSubscription(RemoteSOSSubscription.java:15)
   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 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)
11:43:39,779 main DEBUG FromReferenceNode:51 - Resolved :  f -> seriesofsh0_.SeriesOfSharesFund
11:43:39,786 main DEBUG FromReferenceNode:51 - Resolved :  f -> seriesofsh0_.SeriesOfSharesFund
11:43:39,797 main DEBUG DotNode:541 - getDataType() : id -> org.hibernate.type.LongType@89d4de
11:43:39,809 main DEBUG FromReferenceNode:51 - Resolved :  f.id -> seriesofsh0_.SeriesOfSharesFund
11:43:39,816 main DEBUG HqlSqlBaseWalker:117 - select : finishing up [level=1, statement=select]
11:43:39,824 main DEBUG HqlSqlWalker:516 - processQuery() :  ( SELECT ( {select clause} DISTINCT seriesofsh0_.SeriesOfSharesFund ) ( FromClause{level=1} ( SoSFund seriesofsh0_ Period valuationp1_ FundClass classes2_ FundClass classes3_ ) ) ( WHERE ( = ( seriesofsh0_.SeriesOfSharesFund seriesofsh0_.SeriesOfSharesFund id ) ? ) ) )
11:43:39,836 main DEBUG SyntheticAndFactory:58 - Using WHERE fragment [seriesofsh0_.SeriesOfSharesFund=classes3_.parentFund]
11:43:39,844 main DEBUG JoinProcessor:129 - Using FROM fragment [left outer join FundClass classes2_ on seriesofsh0_.SeriesOfSharesFund=classes2_.parentFund]
11:43:39,854 main DEBUG JoinProcessor:129 - Using FROM fragment [left outer join Period valuationp1_ on seriesofsh0_.SeriesOfSharesFund=valuationp1_.parentFund]
11:43:39,863 main DEBUG JoinProcessor:129 - Using FROM fragment [SoSFund seriesofsh0_ inner join ClassHoldingFund seriesofsh0_1_ on seriesofsh0_.SeriesOfSharesFund=seriesofsh0_1_.FundClassHolding inner join Fund seriesofsh0_2_ on seriesofsh0_.SeriesOfSharesFund=seriesofsh0_2_.id]
11:43:39,869 main DEBUG HqlSqlBaseWalker:123 - select >> end [level=1, statement=select]
11:43:39,916 main DEBUG AST:232 - --- SQL AST ---
\-[SELECT] QueryNode: 'SELECT'  querySpaces (SoSFund,Fund,ClassHoldingFund,FundClass,Period)
    +-[SELECT_CLAUSE] SelectClause: '{select clause}'
    |  +-[DISTINCT] SqlNode: 'DISTINCT'
    |  +-[ALIAS_REF] IdentNode: 'seriesofsh0_.SeriesOfSharesFund as id15_0_' {alias=f, className=com.fds.white.SeriesOfSharesFund, tableAlias=seriesofsh0_}
    |  +-[SELECT_EXPR] SelectExpressionImpl: 'valuationp1_.id as id31_1_' {FromElement{explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=null,role=com.fds.white.Fund.valuationPeriods,tableName=Period,tableAlias=valuationp1_,origin=SoSFund seriesofsh0_ inner join ClassHoldingFund seriesofsh0_1_ on seriesofsh0_.SeriesOfSharesFund=seriesofsh0_1_.FundClassHolding inner join Fund seriesofsh0_2_ on seriesofsh0_.SeriesOfSharesFund=seriesofsh0_2_.id,colums={seriesofsh0_.SeriesOfSharesFund ,className=com.fds.white.Period}}}
    |  +-[SELECT_EXPR] SelectExpressionImpl: 'classes2_.id as id22_2_' {FromElement{explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=null,role=com.fds.white.FundClassHolding.classes,tableName=FundClass,tableAlias=classes2_,origin=SoSFund seriesofsh0_ inner join ClassHoldingFund seriesofsh0_1_ on seriesofsh0_.SeriesOfSharesFund=seriesofsh0_1_.FundClassHolding inner join Fund seriesofsh0_2_ on seriesofsh0_.SeriesOfSharesFund=seriesofsh0_2_.id,colums={seriesofsh0_.SeriesOfSharesFund ,className=com.fds.white.FundClass}}}
    |  +-[SQL_TOKEN] SqlFragment: 'seriesofsh0_2_.parentCo as parentCo15_0_, seriesofsh0_2_.client as client15_0_, seriesofsh0_2_.name as name15_0_, seriesofsh0_2_.baseCurrency as baseCurr5_15_0_, seriesofsh0_2_.domicile as domicile15_0_, seriesofsh0_2_.fiscalYearEnd as fiscalYe7_15_0_, seriesofsh0_2_.objectStartDate as objectSt8_15_0_, seriesofsh0_2_.historicalDataStart as historic9_15_0_, seriesofsh0_2_.incDate as incDate15_0_, seriesofsh0_2_.authShareOrCapitalAmt as authSha11_15_0_, seriesofsh0_2_.sharesNumberOfDecimals as sharesN12_15_0_, seriesofsh0_2_.navNumberOfDecimals as navNumb13_15_0_, seriesofsh0_2_.erisaInvestors as erisaIn14_15_0_, seriesofsh0_2_.deminimusRule as deminim15_15_0_, seriesofsh0_2_.exemptionStatus as exempti16_15_0_, seriesofsh0_2_.formOfEntity as formOfE17_15_0_, seriesofsh0_2_.freqEstimates as freqEst18_15_0_, seriesofsh0_2_.freqFinal as freqFinal15_0_, seriesofsh0_2_.incentiveFeeCalc as incenti20_15_0_, seriesofsh0_2_.relationship as relatio21_15_0_, seriesofsh0_2_.principalOffice as princip22_15_0_, seriesofsh0_2_.registeredOffice as registe23_15_0_, seriesofsh0_2_.redemptionMethod as redempt24_15_0_, seriesofsh0_2_.voided as voided15_0_'
    |  +-[SQL_TOKEN] SqlFragment: 'valuationp1_.posted as posted31_1_, valuationp1_.status as status31_1_, valuationp1_.effectiveDate as effectiv4_31_1_, valuationp1_.parentFund as parentFund31_1_, valuationp1_.rollupId as rollupId31_1_'
    |  +-[SQL_TOKEN] SqlFragment: 'valuationp1_.parentFund as parentFund0__, valuationp1_.id as id0__'
    |  +-[SQL_TOKEN] SqlFragment: 'classes2_.name as name22_2_, classes2_.parentFund as parentFund22_2_, classes2_.parentSidePocket as parentSi4_22_2_, classes2_.currency as currency22_2_, classes2_.roll_to_series as roll6_22_2_, classes2_.hotPL as hotPL22_2_, classes2_.longName as longName22_2_, classes2_.externalID as externalID22_2_, classes2_.voided as voided22_2_'
    |  \-[SQL_TOKEN] SqlFragment: 'classes2_.parentFund as parentFund1__, classes2_.id as id1__'
    +-[FROM] FromClause: 'FROM' FromClause{level=1, fromElementCounter=4, fromElements=4, fromElementByClassAlias=[f], fromElementByTableAlias=[seriesofsh0_, classes2_, valuationp1_, classes3_], fromElementsByPath=[f.classes, f.valuationPeriods], collectionJoinFromElementsByPath=[], impliedElements=[]}
    |  \-[FROM_FRAGMENT] FromElement: 'SoSFund seriesofsh0_ inner join ClassHoldingFund seriesofsh0_1_ on seriesofsh0_.SeriesOfSharesFund=seriesofsh0_1_.FundClassHolding inner join Fund seriesofsh0_2_ on seriesofsh0_.SeriesOfSharesFund=seriesofsh0_2_.id' FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=f,role=null,tableName=SoSFund,tableAlias=seriesofsh0_,origin=null,colums={,className=com.fds.white.SeriesOfSharesFund}}
    |     +-[JOIN_FRAGMENT] FromElement: 'left outer join Period valuationp1_ on seriesofsh0_.SeriesOfSharesFund=valuationp1_.parentFund' FromElement{explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=null,role=com.fds.white.Fund.valuationPeriods,tableName=Period,tableAlias=valuationp1_,origin=SoSFund seriesofsh0_ inner join ClassHoldingFund seriesofsh0_1_ on seriesofsh0_.SeriesOfSharesFund=seriesofsh0_1_.FundClassHolding inner join Fund seriesofsh0_2_ on seriesofsh0_.SeriesOfSharesFund=seriesofsh0_2_.id,colums={seriesofsh0_.SeriesOfSharesFund ,className=com.fds.white.Period}}
    |     +-[JOIN_FRAGMENT] FromElement: 'left outer join FundClass classes2_ on seriesofsh0_.SeriesOfSharesFund=classes2_.parentFund' FromElement{explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=null,role=com.fds.white.FundClassHolding.classes,tableName=FundClass,tableAlias=classes2_,origin=SoSFund seriesofsh0_ inner join ClassHoldingFund seriesofsh0_1_ on seriesofsh0_.SeriesOfSharesFund=seriesofsh0_1_.FundClassHolding inner join Fund seriesofsh0_2_ on seriesofsh0_.SeriesOfSharesFund=seriesofsh0_2_.id,colums={seriesofsh0_.SeriesOfSharesFund ,className=com.fds.white.FundClass}}
    |     \-[FROM_FRAGMENT] ImpliedFromElement: 'FundClass classes3_' ImpliedFromElement{implied,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=null,role=com.fds.white.FundClassHolding.classes,tableName=FundClass,tableAlias=classes3_,origin=SoSFund seriesofsh0_ inner join ClassHoldingFund seriesofsh0_1_ on seriesofsh0_.SeriesOfSharesFund=seriesofsh0_1_.FundClassHolding inner join Fund seriesofsh0_2_ on seriesofsh0_.SeriesOfSharesFund=seriesofsh0_2_.id,colums={seriesofsh0_.SeriesOfSharesFund ,className=com.fds.white.FundClass}}
    \-[WHERE] SqlNode: 'WHERE'
       +-[THETA_JOINS] SqlNode: '{theta joins}'
       |  \-[SQL_TOKEN] SqlFragment: 'seriesofsh0_.SeriesOfSharesFund=classes3_.parentFund'
       \-[EQ] BinaryLogicOperatorNode: '='
          +-[DOT] DotNode: 'seriesofsh0_.SeriesOfSharesFund' {propertyName=id,dereferenceType=4,propertyPath=id,path=f.id,tableAlias=seriesofsh0_,className=com.fds.white.SeriesOfSharesFund,classAlias=f}
          |  +-[ALIAS_REF] IdentNode: 'seriesofsh0_.SeriesOfSharesFund' {alias=f, className=com.fds.white.SeriesOfSharesFund, tableAlias=seriesofsh0_}
          |  \-[IDENT] IdentNode: 'id' {originalText=id}
          \-[PARAM] ParameterNode: '?' {ordinal=0, expectedType=org.hibernate.type.LongType@89d4de}

11:43:39,943 main DEBUG JDBCTransaction:152 - rollback
11:43:39,949 main DEBUG JDBCTransaction:163 - rolled back JDBC Connection
11:43:39,957 main DEBUG JDBCContext:215 - after transaction completion
11:43:39,963 main DEBUG ConnectionManager:296 - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
11:43:39,968 main DEBUG SessionImpl:422 - after transaction completion
11:43:39,976 main DEBUG SessionImpl:273 - closing session
11:43:39,984 main DEBUG ConnectionManager:374 - performing cleanup
11:43:39,990 main DEBUG ConnectionManager:435 - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
11:43:39,995 main DEBUG DriverManagerConnectionProvider:129 - returning connection to pool, pool size: 1
11:43:40,000 main DEBUG JDBCContext:215 - after transaction completion
11:43:40,006 main DEBUG ConnectionManager:296 - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
11:43:40,013 main DEBUG SessionImpl:422 - after transaction completion


Top
 Profile  
 
 Post subject: seems to be a bug
PostPosted: Fri Jun 29, 2007 3:04 pm 
Beginner
Beginner

Joined: Sat Jan 29, 2005 8:49 pm
Posts: 20
according to the manual this is possible. i had a similar problem using 3.2.2.

you can curve around using


Code:
"SELECT DISTINCT f " +
"FROM SeriesOfSharesFund f " +
"LEFT OUTER JOIN FETCH f.valuationPeriods " +
"LEFT OUTER JOIN FETCH f.classes c " +
"LEFT OUTER JOIN FETCH c.series " +
"WHERE f.id=?"


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

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.