Hello Andrus,
thank you very much for your help, it works fine.
Zvonimir Spajic
On Thu, 10 Feb 2005 09:36:33 -0500 (EST), Andrus Adamchik
<andru..bjectstyle.org> wrote:
> Hi Zvonomir,
>
> Mapping tomcat JDBC realms schema shouldn't be a problem - Cayenne
> supports meaningful PKs mapped as Java object attributes. However there
> maybe some quirks.
>
> What happens if you mark all these columns as PK?
>
> user.username
> role.rolename
> join_user_role.role_name
> join_user_role.user_name
>
> Andrus
>
>
>> Hello,
>>
>> after 5 hours trying I don't see any chance to solve my problem by lucky
>> testing.
>> I want to use Tomcats JDBC Realm. For this Login-Mechanism it's
>> necessary to have specific table-names and table-columns and to define
>> them in the server.xml:
>>
>> for example:
>> <Realm className="org.apache.catalina.realm.JDBCRealm"
>> debug="99"
>> driverName="org.gjt.mm.mysql.Driver"
>> connectionURL="jdbc:mysql://localhost/myDatabase"
>> connectionName="My DB Connection"
>> connectionPassword="myPassword"
>> userTable="user" userNameCol="username"
>> userCredCol="password"
>> userRoleTable="join_user_role" roleNameCol="rolename" />
>>
>> I want to use this with cayenne. A user can have many roles. A role can
>> belong to many users.
>> Because of this I use a Join Table (join_user_role).
>>
>> If I do it this way...
>> The column "username" is not the PK in the table user. The PK column in
>>
>> the table user is "id" (auto_pk_supported).
>> The column "rolename" is not the PK in the table role. The PK column in
>>
>> the table role is "id" (auto_pk_supported).
>> The 3 columns in the join table join_user_role are:
>> 1)id (auto_pk_supported)
>> 2)user_id
>> 3)role_id
>>
>> The relationships are:
>> user.id <--> join_user_role.user_id
>> role.id <--> join_user_role.role_id
>>
>> .. then cayenne works fine.
>>
>> But if I want to store the username and rolename in the join-table
>> join_user_role, like that way
>> The relationships are:
>> user.username <--> join_user_role.user_name
>> role.rolename <--> join_user_role.role_name
>>
>> then cayenne gives me an error:
>> org.objectstyle.cayenne.CayenneRuntimeException: [v.1.1RC1 October 3
>> 2004] Cannot set the read-only flattened relationship hasRoles
>> ERROR RegistrationAction: Registration failed!
>>
>>
>> How I can store/save the username and rolename in the join-table instead
>> of storing the id's. I need this for the JDBCRealm.
>>
>> Please help me.
>>
>> Greetings Zvonimir
>
>
>
-- Software & Consulting Zvonimir SpajicIndividualsoftware · IT-Sicherheit · Internetlösungen · Netzwerksysteme · Systemintegration
Hohenzollernstrasse 114 53721 Siegburg Germany
phone: +49 (0)2241 1277180 fax: +49 (0)2241 1469621 mobile: +49 (0)173 2050868 e-mail: mailto:z.spaji..scensys.de
Confidentiality Notice: This e-mail is privileged and confidential and for the use of the addressee only. Should you have received this e-mail in error please notify us by replying directly to the sender or by sending a message to the sender and delete the e-mail. Unauthorised use, disclosure or copying of the contents of this e-mail, or any similar action, is prohibited. Thank you.
This archive was generated by hypermail 2.0.0 : Fri Feb 11 2005 - 10:26:46 EST