cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Musall, Maik" <>
Subject Flattened Relationships generating empty inserts into cross table
Date Wed, 22 Feb 2017 21:12:29 GMT

I have an m:n relationship that works fine on queries but generates an empty insert when adding

Table 1: PDCUserRole
Table 2: PDCUserRight
x-Table: PDCUserRolePDCUserRight

Here are the relevant parts of my map.xml:

	<db-entity name="PDCUserRolePDCUserRight">
		<db-attribute name="userRightRef" type="INTEGER" isPrimaryKey="true" isGenerated="true"
		<db-attribute name="userRoleRef" type="INTEGER" isPrimaryKey="true" isGenerated="true"

	<db-relationship name="pcdUserRolePCDUserRightArray" source="PDCUserRight" target="PDCUserRolePDCUserRight"
toDependentPK="true" toMany="true">
		<db-attribute-pair source="userRightKey" target="userRightRef"/>
	<db-relationship name="pcdUserRolePCDUserRightArray" source="PDCUserRole" target="PDCUserRolePDCUserRight"
toDependentPK="true" toMany="true">
		<db-attribute-pair source="userRoleKey" target="userRoleRef"/>
	<db-relationship name="userRight" source="PDCUserRolePDCUserRight" target="PDCUserRight"
		<db-attribute-pair source="userRightRef" target="userRightKey"/>
	<db-relationship name="userRole" source="PDCUserRolePDCUserRight" target="PDCUserRole"
		<db-attribute-pair source="userRoleRef" target="userRoleKey"/>
	<obj-relationship name="userRoleArray" source="PDCUserRight" target="PDCUserRole" db-relationship-path="pcdUserRolePCDUserRightArray.userRole"/>
	<obj-relationship name="userRightArray" source="PDCUserRole" target="PDCUserRight" db-relationship-path="pcdUserRolePCDUserRightArray.userRight"/>

I then have an object "role" and an object "right" and want to create the relation. I'm essentially
doing (through a wrapper method):

	role.addToManyTarget( USER_RIGHT_ARRAY_KEY, right, true );

which generates the following SQL:

SELECT t0.longDescription, t0.shortDescription, t0.sortKey, t0.string, t0.title, t0.value,
t0.userRightKey FROM PDCUserRight t0 JOIN PDCUserRolePDCUserRight t1 ON (t0.userRightKey =
t1.userRightRef) WHERE t1.userRoleRef = ? [bind: 1->userRoleRef:11]

which of course produces: org.postgresql.util.PSQLException: ERROR: syntax error at or near

I read these pages, is there anything more on this? <> <>

What could be wrong? I have the same type of problem on all my m:n relationships. I created
this model by importing the old EOModel, but I also tried reengineering from database and
comparing the two. No meaningful differences aside from character case and similar details.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message