Hi,

I try to map a many to many relationship.
I've read the PortsOfCall-example and want to map
the relationship between user and roles.
my mapping.xml:
[...]
<class name="com.xxx.access.User" identity="id">
    <map-to table="USERS" xml="users" />
    
    <field name="id" type="integer" >
      <sql name="ID" type="integer"/>
      <xml node="attribute"/>
    </field>
    
    <field name="name" type="string">
      <sql name="NAME" type="char" dirty="check" />
      <xml node="text" />
    </field>   
    
    <field name="password" type="string">
      <sql name="PASSWORD" type="char" dirty="check" />
      <xml node="text" />
    </field>   

    <field name="roles" type="com.xxx.workflows.Role" collection="arraylist">
      <sql name="ROLE" many-table="ROLES_USERS" many-key="USER"/>
    </field>    
</class>

<class name="com.xxx.workflows.Role"  identity="id">
    <map-to table="ROLES" xml="roles" />

    <field name="id" type="integer" >
      <sql name="ID" type="integer"/>
      <xml node="attribute"/>
    </field>
  
    <field name="name" type="string">
      <sql name="NAME" type="char" dirty="check" />
      <xml node="text" />
    </field>  
  
  <field name="users" type="com.xxx.access.User" collection="arraylist">
     <sql name="USERS" many-table="ROLES_USERS" many-key="ROLE"/>
  </field>    
</class> 
[...]

and my sql-tables:
USERS:
    ID        NUMBER
    NAME      VARCHAR
    PASSWORD  VARCHAR
ROLES:
    ID        NUMBER
    NAME      VARCHAR
ROLES_USERS:
    ID        NUMBER
    ROLE      NUMBER
    USERS     NUMBER

When i execute any OQL-query like 'OQL-Querry: SELECT id FROM com.xxx.access.User id 
where 
name="superuser"' i get the error-message: java.sql.SQLException: ORA-00936: missing 
expression

I think, there is some mistake in the mapping.xml, but it seems to be valid.

Thanks for help,
Steffen

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to