Which tool you use to enhance byte-code ? (other that JDORI).
I have a case of update that running good with 1..n relation. But I didn't look further these tests.
Thanks,
Alexandre
Nicolas Arni-Bloch wrote:
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
<?xml version="1.0"?>
<!DOCTYPE jdo PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 1.0//EN" "http://java.sun.com/dtd/jdo_1_0.dtd">
<jdo>
<package name="test.jdo.model">
<class name="CFile">
<extension vendor-name="ojb" key="table" value="file" />
<field name="id">
<extension vendor-name="ojb" key="column" value="id" />
<extension vendor-name="ojb" key="jdbc-type" value="BIGINT" />
</field>
</class> </package> </jdo>
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 :
<jdo>
<package name="org.esupportail.portal.channels.CPracticeChannel">
<class name="CFile">
<extension vendor-name="ojb" key="table" value="file" />
<field name="id">
<extension vendor-name="ojb" key="column" value="id" />
<extension vendor-name="ojb" key="jdbc-type" value="BIGINT" /> </field>
...
</class>
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 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]
