Gurus,
I am having problem trying to invoke a stored procedure via castor jdo
and map to an java object.Simple select queries are working for
meAttached is the code snippet I have for marshalling data out of
sybase db into possibly xml later.It throws the following stack of
errors.I am pretty much doing what the test code for castor says, can
any one please let me know what might be wrong.

Thanks
-Yogi


org.exolab.castor.jdo.PersistenceException:
Complex type not accepted!
at org.exolab.castor.persist.ClassMolder.setIdentity(Unknown
Source)
at org.exolab.castor.persist.ClassMolder.revertObject(Unknown
Source)
at org.exolab.castor.persist.LockEngine.revertObject(Unknown
Source)
at org.exolab.castor.persist.TransactionContext.rollback(Unknown
Source)
at org.exolab.castor.jdo.engine.DatabaseImpl.close(Unknown
Source)



import java.util.Vector;
import java.util.Enumeration;
import java.io.PrintWriter;
import java.io.InputStreamReader;
import java.io.Serializable;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.DriverManager;
import org.xml.sax.ContentHandler;
import org.exolab.castor.jdo.JDO;
import org.exolab.castor.jdo.Database;
import org.exolab.castor.jdo.OQLQuery;
import org.exolab.castor.jdo.QueryResults;
import org.exolab.castor.persist.spi.Complex;
import org.exolab.castor.util.Logger;
import org.exolab.castor.mapping.Mapping;
import org.apache.xml.serialize.*;

public class MarshallData {

private static final String databaseFile = "database.xml";
private static final String _databaseName = "amg_music_db";
private JDO _jdo;
private static Database _db;


public static void main( String[] args ) {
PrintWriter writer;
MarshallData md;
writer = new Logger( System.out ).setPrefix( "amgTest" );
try {
md=new MarshallData();
md.open(writer);
md.fetch(writer);
}
catch ( Exception except ) {
writer.println( except );
except.printStackTrace( writer );
}
}

private void open(PrintWriter w) throws Exception {
_jdo = new JDO();
_jdo.setLogWriter(w);
_jdo.setDatabaseName(_databaseName);
_jdo.setConfiguration(databaseFile); // Obtain a new
database
_db = _jdo.getDatabase();
}

private void fetch(PrintWriter w) throws Exception {
_db.begin();

OQLQuery amgQuery;
amgQuery=_db.getOQLQuery("CALL shop_extractAlbums($,$) AS
code.AlbumTracks" );
amgQuery.bind(1);
amgQuery.bind(100);
QueryResults results;
Enumeration enum=amgQuery.execute(_db.DbLocked);
int i=0;
while(enum.hasMoreElements()) {
i++;
System.err.println("GOT IN="+i);
AlbumTracks am=(AlbumTracks)enum.nextElement();
}
_db.commit();
_db.close();
}

}

Mapping file

<!-- Mapping for ProductGroup -->
<class name="code.AlbumTracks" identity="pid">
<description>Describes performers</description>
<map-to table="amg_Albums" />
<field name="pid" type="integer" lazy="true"
get-method="getAlbumID" set-method="setAlbumID">
<sql name="albumID" type="integer" dirty="check"/>
</field>
<field name="AlbumTitleBody" type="string" lazy="true"
get-method="getAlbumTitleBody" set-method="setAlbumTitleBody">
<sql name="albumTitleBody" type="varchar" dirty="check"/>
</field>
</class>
</mapping>

----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev

Reply via email to