After consulting the ojb documentation and the mailing list archives I
think that I do everything the right way, but I still cannot query a table
with a blob...
I get the following exception:
org.apache.ojb.broker.metadata.MetadataException: IllegalAccess error
setting field:datei in object:ch.admin.bit.tabakbier.dto.Dateien
[PersistentField] ERROR: while set field:
[try to set 'object value' in 'target object'
target obj class: ch.admin.bit.tabakbier.dto.Dateien
target field name: datei
target field type: interface java.sql.Blob
object value class: [B
object value: [EMAIL PROTECTED]
]
repository.xml:
<class-descriptor
class="ch.admin.bit.tabakbier.dto.Dateien"
table="DATEIEN"
>
<field-descriptor id="1"
name="id"
column="ID"
jdbc-type="BIGINT"
primarykey="true"
/>
<field-descriptor id="2"
name="datei"
column="DATEI"
jdbc-type="BLOB"
/>
<insert-procedure name="ojb$DATN.ins">
<runtime-argument field-ref="id" return="true"/>
<runtime-argument field-ref="datei" return="true"/>
</insert-procedure>
<update-procedure name="ojb$DATN.upd">
<runtime-argument field-ref="id" return="true"/>
<runtime-argument field-ref="datei" return="true"/>
</update-procedure>
<delete-procedure name="ojb$DATN.del">
<runtime-argument field-ref="id"/>
</delete-procedure>
</class-descriptor>
I have attached the file Dateien.java.
Using ojb 1.0.1 with the Oracle 9 JDBC thin driver.
Any help is highly appreciated!
Thank you very much and best regards,
Chris
// Generated by EzaMeta Generator
// 2005-09-30 17:20:52
package ch.admin.bit.tabakbier.dto;
import ch.admin.bit.fw.common.IValueObject;
import ch.admin.bit.ezameta.persistence.ISmartDto;
public class Dateien implements ISmartDto {
private long id;
private java.sql.Blob datei;
private boolean dirtyIndicator = false;
private boolean dirtyTracking = true;
/**
* Returns true if the object does already exist in the database.
* Checks the primary key value.
*/
public boolean isPersistent() {
return (id != 0);
}
/**
* Returns true if the DTO tracks its dirty state.
*/
public boolean tracksDirtyState() {
return dirtyTracking;
}
/**
* Enable the DTO to track its dirty state.
*/
public void enableDirtyTracking() {
dirtyTracking = true;
}
/**
* Disable the DTO to track its dirty state.
*/
public void disableDirtyTracking() {
dirtyTracking = false;
}
/**
* Returns true if the DTO is dirty.
*/
public boolean isDirty() {
return dirtyIndicator;
}
/**
* Set the state of the DTO to dirty.
*/
public void setDirty() {
dirtyIndicator = true;
}
/**
* Set the state of the DTO to clean.
*/
public void setClean() {
dirtyIndicator = false;
}
public long getId(){
return this.id;
}
private void setId( long param ){
this.id = param;
if (dirtyTracking) dirtyIndicator = true;
}
public java.sql.Blob getDatei(){
return this.datei;
}
public void setDatei( java.sql.Blob param ){
this.datei = param;
if (dirtyTracking) dirtyIndicator = true;
}
public String toString(){
return " [id] " + id
+ " [datei] " + datei
+ " [dirtyIndicator] " + dirtyIndicator
;
}
public IValueObject copy(IValueObject vo){
Dateien tmp = ( Dateien ) vo;
if(vo==null) return this;
setId(tmp.getId());
setDatei(tmp.getDatei());
// this is how DTOs are instantiated - set dirty to false
dirtyIndicator = false;
return this;
}
public boolean equalsByAttributes(IValueObject dto) {
if (dto instanceof Dateien) {
Dateien realdto = (Dateien) dto;
return (
getId() == realdto.getId() &&
(getDatei() == null && realdto.getDatei() == null || getDatei() != null && getDatei().equals(realdto.getDatei()) || realdto.getDatei() != null && realdto.getDatei().equals(getDatei()))
);
} else {
return false;
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]