Hello All,
I've tried every way that I can think to get this to work, and I've searched the forums and the 'Net and am still stuck.
When I try to start my app, I get a NullPointerException several layers down when my session factory is trying to be created. That's not the real issue I don't think, but it's buried down there. I've turned on all the logging and don't get any more information.
Here's my mapping:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>
<class name="com.blockbuster.online.domain.model.community.entity.FriendRelationship"
table="USER_FRIEND"
where="FRIEND_STATUS != 'INACTIVE'"
>
<composite-id name="id"
class="com.blockbuster.online.domain.model.community.entity.FriendRelationship$FriendRelationshipId"
access="field"
>
<key-many-to-one
name="user"
access="field"
column="WEB_USER_ID"
class="com.blockbuster.online.domain.model.acctmgmt.entity.User"
/>
<key-many-to-one
name="friend"
access="field"
column="FRIEND_USER_ID"
class="com.blockbuster.online.domain.model.acctmgmt.entity.User"
lazy="proxy"
/>
</composite-id>
<property
name="screenName"
type="java.lang.String"
insert="false"
update="false"
lazy="false"
not-null="false"
formula="( SELECT p.screen_name FROM user_profile p WHERE p.web_user_id = web_user_id ) "
access="field"
/>
<property
name="displayName"
type="java.lang.String"
column="FRIEND_DISPLAY_NAME"
access="field"
/>
<property
name="friendStatus"
type="java.lang.String"
column="FRIEND_STATUS"
access="field"
/>
<component
name="changeAudit"
class="com.blockbuster.online.domain.model.common.component.ChangeAudit"
>
<property
name="createdBy"
type="java.lang.String"
column="CREATED_BY"
/>
<property
name="createdDate"
type="java.util.Date"
column="CREATED_DATE"
/>
<property
name="updatedBy"
type="java.lang.String"
column="UPDATED_BY"
/>
<property
name="updatedDate"
type="java.util.Date"
column="UPDATED_DATE"
/>
</component>
</class>
</hibernate-mapping>
The issue is the 'screenName' property. The table USER_FRIEND is the table for this mapping. There is another table called USER_PROFILE, and I want to get the SCREEN_NAME field from it.
Both of the tables contain a WEB_USER_ID column. Each USER_FRIEND record, might or might not have a corresponding record in USER_PROFILE (there is no relationship or constraint between them).
I think the problem is that the mapping uses a composite key (for what reason, I have no idea, this is inherited code). The screenName property's formula needs to match on WEB_USER_ID, but it's buried in the composite key. Any ideas on how I can get this to work?
Thank you very much,
Rex
|