Re: [JDO] Problem with byte-code enhancement
I try your class and it work for me. Just to now. Be careful if you want to use the OJB plugging for JDORI because it doesn't work very well (or I don't now how to use it). The 1..n and n..m relation have problem with the persistence by reachability. When you get object with a query, reachable objects are load in Transient state (I think) so when you make the commit JDO make a insert in place of a update. Here the class (the contentType field those not exit so I change the code) public final class CFile { private long id; // primary-key, autoincrement private String fileName; private String contentFile; protected CFile() { } protected CFile(final String fileName, final String contentType, final InputStream fileStream) { } public long getId() { return id; } public String getFileName() { return fileName; } public InputStream getContentFile() { return (InputStream) new ByteArrayInputStream(contentFile.getBytes()); } } And the CFile.jdo http://java.sun.com/dtd/jdo_1_0.dtd";> I make : java com.sun.jdori.enhancer.Main test/jdo/model/CFile.class test/jdo/model/CFile.jdo Le 26 avr. 04, à 12:33, Alexandre BOISSEAU a écrit : Hi Nicolas, I use the enhancer provided by jdori (com.sun.jdori.enhancer) and db-ojb-1.0.rc6. I don't know, because I have a similar class without problem during enhancement and running. Here my class file : public final class CFile { private long id; // primary-key, autoincrement private String fileName; private String contentFile; protected CFile() { } protected CFile(final String fileName, final String contentType, final InputStream fileStream) { this(); try { contentFile = IOUtils.toString(fileStream); } catch (IOException ex) { ex.printStackTrace(); } this.fileName = fileName; this.contentType = contentType; } public long getId() { return id; } protected String getContentType() { return contentType; } public String getFileName() { return fileName; } public InputStream getContentFile() { return (InputStream) new ByteArrayInputStream(contentFile.getBytes()); } public String toString() { return "File : id=" + id + " ; fileName=" + fileName + " ; contentType=" + contentType; } } Nicolas Arni-Bloch wrote: Hi Alexandre, could you send the java class ? wish version of the jdo enhancer do you use ? Le 26 avr. 04, à 09:00, Alexandre BOISSEAU a écrit : Hi, I have a class file with an 'long id' autoincrementally. During byte-code enhancement, I get the following error : [java] Error while enhancing: JDO ENHANCER: At least one error occurred while enhancing input class for Transparent Persistence; detailed message(s): nested exception: com.sun.jdori.model.ModelFatalException: ReflectionJavaField.ensureInitializedField: cannot find reflection field instance for field id. [java] com.sun.jdori.enhancer.EnhancerUserException: JDO ENHANCER: At least one error occurred while enhancing input class for Transparent Persistence; detailed message(s): nested exception: com.sun.jdori.model.ModelFatalException: ReflectionJavaField.ensureInitializedField: cannot find reflection field instance for field id. [java] at com.sun.jdori.enhancer.filter.Enhancer.enhanceClassFile(Unknown Source) [java] at com.sun.jdori.enhancer.Main.enhanceClassFile(Unknown Source) [java] at com.sun.jdori.enhancer.Main.enhanceInputFiles(Unknown Source) [java] at com.sun.jdori.enhancer.Main.process(Unknown Source) [java] at com.sun.jdori.enhancer.Main.main(Unknown Source) Contents of XML Metadate file : ... Please help me ? And if you need other details ... Regards, Alexandre. -- Alexandre BOISSEAU University of Rennes1 - France - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Nicolas Arni-Bloch Groupe MATIS, Centre Universitaire d'Informatique 24 rue General-Dufour CH-1204 Genève eMail : [EMAIL PROTECTED] phone : +41 22 379 76 80 fax : +41 22 379 77 80 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Alexandre BOISSEAU Université de Rennes1 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Nicolas Arni-Bloch
Re: [JDO] Problem with byte-code enhancement
Hi Alexandre, could you send the java class ? wish version of the jdo enhancer do you use ? Le 26 avr. 04, à 09:00, Alexandre BOISSEAU a écrit : Hi, I have a class file with an 'long id' autoincrementally. During byte-code enhancement, I get the following error : [java] Error while enhancing: JDO ENHANCER: At least one error occurred while enhancing input class for Transparent Persistence; detailed message(s): nested exception: com.sun.jdori.model.ModelFatalException: ReflectionJavaField.ensureInitializedField: cannot find reflection field instance for field id. [java] com.sun.jdori.enhancer.EnhancerUserException: JDO ENHANCER: At least one error occurred while enhancing input class for Transparent Persistence; detailed message(s): nested exception: com.sun.jdori.model.ModelFatalException: ReflectionJavaField.ensureInitializedField: cannot find reflection field instance for field id. [java] at com.sun.jdori.enhancer.filter.Enhancer.enhanceClassFile(Unknown Source) [java] at com.sun.jdori.enhancer.Main.enhanceClassFile(Unknown Source) [java] at com.sun.jdori.enhancer.Main.enhanceInputFiles(Unknown Source) [java] at com.sun.jdori.enhancer.Main.process(Unknown Source) [java] at com.sun.jdori.enhancer.Main.main(Unknown Source) Contents of XML Metadate file : ... Please help me ? And if you need other details ... Regards, Alexandre. -- Alexandre BOISSEAU University of Rennes1 - France - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Nicolas Arni-Bloch Groupe MATIS, Centre Universitaire d'Informatique 24 rue General-Dufour CH-1204 Genève eMail : [EMAIL PROTECTED] phone : +41 22 379 76 80 fax : +41 22 379 77 80 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JDO and OJB newbie Question
Hi all, I want to try JDO with OJB but I have some misunderstood. I am not very clear about where to put the MetaData for the mapping ? In the repository.xml or in the XXX.jdo ? I look in the tutorial5 and I see that information for the mapping are stored in the Product.jdo. So should we put this information in the .jdo and in the repository.xml ? My second question is : with the JDO should we use the ManageableCollection interface for the collection or not. I have try the jdo implementation with a single class and its work. But I try with 1..n relation and it doesn't ? Is some body as code example for using JDO with OJB ? Nicolas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Oracle Blob socket write error and autoCommit(true) failed
Le 26 févr. 04, à 23:36, Brad Matlack a écrit : Help! I'm trying to insert a small binary byte[] into Oracle 8.1.6. The stack dump provides three clues: 1: socket write error 2: could not build statement 3: set autoCommit(true) failed. I've tried both VARCHARBINARY and BLOB in my deployment descriptor, with and without the conversion: name="token" column="token_data" jdbc-type="BLOB" conversion="org.apache.ojb.broker.accesslayer.conversions.Object2ByteAr rFieldConversion"/> Any ideas? Thanks! Brad [org.apache.ojb.broker.accesslayer.StatementsForClassImpl] ERROR: Io exception: Software caused connection abort: socket write error java.sql.SQLException: Io exception: Software caused connection abort: socket write error at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:211) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:324) at oracle.jdbc.driver.OracleStatement.(OracleStatement.java:445) at oracle.jdbc.driver.OracleStatement.(OracleStatement.java:460) [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] ERROR: PersistenceBrokerException during the execution of the insert: Could not build statement ask for org.apache.ojb.broker.PersistenceBrokerSQLException: Could not build statement ask for at org.apache.ojb.broker.accesslayer.StatementManager.getInsertStatement(U nknown Source) at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeInsert(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown Source) [org.apache.ojb.broker.platforms.PlatformDefaultImpl] ERROR: Set autoCommit(true) failed ERROR: Set autoCommit(true) failed Io exception: Software caused connection abort: socket write error java.sql.SQLException: Io exception: Software caused connection abort: socket write error at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:211) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:324) at oracle.jdbc.driver.OracleConnection.setAutoCommit(OracleConnection.java :812) at com.p6spy.engine.spy.P6Connection.setAutoCommit(P6Connection.java:189) Hi Brad, 2 weeks ago I write a email to now how to use oracle LOB with OJB, the only answer was something with torque. I have try to deal with LOB and OJB but they are a of documentation. The oracle LOB are pointer to the value, therefor with JDBC you can not make a classic insert. The procedure to insert a LOB as 3 phases : 1) insert a record with empty_blob() or empty_clob() 2) make a select for update and call the getBlob() to obtain the oracle.sql.BLOB 3) write or read with input/outputStream This technic is nice when you want to insert a very large file up to 4GB because you can not store the file in memory. But when you just want to store data that are just more then 4kb and are in memory, the procedure is a little bit heavy. What I don't understand in OJB is : what must be the type of the attribute that we want to insert in the LOB is can not be java.sql.Blob because it's a interface. it can be a byte[] but it's nice for small data. Then it must be a input or a output Stream, or some think that encapsulate it. To answer to the ERROR: Set autoCommit(true) normally when you write a LOB the autoCommit have to be set to false. So... I don't realy answer your problem but is just because I think that OJB and LOB are really not clear. I think that the OJB team have to give a clear answer about LOB. Either we can use LOB with OJB and a some documentation would be greate, or we can not now use it. And we found a other way. If you or some body have some doc or howto about LOB and OJB, I will be happy to have it. Cheers -- Nicolas Arni-Bloch Groupe MATIS, Centre Universitaire d'Informatique 24 rue General-Dufour CH-1204 Genève eMail : [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
OJB and LOB
Hi all, I'm using OJB 1.0.rc5 and oracle9i. I look for a howto about LOB with OJB. The only thing that I found is this url : http://db.apache.org/ojb/howto-use-lobs.html the discussion about large objects and Lob is very interesting but the howto stop with Strategy 1: Using streams for LOB I/O. Is some body have some code example ? Or OJB those not support Lob ? Thanks. -- Nicolas Arni-Bloch Groupe MATIS, Centre Universitaire d'Informatique 24 rue General-Dufour CH-1204 Genève eMail : [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]