think You have to specify that the OQL contains pure SQL, like mentioned in the Castor FAQ (http://castor.exolab.org/jdo-faq.html#OQL):
Can I write a pass-thru OQL?
Yes. Just put "CALL SQL" keywords in front of your SQL statement. For example,
OQLQuery oql = castorDb.getOQLQuery(
"CALL SQL SELECT id, name, date "+
"FROM user WHERE upper(name) like $1 AS myapp.Product");
In Your case:
fRechercherParIdOql = fDb.getOQLQuery ("CALL SQL SELECT T_Indic_TypeService_seq.NEXTVAL FROM dual");
Regards,
Michael
At 10:13 19.09.2003 +0200, you wrote:
Hello,
My problem is as follows: seek of a number of sequence to carry out an
importation of data in a table. I seek to recover the number of the sequence
` T_Indic_TypeService_seq' which I created on the table `
T_Indic_TypeService'. The creation of the sequence occurred well: here order
SQL: 'CREATE SEQUENCE T_Indic_TypeService_seq INCREMENT BY 1 START WITH 1
MAXVALUE 999999999999999999999999999 MINVALUE 1 NOCYCLE CACHE 20
ORDER;'
The definition of the table is as follows in the file of mapping:
<!-- Mapping for IndicTypeService -->
<key-generator name="SEQUENCE">
<param name="returning" value="true"/>
</key-generator>
<class
name="i2.application.isoard.integration.referentiel.IndicTypeServiceData"
identity="id" key-generator="SEQUENCE">
<cache-type type="unlimited"/>
<description>IndicTypeService</description>
<map-to table="T_Indic_TypeService" />
<field name="id" type="string" >
<sql name="T_Indic_TypeService_ID" type="integer"/>
</field>
<field name="typeServiceData"
type="i2.application.isoard.integration.referentiel.TypeServiceData" >
<sql name="T_TypeService_ID" />
</field>
<field name="indicateurData"
type="i2.application.isoard.integration.referentiel.IndicateurData" >
<sql name="T_Indicateur_ID" />
</field>
</class>
Moreover, I have defines a class Java ` DualDAO' where I implemented the
method ` selectSequenceDual' which must enable me to recover the number of
sequence. Here the body of the method:
public String selectSequenceDual() throws ErreurTechnique{
QueryResults fResults;
Database fDb;
Vector fListe;
OQLQuery fRechercherParIdOql;
try {
fListe = new Vector();
fDb =
((CastorDatabaseManager)CastorDatabaseManager.Init()).newDatabase();
fDb.begin();
fRechercherParIdOql = fDb.getOQLQuery( "SELECT
T_Indic_TypeService.indic_typeService_id_seq.NEXTVAL FROM " +
fDataClass.getName());
fResults = fRechercherParIdOql.execute();
while ( fResults.hasMore() ) {
fListe.add(fResults.next());
}
fDb.commit();
fDb.close();
}
catch(org.exolab.castor.jdo.PersistenceException exp){
log4j.error("classe DualDAO : methode selectSequenceDual", exp);
throw new
ErreurTechnique("erreur.integration.rechercherTousPour",exp.getMessage());
}
return (String)fListe.elementAt(fListe.size());
}
At the time of the execution, the method plants on the order of the research
of the OQL: fRechercherParIdOql = fDb.getOQLQuery( "SELECT
T_Indic_TypeService.indic_typeService_id_seq.NEXTVAL FROM " +
fDataClass.getName());
Here the error message: An unknown field was requested:
T_Indic_TypeService.indic_typeService_id_seq.NEXTVAL
(i2.application.isoard.integration.commun.DualData AS sys.dual)
How to solve this problem?. Can I launch an order OQL by using ` SELECT
xxx.NEXTVAL FROM DUAL'?. I use the version of Castor-0.9.3.9.
Thank you for your assistance.
>Fabienne Guilbaut
>DGTI
>CETE Normandie Centre
>* 02 35 68 81 00 poste 83 58
>Fax 02 35 68 82 97
> * [EMAIL PROTECTED]
* [EMAIL PROTECTED]
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
