Hi Patrick,
sorry for the waste of time. I discovered that I was using the wrong persistence
unit, for which I hadn't included the mapping for Code.
Regards
Adam
Patrick Linskey on 27/11/07 05:33, wrote:
Hi,
Can you post the mappings for Code as well?
-Patrick
On 11/26/07, Adam Hardy <[EMAIL PROTECTED]> wrote:
Can anyone spot my problem? There must be something simple wrong with my
approach because I am following the examples in the docs but I'm getting this
error:
org.apache.openjpa.persistence.ArgumentException: You have supplied columns for
"org.permacode.patternrepo.domain.Category.codes<element:class
org.permacode.patternrepo.domain.Code>", but this mapping cannot have columns in
this context.
I have tried various permutations to write the mapping but seem to have
exhausted all avenues. This is the class:
public class Category implements Serializable
{
private static final long serialVersionUID = -4057308541301713754L;
private Long id;
private String title;
private Collection<Code> codes;
/** default constructor */
public Category()
{
}
.... // with constructors, setters and getters
public class Code implements Serializable
{
private static final long serialVersionUID = -6384628886028362912L;
private Long id;
private Collection<Category> categories;
/** default constructor */
public Code()
{
}
and the entity mapping:
<entity class="org.permacode.patternrepo.domain.Category">
<table name="CATEGORY" />
<attributes>
<id name="id">
<column name="ID" />
<generated-value strategy="TABLE" generator="categoryKeySequence" />
</id>
<basic name="title">
<column name="TITLE" />
</basic>
<many-to-many name="codes">
<order-by></order-by>
<join-table name="CATEGORY_CODE_LINK">
<join-column name="CATEGORY_ID" referenced-column-name="ID"/>
<inverse-join-column name="CODE_ID" referenced-column-name="ID" />
</join-table>
</many-to-many>
</attributes>
</entity>
the mapping for Code follows exactly the same syntax.