if(!initialized){
init();
}
//Clear old relations
UpdateQuery deleteQuery;
deleteQuery = new UpdateQuery(connection, false, linkTableDeleteSQL);
setQueryParameter(deleteQuery, this.localColumn, bean, 1);
deleteQuery.executeUpdate();
//Check if there are any new relations to set
List<RemoteType> remoteBeans = (List<RemoteType>) field.get(bean);
if(remoteBeans == null){
return;
}
for(RemoteType remoteBean : remoteBeans){
//Set new relations
UpdateQuery insertQuery;
insertQuery = new UpdateQuery(connection, false, linkTableInsertSQL);
setQueryParameter(insertQuery, this.localColumn, bean, 1);
setQueryParameter(insertQuery, this.remoteColumn, remoteBean, 2);
insertQuery.executeUpdate();
}
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);