No well, right now i just changed the DynamicUser class in
DynamicHibernate.hbm.xml to:
<class name="com.corp.prod.security.hibernate.MyUser"
table="SECURITY_USER" >
<id name="id" type="long" column="USER_ID" unsaved-value="0">
<generator class="native"/>
</id>
<property name="name" column="USERNAME" type="string"/>
<property name="password" column="PASSWORD" type="string"/>
<set name="groupsAsSet" lazy="true" table="SECURITY_USER_GROUP"
inverse="true" cascade="none">
<key column="USER_ID"/>
<many-to-many
class="org.apache.fulcrum.security.model.dynamic.entity.DynamicGroup"
column="GROUP_ID"/>
</set>
<property name="name2" column="USERNAME2" type="string"/>
<!--<one-to-one name="basicprofile"
class="com.corp.prod.om.BasicProfile"/>-->
</class>
So I ONLY have an extra property(name2). And then created the get/set in
MyUser, and this worked!
But why did the one-to-one not work? I did think of subclassing the stuff
into the DynamicHibernate.hbm.xml, however as my Profile is pretty big, I
thought there would be some other way to make an easy access... (I'm also
using the hibernate synchronizer which auto generates POJO and DAO's for you
and I would hate to loose this because of the size)
So what I would like is:
Standard stuff like name, email etc in the MyUser, and then extending this
with a one-to-one (or subclass in another file if possible? - I think this
is possible, atleast it should).
However the one-to-one should work, the code in MyUser for the one-to-one
looks like this:
// one to one
private com.corp.prod.om.BasicProfile _basicprofile;
/**
* @hibernate.property
* column=basicprofile
*/
public com. corp.prod.om.BasicProfile getBasicprofile() {
return this._basicprofile;
}
/**
* Set the value related to the column: basicprofile
* @param _basicprofile the basicprofile value
*/
public void setBasicprofile(
com.corp.prod.om.BasicProfile _basicprofile) {
this._basicprofile = _basicprofile;
}
See any errors here?
/martin
-----Original Message-----
From: Courcoux Peter, Slough [mailto:[EMAIL PROTECTED]
Sent: 29. juni 2004 15:12
To: 'Turbine Users List'
Subject: RE: Subclassing DynamicUser..
Martin,
Are you subclassing DynamicUser as in making it a hibernate joined subclass?
If so have you got the hbm.xml file right. Did you create it manually or use
xdoclet?
Peter
-----Original Message-----
From: Martin Wendel [mailto:[EMAIL PROTECTED]
Sent: 29 June 2004 13:56
To: 'Turbine Users List'; [EMAIL PROTECTED]
Subject: RE: Subclassing DynamicUser..
Actually what ever i put into the DynamicUser.hbm.xml (only tested in the
User class though) makes it fail.
Sure I want to put it together, but I thought I should start out simple
(I've changed the one-to-one to a property, with same result)..
Am I not supposed to change the classname here to MyUser?
<component
role="org.apache.fulcrum.security.UserManager"
class="org.apache.fulcrum.security.hibernate.HibernateUserManagerImpl">
<className>com.corp.prod.security.hibernate.MyUser</className>
</component>
I mean the changes I apply to the DynamicUser.hbm.xml must be provided in a
class somewhere, and I must refer to this class somewhere too...
/martin
-----Original Message-----
From: Eric Pugh [mailto:[EMAIL PROTECTED]
Sent: 29. juni 2004 14:50
To: Turbine Users List
Subject: RE: Subclassing DynamicUser..
It's kinda of a cheap answer but.. Do you need the one-to-one? Why not
just have your subclassed user have a single table instead of both?
Also, if the original works fine, then try and add a one-to-one on the
original.. Just to verify that it is the one-to-one causing it (not sure
why it would though)..
Eric
> -----Original Message-----
> From: Martin Wendel [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 29, 2004 12:59 PM
> To: 'Turbine Users List'
> Subject: RE: Subclassing DynamicUser..
>
>
> I forgot to say, if i remove the one-to-one from the User it works, so it
> must be something i'm missing trying to extend it?
>
> /M
>
> -----Original Message-----
> From: Martin Wendel [mailto:[EMAIL PROTECTED]
> Sent: 29. juni 2004 12:55
> To: 'Turbine Users List'
> Subject: RE: Subclassing DynamicUser..
>
> Ok i've solved the other problem, but now i have this one which is a bit
> more tricky.
>
> Running the antelope example again, still trying to subclass the
> dynamicuser.
>
> When i try to run this line (abstractcreatetestuser):
>
> HibernateService hibernateService = (HibernateService)
> lookup(HibernateService.ROLE);
>
> it gives me this error:
>
> junit.framework.AssertionFailedError:
> org.apache.avalon.framework.component.ComponentException: Could not access
> the Component (key [net.sf.hibernate.avalon.HibernateService])
> at junit.framework.Assert.fail(Assert.java:47)
> at com.webcellcorp.affection.HibernateCreateUsersTest.setUp
>
>
>
> The mapping files look like this:
>
>
> <class name="User" table="USER" >
> <id name="id" type="long" column="USER_ID" unsaved-value="0">
> <generator class="native"/>
> </id>
> <one-to-one name="profile" class="Profile"/>
> </class>
>
>
> <class name="Profile" table="profile" lazy="true">
> <id name="id" column="profile_id" type="long">
> <generator class="foreign">
> <param name="property">user</param>
> </generator>
> </id>
> <one-to-one name="user" class="User" constrained="true"/>
> </class>
>
>
>
> What am i doing wrong?
>
> /Martin
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Scanned for viruses by MessageLabs
Scanned for viruses by MessageLabs. The integrity and security of this
message cannot be guaranteed. This email is intended for the named recipient
only, and may contain confidential information and proprietary material. Any
unauthorised use or disclosure is prohibited.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]