@Override public AssociationKey readObject(ObjectInput input) throws IOException, ClassNotFoundException { VersionChecker.readAndCheckVersion( input, VERSION, AssociationKey.class ); String tableName = input.readUTF(); String[] columnNames = (String[]) input.readObject(); Object[] values = (Object[]) input.readObject(); AssociationKeyMetadata associationKeyMetadata = new DefaultAssociationKeyMetadata.Builder() .table( tableName ) .columnNames( columnNames ) .build(); // the engine never accesses deserialized key instances so it's ok to leave the additional attributes // null; we should still consider extract these attributes to avoid potential confusion return new AssociationKey( associationKeyMetadata, values, null ); }
@Override public AssociationKey readObject(ObjectInput input) throws IOException, ClassNotFoundException { VersionChecker.readAndCheckVersion( input, VERSION, AssociationKey.class ); String tableName = input.readUTF(); String[] columnNames = (String[]) input.readObject(); Object[] values = (Object[]) input.readObject(); AssociationKeyMetadata associationKeyMetadata = new DefaultAssociationKeyMetadata.Builder() .table( tableName ) .columnNames( columnNames ) .build(); // the engine never accesses deserialized key instances so it's ok to leave the additional attributes // null; we should still consider extract these attributes to avoid potential confusion return new AssociationKey( associationKeyMetadata, values, null ); }
public AssociationKey getAssociationKey() { if ( associationKey == null ) { final Object[] columnValues = getKeyColumnValues(); EntityKey ownerEntityKey; if ( key != null ) { ownerEntityKey = EntityKeyBuilder.fromPersister( (OgmEntityPersister) getHostingEntityPersister(), (Serializable) key, session ); } else { ownerEntityKey = new EntityKey( ( (OgmEntityPersister) getHostingEntityPersister() ).getEntityKeyMetadata(), columnValues ); } associationKey = new AssociationKey( associationKeyMetadata, columnValues, ownerEntityKey ); } return associationKey; }