Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Exception on using VariableOneToOne annotation

Hi,

While on start of the application server I am getting the eclispe link
exception saying 'Only one may be defined as writable, all others must be
specified read-only.'. My table and the code detail is given below.

SourceTable - ID, FOREING_CLASS_TYPE , FORIENG_ID

TargetTable1 - T1_ID
TargetTable2 - T2_ID

The source table FORIENG_ID is foreing key to TagergetTable1.T1_ID and  
TargetTable2.T2_ID.


My DescriptorCustomizer detail is 

public class SourceCustomizer implements DescriptorCustomizer
{
        public void customize( final ClassDescriptor descriptor )
	{
	    VariableOneToOneMapping variableOneToOneMapping = new
VariableOneToOneMapping();
	    variableOneToOneMapping.setAttributeName( "foreignEntity" );
	    variableOneToOneMapping.setReferenceClass( EntityInterface.class );
	    variableOneToOneMapping.setForeignQueryKeyName(
	    		"SourceTable.FORIENG_ID", "TargetTable1.T1_ID" );

	    variableOneToOneMapping.setForeignQueryKeyName(
	    		"SourceTable.FORIENG_ID", "TargetTable2.T2_ID" );

	    variableOneToOneMapping.setTypeFieldName( "SourceTable
.FOREING_CLASS_TYPE" );

	    // configure class indicators
	    variableOneToOneMapping.addClassIndicator( TargetTable1.class,
"TargetTable1" );
	    variableOneToOneMapping.addClassIndicator( TargetTable2 .class,
"TargetTable2" );

	    variableOneToOneMapping.dontUseIndirection();
	    variableOneToOneMapping.privateOwnedRelationship();

	    // add mapping to descriptor
	    descriptor.addMapping( variableOneToOneMapping );
	}
}

My entity has the VariableOntoOne mapping like the one mention below.


@Entity
@Table( name = "SourceTable" )
@Customizer( SourceCustomizer.class )
public class SourceTable 
{

@VariableOneToOne()
private EntityInterface foreignEntity;

@Column( name = "FORIENG_ID", nullable = false )
private Integer foreignId;

}

is there anything I am missing in this ?

Thanks,
Kiran
 
-- 
View this message in context: http://old.nabble.com/Exception-on-using-VariableOneToOne-annotation-tp30308910p30308910.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top