You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Raul Giucich <ra...@gmail.com> on 2005/04/12 17:56:18 UTC
MetadataException: IllegalAccess error setting field
OJB 1.1
MYSQL 4.0.23
TOMCAT 5.0.28
when i'm try to execute
perfisdao.findByPK("1","1","32","33") i have got an
Exception in thread "main"
org.apache.ojb.broker.metadata.MetadataException: IllegalAccess error
setting field:fechanacimiento in
object:serco.dao.personas.PersonasFisicas
the portion of this value object is
public class PersonasFisicas extends ValueObject implements Serializable{
private java.sql.Date fechanacimiento;
...
private Personas personas;
...
private GrupoEtnico grupoEtnico;
private Vector curriculumList = new Vector();
private Vector personasFisicashasIdiomasList = new Vector();
public PersonasFisicas(
...
java.sql.Date fechanacimiento,
...
) {
...
this.fechanacimiento = fechanacimiento;
...
}
/**
* Getter for property fechanacimiento.
* @return Value of property fechanacimiento.
*/
public java.sql.Date getFechanacimiento() {
return fechanacimiento;
}
/**
* Setter for property fechanacimiento.
* @param fechanacimiento New value of property fechanacimiento.
*/
public void setFechanacimiento(java.sql.Date fechanacimiento) {
this.fechanacimiento = fechanacimiento;
}
the portion of repository.xml is
<class-descriptor class="serco.dao.personas.PersonasFisicas"
table="PersonasFisicas">
<field-descriptor name="fechanacimiento" default-fetch="true"
column="FECHA_NACIMIENTO" jdbc-type="DATE"
conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlDateFieldConversion"/>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: MetadataException: IllegalAccess error setting field
Posted by Armin Waibel <ar...@apache.org>.
Hi Raul,
Raul Giucich wrote:
> OJB 1.1
really? You are using the 1.x CVS trunk? Or do you mean 1.0.1?
> MYSQL 4.0.23
> TOMCAT 5.0.28
>
> when i'm try to execute
>
> perfisdao.findByPK("1","1","32","33") i have got an
>
> Exception in thread "main"
> org.apache.ojb.broker.metadata.MetadataException: IllegalAccess error
> setting field:fechanacimiento in
> object:serco.dao.personas.PersonasFisicas
>
hmm, I think that you don't need the field-conversion. In
PersonasFisicas the field type is java.sql.Date, with the field
conversion it will be converted to java.util.Date.
So changing the field type or removing of the conversion may help.
If not, please post the whole stack trace, as far as I known is the
error message normally more detailed.
regards,
Armin
> the portion of this value object is
>
> public class PersonasFisicas extends ValueObject implements Serializable{
> private java.sql.Date fechanacimiento;
> ...
> private Personas personas;
> ...
> private GrupoEtnico grupoEtnico;
> private Vector curriculumList = new Vector();
> private Vector personasFisicashasIdiomasList = new Vector();
>
>
>
> public PersonasFisicas(
> ...
> java.sql.Date fechanacimiento,
> ...
> ) {
> ...
> this.fechanacimiento = fechanacimiento;
> ...
> }
> /**
> * Getter for property fechanacimiento.
> * @return Value of property fechanacimiento.
> */
> public java.sql.Date getFechanacimiento() {
> return fechanacimiento;
> }
>
> /**
> * Setter for property fechanacimiento.
> * @param fechanacimiento New value of property fechanacimiento.
> */
> public void setFechanacimiento(java.sql.Date fechanacimiento) {
> this.fechanacimiento = fechanacimiento;
> }
>
>
> the portion of repository.xml is
>
> <class-descriptor class="serco.dao.personas.PersonasFisicas"
> table="PersonasFisicas">
> <field-descriptor name="fechanacimiento" default-fetch="true"
> column="FECHA_NACIMIENTO" jdbc-type="DATE"
> conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlDateFieldConversion"/>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: MetadataException: IllegalAccess error setting field
Posted by Thomas Dudziak <to...@gmail.com>.
there is a FieldConversion class specifically for this purpose:
http://db.apache.org/ojb/api/org/apache/ojb/broker/accesslayer/conversions/JavaDate2SqlDateFieldConversion.html
simply set it at the field-descriptor in question
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: MetadataException: IllegalAccess error setting field
Posted by Raul Giucich <ra...@gmail.com>.
Thanks. Problem resolved.
R.
On Apr 12, 2005 6:36 PM, Armin Waibel <ar...@apache.org> wrote:
> Raul Giucich wrote:
> > log4j say
> >
> > while set field: [try to set 'object value' in 'target object' target
> > obj class: serco.dao.personas.PersonasFisicas target field name:
> > fechanacimiento target field type: class java.sql.Date
>
> ok, the class expect java.sql.Date
>
> object value
> > class: java.util.Date object value: Sat Apr 23 00:00:00 CEST 2005 ]
> >
>
> but OJB try to set java.util.Date.
>
> so (as said in previous mail) deletion of the field-conversion should
> solve the problem, because the standard Date type used by OJB is
> java.sql.Date.
>
> regards,
> Armin
>
>
> > On Apr 12, 2005 5:56 PM, Raul Giucich <ra...@gmail.com> wrote:
> >
> >>OJB 1.1
> >>MYSQL 4.0.23
> >>TOMCAT 5.0.28
> >>
> >>when i'm try to execute
> >>
> >>perfisdao.findByPK("1","1","32","33") i have got an
> >>
> >>Exception in thread "main"
> >>org.apache.ojb.broker.metadata.MetadataException: IllegalAccess error
> >>setting field:fechanacimiento in
> >>object:serco.dao.personas.PersonasFisicas
> >>
> >>the portion of this value object is
> >>
> >>public class PersonasFisicas extends ValueObject implements Serializable{
> >> private java.sql.Date fechanacimiento;
> >> ...
> >> private Personas personas;
> >> ...
> >> private GrupoEtnico grupoEtnico;
> >> private Vector curriculumList = new Vector();
> >> private Vector personasFisicashasIdiomasList = new Vector();
> >>
> >> public PersonasFisicas(
> >>...
> >>java.sql.Date fechanacimiento,
> >> ...
> >> ) {
> >>...
> >> this.fechanacimiento = fechanacimiento;
> >>...
> >> }
> >> /**
> >> * Getter for property fechanacimiento.
> >> * @return Value of property fechanacimiento.
> >> */
> >> public java.sql.Date getFechanacimiento() {
> >> return fechanacimiento;
> >> }
> >>
> >> /**
> >> * Setter for property fechanacimiento.
> >> * @param fechanacimiento New value of property fechanacimiento.
> >> */
> >> public void setFechanacimiento(java.sql.Date fechanacimiento) {
> >> this.fechanacimiento = fechanacimiento;
> >> }
> >>
> >>the portion of repository.xml is
> >>
> >><class-descriptor class="serco.dao.personas.PersonasFisicas"
> >>table="PersonasFisicas">
> >> <field-descriptor name="fechanacimiento" default-fetch="true"
> >>column="FECHA_NACIMIENTO" jdbc-type="DATE"
> >>conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlDateFieldConversion"/>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: ojb-user-help@db.apache.org
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: MetadataException: IllegalAccess error setting field
Posted by Armin Waibel <ar...@apache.org>.
Raul Giucich wrote:
> log4j say
>
> while set field: [try to set 'object value' in 'target object' target
> obj class: serco.dao.personas.PersonasFisicas target field name:
> fechanacimiento target field type: class java.sql.Date
ok, the class expect java.sql.Date
object value
> class: java.util.Date object value: Sat Apr 23 00:00:00 CEST 2005 ]
>
but OJB try to set java.util.Date.
so (as said in previous mail) deletion of the field-conversion should
solve the problem, because the standard Date type used by OJB is
java.sql.Date.
regards,
Armin
> On Apr 12, 2005 5:56 PM, Raul Giucich <ra...@gmail.com> wrote:
>
>>OJB 1.1
>>MYSQL 4.0.23
>>TOMCAT 5.0.28
>>
>>when i'm try to execute
>>
>>perfisdao.findByPK("1","1","32","33") i have got an
>>
>>Exception in thread "main"
>>org.apache.ojb.broker.metadata.MetadataException: IllegalAccess error
>>setting field:fechanacimiento in
>>object:serco.dao.personas.PersonasFisicas
>>
>>the portion of this value object is
>>
>>public class PersonasFisicas extends ValueObject implements Serializable{
>> private java.sql.Date fechanacimiento;
>> ...
>> private Personas personas;
>> ...
>> private GrupoEtnico grupoEtnico;
>> private Vector curriculumList = new Vector();
>> private Vector personasFisicashasIdiomasList = new Vector();
>>
>> public PersonasFisicas(
>>...
>>java.sql.Date fechanacimiento,
>> ...
>> ) {
>>...
>> this.fechanacimiento = fechanacimiento;
>>...
>> }
>> /**
>> * Getter for property fechanacimiento.
>> * @return Value of property fechanacimiento.
>> */
>> public java.sql.Date getFechanacimiento() {
>> return fechanacimiento;
>> }
>>
>> /**
>> * Setter for property fechanacimiento.
>> * @param fechanacimiento New value of property fechanacimiento.
>> */
>> public void setFechanacimiento(java.sql.Date fechanacimiento) {
>> this.fechanacimiento = fechanacimiento;
>> }
>>
>>the portion of repository.xml is
>>
>><class-descriptor class="serco.dao.personas.PersonasFisicas"
>>table="PersonasFisicas">
>> <field-descriptor name="fechanacimiento" default-fetch="true"
>>column="FECHA_NACIMIENTO" jdbc-type="DATE"
>>conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlDateFieldConversion"/>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: MetadataException: IllegalAccess error setting field
Posted by Raul Giucich <ra...@gmail.com>.
log4j say
while set field: [try to set 'object value' in 'target object' target
obj class: serco.dao.personas.PersonasFisicas target field name:
fechanacimiento target field type: class java.sql.Date object value
class: java.util.Date object value: Sat Apr 23 00:00:00 CEST 2005 ]
On Apr 12, 2005 5:56 PM, Raul Giucich <ra...@gmail.com> wrote:
> OJB 1.1
> MYSQL 4.0.23
> TOMCAT 5.0.28
>
> when i'm try to execute
>
> perfisdao.findByPK("1","1","32","33") i have got an
>
> Exception in thread "main"
> org.apache.ojb.broker.metadata.MetadataException: IllegalAccess error
> setting field:fechanacimiento in
> object:serco.dao.personas.PersonasFisicas
>
> the portion of this value object is
>
> public class PersonasFisicas extends ValueObject implements Serializable{
> private java.sql.Date fechanacimiento;
> ...
> private Personas personas;
> ...
> private GrupoEtnico grupoEtnico;
> private Vector curriculumList = new Vector();
> private Vector personasFisicashasIdiomasList = new Vector();
>
> public PersonasFisicas(
> ...
> java.sql.Date fechanacimiento,
> ...
> ) {
> ...
> this.fechanacimiento = fechanacimiento;
> ...
> }
> /**
> * Getter for property fechanacimiento.
> * @return Value of property fechanacimiento.
> */
> public java.sql.Date getFechanacimiento() {
> return fechanacimiento;
> }
>
> /**
> * Setter for property fechanacimiento.
> * @param fechanacimiento New value of property fechanacimiento.
> */
> public void setFechanacimiento(java.sql.Date fechanacimiento) {
> this.fechanacimiento = fechanacimiento;
> }
>
> the portion of repository.xml is
>
> <class-descriptor class="serco.dao.personas.PersonasFisicas"
> table="PersonasFisicas">
> <field-descriptor name="fechanacimiento" default-fetch="true"
> column="FECHA_NACIMIENTO" jdbc-type="DATE"
> conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlDateFieldConversion"/>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org