ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Paul.Smi...@barclayscapital.com>
Subject Struggling to load a complex property from a secondary table (a 1:N problem)
Date Fri, 06 Jan 2006 12:16:11 GMT

I am struggling with the following scenario. Basically I'm trying to get
iBatis to load a complex property (a list of int) from a secondary

I have two tables, User and Permission. The pk of the User table
(UserId) is a fk in the Permission table, and there are many Permission
rows for each UserId. I am trying to get iBatis to perform the select
from the Permission table whenever a select is performed on the User
table, but I always get a 'Invalid column name' from the underlying jdbc
driver. I can't work out what query iBatis is trying to perform that is
yielding this error.

My SqlMap is setup so that the permissions property (a java.util.List of
java.lang.Integer) of the User resultMap is as follows:

<resultMap id="UserResultMap" class="User">
	<result property="userId" column="UserId"/>
	<result property="permissions" column="permissionId"

The "findPermissionByUserId" select is defined as:

<select id="findPermissionByUserId" parameterClass="int"
	select PermissionId as permissionId from Permissions where
UserId = #value#

The select is initaited from a "findUserById" select which is defined

<select id="findUserById" parameterClass="int"
	select * from User where UserId = #value#

Any help is greatly appreciated.


Paul Smith

For more information about Barclays Capital, please
visit our web site at http://www.barcap.com.

Internet communications are not secure and therefore the Barclays 
Group does not accept legal responsibility for the contents of this 
message.  Although the Barclays Group operates anti-virus programmes, 
it does not accept responsibility for any damage whatsoever that is 
caused by viruses being passed.  Any views or opinions presented are 
solely those of the author and do not necessarily represent those of the 
Barclays Group.  Replies to this email may be monitored by the Barclays 
Group for operational or business reasons.


View raw message