-->
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: Problem with AddJoin.
PostPosted: Mon Mar 31, 2008 7:49 pm 
Newbie

Joined: Fri Jul 20, 2007 5:09 am
Posts: 5
Location: Pune, India
Hibernate version:1.2.0.4000

I have two classes - JobProcess and ProcessStepTemplate

Mapping documents:

<class name="PB.DPPConnector.DFWorks.JobProcess, PB.DPPConnector.DFWorks" table="PROCESS_STEP_REQUEST">
<id name="Id" column="ID">
<generator class="native" />
</id>
<property name="Name" column="STEPID" />
<property name="TotalCount" column="TOTALPIECES" />
<property name="FinishedCount" column="PIECESFINISHED" />
<many-to-one name="ProcessStepTemplate" column="PSTEMPLATEIDFK" class="PB.DPPConnector.DFWorks.ProcessStepTemplate, PB.DPPConnector.DFWorks"
not-null="true" />
</class>

<class name="PB.DPPConnector.DFWorks.ProcessStepTemplate, PB.DPPConnector.DFWorks" table="PROCESS_APPLICABILITY">
<id name="Id" column="ID">
<generator class="native" />
</id>
<many-to-one name="JobType" column="JOBTYPEIDFK" class="PB.DPPConnector.DFWorks.JobType, PB.DPPConnector.DFWorks" unique="true" />
</class>


Now I want to fetch them using a sql query, which is like -
Code:
string select = "select jp.ID, jp.STEPID, jp.TOTALPIECES, jp.PIECESFINISHED, jp.PSTEMPLATEIDFK, pst.ID";
            string from = "from PROCESS_STEP_REQUEST {jp}, PROCESS_STEP_TEMPLATE {pst}";
            string where = "where jp.PSTEMPLATEIDFK = pst.ID and {jp}.MAILRUNIDFK = ?";
            string query = String.Format("{0} {1} {2}", select, from, where);

            IList<JobProcess> processes = session.CreateSQLQuery(query)
                .AddEntity("jp", typeof(JobProcess))
                .AddJoin("pst", "jp.ProcessStepTemplate")
                .SetParameter(0, jobTicket.Id).List<JobProcess>();


but I get the following error - "could not execute query ... Positional parameters 0 1000001".

I've tried to write this query in many ways, but I've failed. I have to use a SQL query because one of my entities is not mapped to any of the tables (because no such table is present).

Please help. I tried searching the forum too, but could not resolve my problem.

Thx in advance.


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.