cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ADAMA COULIBALY <tuc65...@temple.edu>
Subject Re: errors
Date Wed, 04 Apr 2012 18:11:30 GMT
Hi Andrus

I this is the content of my DataMap XML file

<?xml version="1.0" encoding="utf-8"?>
<data-map xmlns="http://cayenne.apache.org/schema/3.0/modelMap"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://cayenne.apache.org/schema/3.0/modelMap
http://cayenne.apache.org/schema/3.0/modelMap.xsd"
  project-version="3.0.0.1">
<property name="defaultPackage" value="org.example.cayenne.persistent"/>
<db-entity name="BOOK">
<db-attribute name="AUTHOR" type="VARCHAR" length="200"/>
<db-attribute name="BOOK_ID" type="INTEGER" isPrimaryKey="true"
isMandatory="true"/>
<db-attribute name="TITLE" type="VARCHAR" length="200"/>
</db-entity>
<db-entity name="LOAN">
<db-attribute name="DATE" type="DATE"/>
<db-attribute name="LOAN_BOOK_ID" type="INTEGER"/>
<db-attribute name="LOAN_ID" type="INTEGER" isPrimaryKey="true"
isMandatory="true"/>
<db-attribute name="LOAN_STU_ID" type="INTEGER"/>
</db-entity>
<db-entity name="STUDENT">
<db-attribute name="MAJOR" type="VARCHAR" length="200"/>
<db-attribute name="NAME" type="VARCHAR" length="200"/>
<db-attribute name="STUDENT_ID" type="INTEGER" isPrimaryKey="true"
isMandatory="true"/>
</db-entity>
<obj-entity name="Book" className="org.example.cayenne.persistent.Book"
dbEntityName="BOOK">
<obj-attribute name="author" type="java.lang.String"
db-attribute-path="AUTHOR"/>
<obj-attribute name="title" type="java.lang.String"
db-attribute-path="TITLE"/>
</obj-entity>
<obj-entity name="Loan" className="org.example.cayenne.persistent.Loan"
dbEntityName="LOAN">
<obj-attribute name="date" type="java.util.Date" db-attribute-path="DATE"/>
</obj-entity>
<obj-entity name="Student"
className="org.example.cayenne.persistent.Student" dbEntityName="STUDENT">
<obj-attribute name="major" type="java.lang.String"
db-attribute-path="MAJOR"/>
<obj-attribute name="name" type="java.lang.String"
db-attribute-path="NAME"/>
</obj-entity>
<db-relationship name="loans" source="BOOK" target="LOAN" toMany="true">
<db-attribute-pair source="BOOK_ID" target="LOAN_BOOK_ID"/>
</db-relationship>
<db-relationship name="book" source="LOAN" target="BOOK" toMany="false">
<db-attribute-pair source="LOAN_BOOK_ID" target="BOOK_ID"/>
</db-relationship>
<db-relationship name="student" source="LOAN" target="STUDENT"
toMany="false">
<db-attribute-pair source="LOAN_STU_ID" target="STUDENT_ID"/>
</db-relationship>
<db-relationship name="loans" source="STUDENT" target="LOAN" toMany="true">
<db-attribute-pair source="STUDENT_ID" target="LOAN_STU_ID"/>
</db-relationship>
<obj-relationship name="loans" source="Book" target="Loan"
deleteRule="Deny" db-relationship-path="loans"/>
<obj-relationship name="book" source="Loan" target="Book"
deleteRule="Nullify" db-relationship-path="book"/>
<obj-relationship name="student" source="Loan" target="Student"
deleteRule="Nullify" db-relationship-path="student"/>
<obj-relationship name="loans" source="Student" target="Loan"
deleteRule="Deny" db-relationship-path="loans"/>
</data-map>

I cannot not create instance of Student, Book, and Loan class
And I created another project to make sure that I did all mapping correctly
but I am getting the same errors

Best,

Adama


On Tue, Apr 3, 2012 at 3:14 AM, Andrus Adamchik <andrus@objectstyle.org>wrote:

> Check your DataMap XML file (*.map.xml) - is there indeed a mapping for
> org.example.cayenne.persistent.Student?
>
>
> On Apr 3, 2012, at 7:55 AM, ADAMA COULIBALY wrote:
>
> > Hi
> > I am new to cayenne and I built my project. I get the following error:
> > Exception in thread "main" java.lang.IllegalArgumentException: Class is
> not
> > mapped with Cayenne: org.example.cayenne.persistent.Student at
> > org.apache.cayenne.access.DataContext.newObject(DataContext.java:689) at
> > org.example.cayenne.Main.main(Main.java:15)
> > I created three different project and I am getting the same error
> >
> > Best,
> >
> > Adama
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message