GREAT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

This was the problem. I didn't know this about the multi column primary
keys. I just changed the database mapping as you described and it works
!!!!!!!!

YOU SAVED MY WEEKEND !!!!!

Thank you,
Konni




Ralf Joachim-2 wrote:
> 
> Hi Konni,
> 
> in your mapping you defined that AUFN is your primary key.
> 
> <class name="bestellung.EDILBEPO" identity="AUFN">
> 
> This have to match with the constraints of the table in your database.
> 
> Castor also supports multi column primary keys but you have to be aware 
> that you can not change values of primary key columns nor can this 
> columns be references to other mapped objects.
> 
> <class name="bestellung.EDILBEPO" identity="FINR AUFN POS">
> 
> It is very likely that this is the reason of your problem.
> 
> Regards
> Ralf
> 
> 
> Konni schrieb:
>> Another attempt ...
>> 
>> Do you think the AccessMode could be the problem ? I just received the
>> SQL
>> statement with the getSQL() method of the OQLQueryImpl. It shows the
>> following:
>> 
>> SELECT .... FROM EDILBEPO WHERE (EDILBEPO.EPFINR = ?1 AND EDILBEPO.EPAUFN
>> =
>> ?2) FOR UPDATE
>> 
>> Maybe I need a unique key in my table for the FOR UPDATE ? I don't have a
>> unique key. Maybe this is the reason why I can only fetch the first
>> record
>> of the recordset ?
>> 
>> BR,
>> Konni
>> 
>> 
>> 
>> Ralf Joachim-2 wrote:
>>> Hi Konni,
>>>
>>> I use Castor myself in quite some projects and have never seen these 
>>> kind of problem wether on mysql, postgresql, sapdb, hsql nor oracle. As 
>>> far as I know it is the same with Werner how have also tested Castor 
>>> with some other database engines. Therefore his and my guess if it may 
>>> be related to the database driver. Another option would be a problem in 
>>> the database specific part of Castor. Having said that I never needed to 
>>> pass scrollable parameter to the query.execute(...) method as it always 
>>> worked out of the box.
>>>
>>> My problem is that I do not have experience nor access to db/2 
>>> especially not on AS400. So I am not able to debug myself to find out 
>>> the reason of the problem.
>>>
>>> To your questions. SimpleQueryExecutor is used internally to execute 
>>> simple queries in some situations. OQLQuery is an interface and 
>>> OQLQueryImpl its only implementation.
>>>
>>> Have you tried to load the objects with db.load(...) as a test if Castor 
>>> can load the objects?
>>>
>>> Regards
>>> Ralf
>>>
>>>
>>> Konni schrieb:
>>>> I'm using the latest version of the JDBC driver for AS400. I just
>>>> downloaded
>>>> it from jt400.sourceforge.net. But I don't know any details about the
>>>> JDBC
>>>> specs of this driver. But I already used this driver with normal JDBC
>>>> connections and the resultsets are scrollable by default. So I don't
>>>> know
>>>> why there is a problem between this driver and Castor JDO. Are there
>>>> any
>>>> workarounds ? What about OQLQueryImpl or SimpleQueryExecutor ? What is
>>>> the
>>>> difference to OQLQuery ?
>>>>
>>>> BR,
>>>> Konni
>>>>
>>>>
>>>>
>>>>
>>>> Werner Guttmann wrote:
>>>>> Could this actually be a problem of the JDBC driver for DB2 on AS400 ? 
>>>>> What version of the JDBC driver are you using for DB2, and what
>>>>> version 
>>>>> of the JDBC spec does it actually implement ?
>>>>>
>>>>> Werner
>>>>>
>>>>> Konni wrote:
>>>>>> I have some new information.
>>>>>>
>>>>>> I coded the result.size() after the first result.next() operation.
>>>>>> Now
>>>>>> I
>>>>>> get
>>>>>> the correct size of the resultset (3 records). But when I code a
>>>>>> result.hasMore() directly after the first result.next() then I get
>>>>>> false.
>>>>>>
>>>>>> I think this means that the resultset doesn't seem to be scrollable.
>>>>>> I
>>>>>> already tried the OQLQueryImpl with the option true, but this also
>>>>>> doesn't
>>>>>> work.
>>>>>>
>>>>>> Any thoughts ?
>>>>>>
>>>>>> BR,
>>>>>> Konni
>>>>>>
>>>>>>
>>>>>>
>>>>>> Konni wrote:
>>>>>>> ooopps, the rest of my reply hes been ignored. Here is my mapping
>>>>>>> file
>>>>>>> again:
>>>>>>>
>>>>>>> <mapping>
>>>>>>> <description>Mapping zur DATEI EDILBEPO</description>
>>>>>>>
>>>>>>> <class name="bestellung.EDILBEPO" identity="AUFN">
>>>>>>>     <map-to table="EDILBEPO" />
>>>>>>>
>>>>>>>     <field name="FINR" type="big-decimal" >
>>>>>>>       <sql name="EPFINR" type="numeric"/>
>>>>>>>     </field>
>>>>>>>         <field name="AUFN" type="big-decimal" >
>>>>>>>       <sql name="EPAUFN" type="numeric"/>
>>>>>>>     </field>
>>>>>>>         <field name="POS" type="big-decimal" >
>>>>>>>       <sql name="EPPOS" type="numeric"/>
>>>>>>>     </field>
>>>>>>>         <field name="BMENG" type="big-decimal" >
>>>>>>>       <sql name="EPBMENG" type="numeric"/>
>>>>>>>     </field>
>>>>>>>         <field name="WDATU" type="big-decimal" >
>>>>>>>       <sql name="EPWDATU" type="numeric"/>
>>>>>>>     </field>
>>>>>>>     <field name="ARTND" type="string" >
>>>>>>>       <sql name="EPARTND" type="char"/>
>>>>>>>     </field>
>>>>>>>     <field name="BEZGD" type="string" >
>>>>>>>       <sql name="EPBEZGD" type="char"/>
>>>>>>>     </field>
>>>>>>>         <field name="ARTNL" type="string" >
>>>>>>>       <sql name="EPARTNL" type="char"/>
>>>>>>>     </field>
>>>>>>>         <field name="BEZGL" type="string" >
>>>>>>>       <sql name="EPBEZGL" type="char"/>
>>>>>>>     </field>
>>>>>>>         <field name="PTXT" type="string" >
>>>>>>>       <sql name="EPPTXT" type="char"/>
>>>>>>>     </field>
>>>>>>>
>>>>>>>   </class>
>>>>>>>  
>>>>>>> </mapping>
>>>>>>>
>>>>>>>
>>>>>>> Konni wrote:
>>>>>>>> Here is my answer:
>>>>>>>>
>>>>>>>> which version of Castor do you use?
>>>>>>>> castor-1.1.2.1
>>>>>>>>
>>>>>>>> which database, database version, driver and driver version do you
>>>>>>>> use?
>>>>>>>> here is my jdo_config.xml with the requested information:
>>>>>>>>
>>>>>>>> <?xml version="1.0"?>
>>>>>>>>   <jdo-conf name="Castor JDO Konfiguration">
>>>>>>>>      
>>>>>>>>         <database name="DENTAL" engine="db2">
>>>>>>>>         <driver class-name="com.ibm.as400.access.AS400JDBCDriver"
>>>>>>>>                 url="jdbc:as400://server/lib">
>>>>>>>>            user"/>
>>>>>>>>            pwd"/>
>>>>>>>>         </driver>
>>>>>>>>         <mapping href="Mapping_EDILBEKO.xml"/>
>>>>>>>>        <mapping href="Mapping_EDILBEPO.xml"/>
>>>>>>>>      </database>
>>>>>>>>         
>>>>>>>>      <transaction-demarcation mode="local"/>
>>>>>>>>   </jdo-conf>
>>>>>>>>
>>>>>>>>
>>>>>>>> do your EDILBEPO class have a identity defined in mapping?
>>>>>>>> here is the mapping:
>>>>>>>>
>>>>>>>> <mapping>
>>>>>>>> <description>Mapping zur DATEI EDILBEPO</description>
>>>>>>>>
>>>>>>>> <class name="bestellung.EDILBEPO" identity="AUFN">
>>>>>>>>     <map-to table="EDILBEPO" />
>>>>>>>>
>>>>>>>>     <field name="FINR" type="big-decimal" >
>>>>>>>>       <sql name="EPFINR" type="numeric"/>
>>>>>>>>     </field>
>>>>>>>>        <field name="AUFN" type="big-decimal" >
>>>>>>>>       <sql name="EPAUFN" type="numeric"/>
>>>>>>>>     </field>
>>>>>>>>        <field name="POS" type="big-decimal" >
>>>>>>>>       <sql name="EPPOS" type="numeric"/>
>>>>>>>>     </field>
>>>>>>>>        <field name="BMENG" type="big-decimal" >
>>>>>>>>       <sql name="EPBMENG" type="numeric"/>
>>>>>>>>     </field>
>>>>>>>>        <field name="WDATU" type="big-decimal" >
>>>>>>>>       <sql name="EPWDATU" type="numeric"/>
>>>>>>>>     </field>
>>>>>>>>     <field name="ARTND" type="string" >
>>>>>>>>       <sql name="EPARTND" type="char"/>
>>>>>>>>     </field>
>>>>>>>>     <field name="BEZGD" type="string" >
>>>>>>>>       <sql name="EPBEZGD" type="char"/>
>>>>>>>>     </field>
>>>>>>>>        <field name="ARTNL" type="string" >
>>>>>>>>       <sql name="EPARTNL" type="char"/>
>>>>>>>>     </field>
>>>>>>>>        <field name="BEZGL" type="string" >
>>>>>>>>       <sql name="EPBEZGL" type="char"/>
>>>>>>>>     </field>
>>>>>>>>        <field name="PTXT" type="string" >
>>>>>>>>       <sql name="EPPTXT" type="char"/>
>>>>>>>>     </field>
>>>>>>>>
>>>>>>>>   </class>
>>>>>>>>  
>>>>>>>> </mapping>
>>>>>>>>
>>>>>>>> do you use Castor caching for EDILBEPO?
>>>>>>>> no
>>>>>>>>
>>>>>>>> does EDILBEPO implement Timestampable interface?
>>>>>>>> no
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Ralf Joachim-2 wrote:
>>>>>>>>> Hi Konni,
>>>>>>>>>
>>>>>>>>> I've never seen that problem. Please give us some more info to get
>>>>>>>>> an 
>>>>>>>>> idea of what may be going wrong.
>>>>>>>>>
>>>>>>>>> which version of Castor do you use?
>>>>>>>>> which database, database version, driver and driver version do you
>>>>>>>>> use?
>>>>>>>>> do your EDILBEPO class have a identity defined in mapping?
>>>>>>>>> do you use Castor caching for EDILBEPO?
>>>>>>>>> does EDILBEPO implement Timestampable interface?
>>>>>>>>>
>>>>>>>>> Regards
>>>>>>>>> Ralf
>>>>>>>>>
>>>>>>>>> Konni schrieb:
>>>>>>>>>> I have 3 records with the same FINR and AUFN in my table
>>>>>>>>>> EDILBEPO.
>>>>>>>>>> When
>>>>>>>>>> I
>>>>>>>>>> read the resultset, I only get the first record. What could be
>>>>>>>>>> wrong
>>>>>>>>>> ?
>>>>>>>>>> The
>>>>>>>>>> result_p.size() ended in a PersistenceException: Cursor not in a
>>>>>>>>>> valid
>>>>>>>>>> state.
>>>>>>>>>>
>>>>>>>>>> Here is the code:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>               // Positionen verarbeiten
>>>>>>>>>>               oql_p = db.getOQLQuery("SELECT P FROM
>>>>>>>>>> bestellung.EDILBEPO
>>>>>>>>>> P
>>>>>>>>>> WHERE P.FINR=$1 AND P.AUFN=$2");
>>>>>>>>>>               oql_p.bind(new BigDecimal(finr));
>>>>>>>>>>               oql_p.bind(new BigDecimal(aufnr));
>>>>>>>>>>
>>>>>>>>>>               result_p = oql_p.execute();
>>>>>>>>>>               // System.out.println("Anzahl Positionen: " +
>>>>>>>>>> result_p.size());
>>>>>>>>>>               while (result_p.hasMore()) {
>>>>>>>>>>                     bepo = (EDILBEPO) result_p.next();
>>>>>>>>>>                     eppos = bepo.getPOS();
>>>>>>>>>>                     epbmeng = bepo.getBMENG();
>>>>>>>>>>                     epwdatu = bepo.getWDATU();
>>>>>>>>>>                     epartnd = bepo.getARTND();
>>>>>>>>>>                     epbezgd = bepo.getBEZGD();
>>>>>>>>>>                     epartnl = bepo.getARTNL();
>>>>>>>>>>                     epbezgl = bepo.getBEZGL();
>>>>>>>>>>                     epptxt = bepo.getPTXT();
>>>>>>>>>>                     .
>>>>>>>>>>                     .
>>>>>>>>>>                     .
>>>>>>>>>>                     }
>>>>>>>>> -- 
>>>>>>>>>
>>>>>>>>> Syscon Ingenieurbüro für Meß- und Datentechnik GmbH
>>>>>>>>> Ralf Joachim
>>>>>>>>> Raiffeisenstraße 11
>>>>>>>>> 72127 Kusterdingen
>>>>>>>>> Germany
>>>>>>>>>
>>>>>>>>> Tel.   +49 7071 3690 52
>>>>>>>>> Mobil: +49 173 9630135
>>>>>>>>> Fax    +49 7071 3690 98
>>>>>>>>>
>>>>>>>>> Internet: www.syscon.eu
>>>>>>>>> E-Mail: [EMAIL PROTECTED]
>>>>>>>>>
>>>>>>>>> Sitz der Gesellschaft: D-72127 Kusterdingen
>>>>>>>>> Registereintrag: Amtsgericht Stuttgart, HRB 382295
>>>>>>>>> Geschäftsleitung: Jens Joachim, Ralf Joachim
>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe from this list please visit:
>>>>>>>>>
>>>>>>>>>     http://xircles.codehaus.org/manage_email
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe from this list please visit:
>>>>>
>>>>>     http://xircles.codehaus.org/manage_email
>>>>>
>>>>>
>>>>>
>>> -- 
>>>
>>> Syscon Ingenieurbüro für Meß- und Datentechnik GmbH
>>> Ralf Joachim
>>> Raiffeisenstraße 11
>>> 72127 Kusterdingen
>>> Germany
>>>
>>> Tel.   +49 7071 3690 52
>>> Mobil: +49 173 9630135
>>> Fax    +49 7071 3690 98
>>>
>>> Internet: www.syscon.eu
>>> E-Mail: [EMAIL PROTECTED]
>>>
>>> Sitz der Gesellschaft: D-72127 Kusterdingen
>>> Registereintrag: Amtsgericht Stuttgart, HRB 382295
>>> Geschäftsleitung: Jens Joachim, Ralf Joachim
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list please visit:
>>>
>>>     http://xircles.codehaus.org/manage_email
>>>
>>>
>>>
>> 
> 
> -- 
> 
> Syscon Ingenieurbüro für Meß- und Datentechnik GmbH
> Ralf Joachim
> Raiffeisenstraße 11
> 72127 Kusterdingen
> Germany
> 
> Tel.   +49 7071 3690 52
> Mobil: +49 173 9630135
> Fax    +49 7071 3690 98
> 
> Internet: www.syscon.eu
> E-Mail: [EMAIL PROTECTED]
> 
> Sitz der Gesellschaft: D-72127 Kusterdingen
> Registereintrag: Amtsgericht Stuttgart, HRB 382295
> Geschäftsleitung: Jens Joachim, Ralf Joachim
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
> 
>     http://xircles.codehaus.org/manage_email
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Only-one-result-from-resultset-tf4645829.html#a13292598
Sent from the Castor - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to