hi oleg,
thanks for your help, it works better now : no probs when loading clients
("select c from Client c") ; but i got another exception when trying to get
the products ("select c from Produit c"). i can't retrieve the exact sql
error ("PersistenceException nested error : [..]"). here's the StackTrace :
java.sql.SQLException: Syntax error or access violation: You have an error
in your SQL syntax near 'null promo_prod ON
produit_promotionnel.id=promo_prod.promo_id,produit WHERE pro' at line 1
at org.gjt.mm.mysql.MysqlIO.sendCommand(MysqlIO.java:497)
at org.gjt.mm.mysql.MysqlIO.sqlQueryDirect(MysqlIO.java:550)
at org.gjt.mm.mysql.Connection.execSQL(Connection.java:885)
at
org.gjt.mm.mysql.PreparedStatement.executeQuery(PreparedStatement.java:288)
at org.exolab.castor.jdo.engine.SQLEngine.load(SQLEngine.java:1008)
at org.exolab.castor.persist.ClassMolder.load(ClassMolder.java:646)
at org.exolab.castor.persist.LockEngine.load(LockEngine.java:361)
at
org.exolab.castor.persist.TransactionContext.load(TransactionContext.java:545)
at
org.exolab.castor.persist.TransactionContext.load(TransactionContext.java:479)
at org.exolab.castor.persist.ClassMolder.load(ClassMolder.java:742)
at org.exolab.castor.persist.LockEngine.load(LockEngine.java:361)
at
org.exolab.castor.persist.TransactionContext.load(TransactionContext.java:545)
at org.exolab.castor.persist.QueryResults.fetch(QueryResults.java:229)
at
org.exolab.castor.jdo.engine.OQLQueryImpl$OQLEnumeration.hasMore(OQLQueryImpl.java:573)
at
org.exolab.castor.jdo.engine.OQLQueryImpl$OQLEnumeration.hasMore(OQLQueryImpl.java:556)
at estore.EstoreMain.oqlQueryTest(EstoreMain.java:24)
at estore.EstoreMain.goGoGo(EstoreMain.java:214)other ex..
org.exolab.castor.jdo.TransactionAbortedException: Nested error:
org.exolab.castor.jdo.PersistenceException: Object, estore.Produit/321,
isn't loaded in the persistence storage!
at estore.EstoreMain.main(EstoreMain.java:193)
org.exolab.castor.jdo.PersistenceException: Object, estore.Produit/321,
isn't loaded in the persistence storage!
at org.exolab.castor.persist.ClassMolder.preStore(ClassMolder.java:1106)
at org.exolab.castor.persist.LockEngine.preStore(LockEngine.java:710)
at
org.exolab.castor.persist.TransactionContext.prepare(TransactionContext.java:1146)
at org.exolab.castor.jdo.engine.DatabaseImpl.commit(DatabaseImpl.java:498)
at estore.EstoreMain.oqlQueryTest(EstoreMain.java:48)
at estore.EstoreMain.goGoGo(EstoreMain.java:214)
at estore.EstoreMain.main(EstoreMain.java:193
thx.
--
gilles
>From: Oleg Nitz <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED]
>Subject: Re: [castor-dev] Simple OQL ... ?
>Date: Sat, 4 Aug 2001 00:29:40 +0300
>
>Hi Gilles,
>
>I guess you use "generic" driver, which is set in database.xml
>
><database name="..." engine="generic" >
>
>Should be
>
><database name="..." engine="mysql" >
>
>MySQL driver doesn't generate "{oj" at all.
>
>Oleg
>
>On Wednesday 01 August 2001 10:43, gilles dodinet wrote:
> > hi..
> >
> > m always in trouble with generation of bad sql queries... i've posted
>this
> > mess several days ago but got no answer.. could someone gimme a clue..
> > thanks.. below the previous post (no change - same error :()
> >
> > (i use mysql 3.23)
> >
> > Castor generates this sql query below (resulting of oql query "select p
> > from estore.Produit p") :
> >
> > SELECT
> >
>produit.id,produit.description,produit.prix,promo_prod.promo_id,ligne_de_co
> >mmande.id FROM
> > {oj produit LEFT OUTER JOIN promo_prod ON
> > produit.id=promo_prod.produit_id
> > LEFT OUTER JOIN ligne_de_commande ON
> > produit.id=ligne_de_commande.prd_id};
> >
> > that throws an SqlException. it think it would have generated this one
> > rather that don't produce sql error :
> >
> > SELECT
> >
>produit.id,produit.description,produit.prix,promo_prod.promo_id,ligne_de_co
> >mmande.id FROM { oj
> > {oj produit LEFT OUTER JOIN promo_prod ON
> > produit.id=promo_prod.produit_id }
> > LEFT OUTER JOIN ligne_de_commande ON
> > produit.id=ligne_de_commande.prd_id};
> >
> > does this problem come from a mapping error or is this a bug in castor??
> > (below portions of mapping files)
> >
> > -------------------- MAPPING -------------
> > in produit.xml (class Produit and inherited classes) :
> >
> > <field name="ldc" type="estore.LigneDeCommande" required="false"
> > collection="vector">
> > <sql many-key="prd_id"/>
> > </field>
> >
> > in commande.xml (class Commande and LigneDeCommande ) :
> >
> > <field name="prd" type="estore.Produit">
> > <sql name="prd_id" />
> > </field>
> > -----------------------------END MAPPING ---------------------
> >
> > thx for your replies.
> >
> >
> >
> >
> >
> >
> >
> > _________________________________________________________________
> > T�l�chargez MSN Explorer gratuitement � l'adresse
> > http://explorer.msn.fr/intl.asp
> >
> > -----------------------------------------------------------
> > If you wish to unsubscribe from this mailing, send mail to
> > [EMAIL PROTECTED] with a subject of:
> > unsubscribe castor-dev
>
>-----------------------------------------------------------
>If you wish to unsubscribe from this mailing, send mail to
>[EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
>
_________________________________________________________________
T�l�chargez MSN Explorer gratuitement � l'adresse
http://explorer.msn.fr/intl.asp
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev