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 "Whitaker, Andy" <An...@MindGent.com> on 2004/10/14 21:48:27 UTC
Newbie question on field access error
Hello,
I'm new to OJB and I'm maintaining an app that uses OJB 1.0.0 and I'm receiving an IllegalAccess error setting a field that is used by OJB for locking.
The database is MySQL 4.0.21 on Windows.
The runtime error being thrown by Tomcat is:
org.apache.ojb.broker.PersistenceBrokerException: org.apache.ojb.broker.metada
.MetadataException: IllegalAccess error setting field:lockingNumber in object:
u.iu.uis.ccm.ccl.data.ApplicationConstants
at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuer
QueryReferenceBroker.java:240)
The section of code that this refers to is:
/**
* @ojb.field column="CCL_CNST_NM"
* primarykey="true"
* length="100"
*/
private String appConstantName;
// attributes
/**
* @ojb.field column="CCL_CNST_VAL_TXT"
* length="255"
*/
private String appConstantValue;
// used by locking system
/**
* @ojb.field column="locking_nbr"
* locking="true"
* jdbc-type="INTEGER"
*/
private Long lockingNumber;
public Long getLockingNumber() {
return lockingNumber;
}
public void setLockingNumber(Long lockingNumber) {
this.lockingNumber = lockingNumber;
}
Does anybody know why I would get this error? Thank you for any help.
-Andy
Re: Newbie question on field access error
Posted by Armin Waibel <ar...@apache.org>.
Hi Andy,
Whitaker, Andy wrote:
> Hello,
> I'm new to OJB and I'm maintaining an app that uses OJB 1.0.0 and I'm receiving an IllegalAccess error setting a field that is used by OJB for locking.
>
> The database is MySQL 4.0.21 on Windows.
>
> The runtime error being thrown by Tomcat is:
>
> org.apache.ojb.broker.PersistenceBrokerException: org.apache.ojb.broker.metada
> .MetadataException: IllegalAccess error setting field:lockingNumber in object:
> u.iu.uis.ccm.ccl.data.ApplicationConstants
> at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuer
> QueryReferenceBroker.java:240)
>
hmm, could be a problem of metadata setting.
'lockingNumber' has type Long, in your repository (xdoclet tags) you set
JDBC type of INTEGER.
But Long will normally be mapped to BIGINT/DECIMAL
http://db.apache.org/ojb/docu/guides/jdbc-types.html
so you should change the jdbc type to BIGINT/DECIMAL (or similar type
supported by your DB)
regards,
Armin
> The section of code that this refers to is:
> /**
> * @ojb.field column="CCL_CNST_NM"
> * primarykey="true"
> * length="100"
> */
> private String appConstantName;
> // attributes
> /**
> * @ojb.field column="CCL_CNST_VAL_TXT"
> * length="255"
> */
> private String appConstantValue;
> // used by locking system
> /**
> * @ojb.field column="locking_nbr"
> * locking="true"
> * jdbc-type="INTEGER"
> */
> private Long lockingNumber;
>
> public Long getLockingNumber() {
> return lockingNumber;
> }
> public void setLockingNumber(Long lockingNumber) {
> this.lockingNumber = lockingNumber;
> }
>
> Does anybody know why I would get this error? Thank you for any help.
>
> -Andy
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org