This one time, at band camp, Steffen Fiedler said:

SF>I try to map a many to many relationship.
SF>I've read the PortsOfCall-example and want to map
SF>the relationship between user and roles.
SF>my mapping.xml:
SF>[...]
SF><class name="com.xxx.access.User" identity="id">
SF>    <map-to table="USERS" xml="users" />
SF>    
SF>    <field name="id" type="integer" >
SF>      <sql name="ID" type="integer"/>
SF>      <xml node="attribute"/>
SF>    </field>
SF>    
SF>    <field name="name" type="string">
SF>      <sql name="NAME" type="char" dirty="check" />
SF>      <xml node="text" />
SF>    </field>   
SF>    
SF>    <field name="password" type="string">
SF>      <sql name="PASSWORD" type="char" dirty="check" />
SF>      <xml node="text" />
SF>    </field>   
SF>
SF>    <field name="roles" type="com.xxx.workflows.Role" collection="arraylist">
SF>      <sql name="ROLE" many-table="ROLES_USERS" many-key="USER"/>
SF>    </field>    
SF></class>
SF>
SF><class name="com.xxx.workflows.Role"  identity="id">
SF>    <map-to table="ROLES" xml="roles" />
SF>
SF>    <field name="id" type="integer" >
SF>      <sql name="ID" type="integer"/>
SF>      <xml node="attribute"/>
SF>    </field>
SF>  
SF>    <field name="name" type="string">
SF>      <sql name="NAME" type="char" dirty="check" />
SF>      <xml node="text" />
SF>    </field>  
SF>  
SF>  <field name="users" type="com.xxx.access.User" collection="arraylist">
SF>     <sql name="USERS" many-table="ROLES_USERS" many-key="ROLE"/>
SF>  </field>    
SF></class> 
SF>[...]
SF>
SF>and my sql-tables:
SF>USERS:
SF>    ID        NUMBER
SF>    NAME      VARCHAR
SF>    PASSWORD  VARCHAR
SF>ROLES:
SF>    ID        NUMBER
SF>    NAME      VARCHAR
SF>ROLES_USERS:
SF>    ID        NUMBER
SF>    ROLE      NUMBER
SF>    USERS     NUMBER
SF>
SF>When i execute any OQL-query like 'OQL-Querry: SELECT id FROM com.xxx.access.User 
id where 
SF>name="superuser"' i get the error-message: java.sql.SQLException: ORA-00936: 
missing expression
SF>
SF>I think, there is some mistake in the mapping.xml, but it seems to be valid.

Steffen,

I agree that your mapping descriptor seems to be OK. Can you post the relevant
client code where the OQL is located? 

Bruce
-- 
perl -e 'print unpack("u30","<0G)U8V4\@4VYY9&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'

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

Reply via email to