Is it possible for you to post the snip of code that does the query? My
guess is that you're doing something like this:
Criteria criteria = new Critetia();
criteria.addEqualTo("size", someValue);
Query query = new QueryByCriteria(classToQuery, criteria);
Collection result = pb.getCollectionByQuery(query);
If so then the problem is that OJB queries are done against objects, not
tables, there for you should change "size" to "_fileSize" or to the
corresponding bean method name (depending on the value of
PersistentFieldClass you defined in your OJB.properties file).
Hope this helps,
Luis Cruz
On Sat, 2004-01-03 at 02:17, Patrick Scheuerer wrote:
> Hi everyone,
>
> I'm loosing my mind.... I just can't figure out what i'm doing wrong. Can some
> of you please take a look at my code / config and tell me what i'm doing wrong?
> I know it's a long posting and I would really appreciate it very much if
> somebody could help me out.
>
> I have 7 value objects: DocumentVO, DownloadVO, CategoryVO, UserVO, RoleVO,
> PalModelVO and KeywordVO. They all extend the abstract ValueObject class.
> DownloadVO and DocumentVO implement the SupportItemI Interface.
>
> Here are the individual classes:
>
> public abstract class ValueObject implements Serializable {
> }
>
> public interface SupportItemI extends Serializable {
>
> public Long getId();
> public void setId(Long id);
>
> public String getName();
> public void setName(String name);
>
> public String getDescription();
> public void setDescription(String description);
>
> public String getVersion();
> public void setVersion(String version);
>
> public Date getCreationDate();
> public void setCreationDate(Date date);
>
> public CategoryVO getCategory();
> public void setCategory(String category);
>
> public RoleVO getRole();
> public void setRole(String role);
>
> public File getFile();
> public void setFile(String file);
>
> public void setKeywords(String keywords);
> }
>
>
> public class CategoryVO extends ValueObject implements Serializable {
> private Long _id;
> private String _name;
> private String _description;
> private String _path;
> private Collection _allItemsOfCategory;
> }
>
> public class DocumentVO extends ValueObject implements SupportItemI, Serializable {
> private Long _id;
> private String _name;
> private String _description;
> private String _version;
> private byte[] _abstract;
> private Date _creationDate;
> private Long _categoryId;
> private CategoryVO _category;
> private Vector _palModels;
> private Vector _keywords;
> private UserVO _author;
> private Long _authorId;
> private String _filePath;
> private Long _roleId;
> private RoleVO _role;
> }
>
> public class DownloadVO extends ValueObject implements SupportItemI, Serializable {
> private Long _id;
> private String _name;
> private String _description;
> private String _version;
> private Date _creationDate;
> private String _filePath;
> private Long _categoryId;
> private Long _roleId;
> private Long _fileSize;
> private Vector _palModels;
> private Vector _keywords;
> private CategoryVO _category;
> private RoleVO _role;
> }
>
> public class KeywordVO extends ValueObject implements Serializable {
> private Long _id;
> private String _name;
> }
>
> public class PalModelVO extends ValueObject implements Serializable {
> private Long _id;
> private String _name;
> private String _description;
> }
>
> public class RoleVO extends ValueObject implements Serializable {
> private Long _id;
> private String _name;
> private String _description;
> }
>
> public class UserVO extends ValueObject implements Serializable {
>
> private Long _id;
> private String _firstName;
> private String _lastName;
> private String _userName;
> private String _password;
> private String _email;
> private String _company;
> private String _position;
> private RoleVO _role;
> private Long _roleId;
> private boolean _authenticated;
> }
>
> And here is the repository_user.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <!-- Definitions for ch.ctc.support.common.SupportItemI -->
> <class-descriptor class="ch.ctc.support.common.SupportItemI">
> <extent-class class-ref="ch.ctc.support.document.DocumentVO" />
> <extent-class class-ref="ch.ctc.support.download.DownloadVO" />
> </class-descriptor>
>
> <!-- Definitions for extent ch.ctc.support.common.ValueObject -->
> <class-descriptor class="ch.ctc.support.common.ValueObject">
> <extent-class class-ref="ch.ctc.support.category.CategoryVO" />
> <extent-class class-ref="ch.ctc.support.document.DocumentVO" />
> <extent-class class-ref="ch.ctc.support.user.UserVO" />
> <extent-class class-ref="ch.ctc.support.user.RoleVO" />
> <extent-class class-ref="ch.ctc.support.download.DownlaodVO" />
> <extent-class class-ref="ch.ctc.support.keyword.KeywordVO" />
> <extent-class class-ref="ch.ctc.support.palmodel.PalModelVO" />
> </class-descriptor>
>
> <!-- Definitions for ch.ctc.support.category.CategoryVO -->
> <class-descriptor
> class="ch.ctc.support.category.CategoryVO"
> table="category"
> >
>
> <field-descriptor
> id="1"
> name="_id"
> column="id"
> jdbc-type="BIGINT"
> primarykey="true"
> autoincrement="true"
> />
>
> <field-descriptor
> id="2"
> name="_name"
> column="name"
> jdbc-type="VARCHAR"
> />
>
> <field-descriptor
> id="3"
> name="_description"
> column="description"
> jdbc-type="VARCHAR"
> />
>
> <field-descriptor
> id="4"
> name="_path"
> column="path"
> jdbc-type="VARCHAR"
> />
>
> <collection-descriptor
> name="_allItemsOfCategory"
> element-class-ref="ch.ctc.support.common.SupportItemI"
> auto-retrieve="true"
> auto-update="true"
> auto-delete="false"
> orderby="_id"
> sort="DESC"
> >
> <inverse-foreignkey field-ref="_categoryId"/>
> </collection-descriptor>
>
> </class-descriptor>
>
> <!-- Definitions for ch.ctc.support.user.UserVO -->
> <class-descriptor
> class="ch.ctc.support.user.UserVO"
> table="user"
> >
> <field-descriptor
> id="5"
> name="_id"
> column="id"
> jdbc-type="BIGINT"
> primarykey="true"
> autoincrement="true"
> />
>
> <field-descriptor
> id="6"
> name="_firstName"
> column="firstname"
> jdbc-type="VARCHAR"
> />
>
> <field-descriptor
> id="7"
> name="_lastName"
> column="lastname"
> jdbc-type="VARCHAR"
> />
>
> <field-descriptor
> id="8"
> name="_email"
> column="email"
> jdbc-type="VARCHAR"
> />
>
> <field-descriptor
> id="9"
> name="_password"
> column="password"
> jdbc-type="VARCHAR"
> />
>
> <field-descriptor
> id="10"
> name="_position"
> column="position"
> jdbc-type="VARCHAR"
> />
>
> <field-descriptor
> id="11"
> name="_company"
> column="company"
> jdbc-type="VARCHAR"
> />
>
> <field-descriptor
> id="12"
> name="_roleId"
> column="role_id"
> jdbc-type="BIGINT"
> />
>
> <field-descriptor
> id="13"
> name="_authenticated"
> column="authenticated"
> jdbc-type="BOOLEAN"
> />
>
> <reference-descriptor
> name="_role"
> class-ref="ch.ctc.support.user.RoleVO"
> auto-retrieve="true"
> >
> <foreignkey field-ref="_roleId"/>
> </reference-descriptor>
>
> </class-descriptor>
>
> <!-- Definitions for ch.ctc.support.document.DocumentVO -->
> <class-descriptor
> class="ch.ctc.support.document.DocumentVO"
> table="document"
> >
>
> <field-descriptor
> id="14"
> name="_id"
> column="id"
> jdbc-type="BIGINT"
> primarykey="true"
> autoincrement="true"
> />
>
> <field-descriptor
> id="15"
> name="_name"
> column="name"
> jdbc-type="VARCHAR"
> />
>
> <field-descriptor
> id="16"
> name="_description"
> column="description"
> jdbc-type="VARCHAR"
> />
>
> <field-descriptor
> id="17"
> name="_version"
> column="version"
> jdbc-type="VARCHAR"
> />
>
> <field-descriptor
> id="18"
> name="_abstract"
> column="abstract"
> jdbc-type="LONGVARBINARY"
> />
>
> <field-descriptor
> id="19"
> name="_creationDate"
> column="creation_date"
> jdbc-type="DATE"
> />
>
> <field-descriptor
> id="20"
> name="_categoryId"
> column="category_id"
> jdbc-type="BIGINT"
> />
>
> <field-descriptor
> id="21"
> name="_authorId"
> column="author_id"
> jdbc-type="BIGINT"
> />
>
> <field-descriptor
> id="22"
> name="_filePath"
> column="file_link"
> jdbc-type="VARCHAR"
> />
>
> <field-descriptor
> id="23"
> name="_roleId"
> column="role_id"
> jdbc-type="BIGINT"
> />
>
> <collection-descriptor
> name="_palModels"
> element-class-ref="ch.ctc.support.palmodel.PalModelVO"
> auto-retrieve="true"
> auto-update="true"
> indirection-table="document_pal_model"
> >
> <fk-pointing-to-this-class column="doc_id"/>
> <fk-pointing-to-element-class column="model_id"/>
> </collection-descriptor>
>
> <collection-descriptor
> name="_keywords"
> element-class-ref="ch.ctc.support.keyword.KeywordVO"
> auto-retrieve="true"
> auto-update="true"
> indirection-table="document_keyword"
> >
> <fk-pointing-to-this-class column="doc_id"/>
> <fk-pointing-to-element-class column="keyword_id"/>
> </collection-descriptor>
>
> <reference-descriptor
> name="_category"
> class-ref="ch.ctc.support.category.CategoryVO"
> auto-retrieve="true"
> >
> <foreignkey field-ref="_categoryId"/>
> </reference-descriptor>
>
> <reference-descriptor
> name="_author"
> class-ref="ch.ctc.support.user.UserVO"
> auto-retrieve="true"
> >
> <foreignkey field-ref="_authorId"/>
> </reference-descriptor>
>
> <reference-descriptor
> name="_role"
> class-ref="ch.ctc.support.user.RoleVO"
> auto-retrieve="true"
> >
> <foreignkey field-ref="_roleId"/>
> </reference-descriptor>
>
> </class-descriptor>
>
> <!-- Definitions for ch.ctc.support.palmodel.PalModelVO -->
> <class-descriptor
> class="ch.ctc.support.palmodel.PalModelVO"
> table="pal_model"
> >
>
> <field-descriptor
> id="24"
> name="_id"
> column="id"
> jdbc-type="BIGINT"
> primarykey="true"
> autoincrement="true"
> />
>
> <field-descriptor
> id="25"
> name="_name"
> column="name"
> jdbc-type="VARCHAR"
> />
>
> <field-descriptor
> id="26"
> name="_description"
> column="description"
> jdbc-type="VARCHAR"
> />
>
> </class-descriptor>
>
>
> <!-- Definitions for ch.ctc.support.keyword.KeywordVO -->
> <class-descriptor
> class="ch.ctc.support.keyword.KeywordVO"
> table="keyword"
> >
>
> <field-descriptor
> id="29"
> name="_id"
> column="id"
> jdbc-type="BIGINT"
> primarykey="true"
> autoincrement="true"
> />
>
> <field-descriptor
> id="30"
> name="_name"
> column="name"
> jdbc-type="VARCHAR"
> />
>
> </class-descriptor>
>
> <!-- Definitions for ch.ctc.support.user.RoleVO -->
> <class-descriptor
> class="ch.ctc.support.user.RoleVO"
> table="role"
> >
>
> <field-descriptor
> id="31"
> name="_id"
> column="id"
> jdbc-type="BIGINT"
> primarykey="true"
> autoincrement="true"
> />
>
> <field-descriptor
> id="32"
> name="_name"
> column="name"
> jdbc-type="VARCHAR"
> />
>
> <field-descriptor
> id="33"
> name="_description"
> column="description"
> jdbc-type="VARCHAR"
> />
>
> </class-descriptor>
>
> <!-- Definitions for ch.ctc.support.download.DownloadVO -->
> <class-descriptor
> class="ch.ctc.support.download.DownloadVO"
> table="document"
> >
>
>
> <field-descriptor
> id="34"
> name="_id"
> column="id"
> jdbc-type="BIGINT"
> primarykey="true"
> autoincrement="true"
> />
>
> <field-descriptor
> id="35"
> name="_name"
> column="name"
> jdbc-type="VARCHAR"
> />
>
> <field-descriptor
> id="36"
> name="_description"
> column="description"
> jdbc-type="VARCHAR"
> />
>
> <field-descriptor
> id="37"
> name="_version"
> column="version"
> jdbc-type="VARCHAR"
> />
>
> <field-descriptor
> id="38"
> name="_creationDate"
> column="creation_date"
> jdbc-type="DATE"
> />
>
> <field-descriptor
> id="39"
> name="_filePath"
> column="file_link"
> jdbc-type="VARCHAR"
> />
>
> <field-descriptor
> id="41"
> name="_categoryId"
> column="category_id"
> jdbc-type="BIGINT"
> />
>
> <field-descriptor
> id="42"
> name="_roleId"
> column="role_id"
> jdbc-type="BIGINT"
> />
>
> <field-descriptor
> id="43"
> name="_fileSize"
> column="size"
> jdbc-type="BIGINT"
> />
>
> <collection-descriptor
> name="_palModels"
> element-class-ref="ch.ctc.support.palmodel.PalModelVO"
> auto-retrieve="true"
> auto-update="true"
> indirection-table="download_pal_model"
> >
> <fk-pointing-to-this-class column="download_id"/>
> <fk-pointing-to-element-class column="model_id"/>
> </collection-descriptor>
>
> <collection-descriptor
> name="_keywords"
> element-class-ref="ch.ctc.support.keyword.KeywordVO"
> auto-retrieve="true"
> auto-update="true"
> indirection-table="download_keyword"
> >
> <fk-pointing-to-this-class column="download_id"/>
> <fk-pointing-to-element-class column="keyword_id"/>
> </collection-descriptor>
>
> <reference-descriptor
> name="_category"
> class-ref="ch.ctc.support.category.CategoryVO"
> auto-retrieve="true"
> >
> <foreignkey field-ref="_categoryId"/>
> </reference-descriptor>
>
> <reference-descriptor
> name="_role"
> class-ref="ch.ctc.support.user.RoleVO"
> auto-retrieve="true"
> >
> <foreignkey field-ref="_roleId"/>
> </reference-descriptor>
>
> </class-descriptor>
>
>
> Additionaly i have uploaded a picture with my data model to the following URL:
> http://homepage.hispeed.ch/tabalooga/datamodel-web.jpg
>
> Everytime I run a query on the PersistenceBroker I get the following exception:
> org.apache.ojb.broker.PersistenceBrokerException: Column not found, message
> from server: "Unknown column 'A0.size' in 'field list'"
> org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
> Source)
> org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
> Source)
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
> Source)
>
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown
> Source)
>
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown
> Source)
>
> I big thank you in advance,
> Patrick
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]