HHH-4847 inject both object id and the entity itself when asking nested identifier generators

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@18632 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Emmanuel Bernard 2010-01-26 17:12:42 +00:00
parent 8386be117a
commit fc20582ede
2 changed files with 4 additions and 4 deletions

View File

@ -67,7 +67,7 @@ public class CompositeNestedGeneratedValueGenerator implements IdentifierGenerat
} }
public static interface GenerationPlan { public static interface GenerationPlan {
public void execute(SessionImplementor session, Object incomingObject); public void execute(SessionImplementor session, Object incomingObject, Object objectId);
} }
private final GenerationContextLocator generationContextLocator; private final GenerationContextLocator generationContextLocator;
@ -87,7 +87,7 @@ public class CompositeNestedGeneratedValueGenerator implements IdentifierGenerat
Iterator itr = generationPlans.iterator(); Iterator itr = generationPlans.iterator();
while ( itr.hasNext() ) { while ( itr.hasNext() ) {
final GenerationPlan plan = (GenerationPlan) itr.next(); final GenerationPlan plan = (GenerationPlan) itr.next();
plan.execute( session, context ); plan.execute( session, object, context );
} }
return context; return context;

View File

@ -434,9 +434,9 @@ public class Component extends SimpleValue implements MetaAttributable {
this.injector = injector; this.injector = injector;
} }
public void execute(SessionImplementor session, Object incomingObject) { public void execute(SessionImplementor session, Object incomingObject, Object idObject) {
final Object generatedValue = subGenerator.generate( session, incomingObject ); final Object generatedValue = subGenerator.generate( session, incomingObject );
injector.set( incomingObject, generatedValue, session.getFactory() ); injector.set( idObject, generatedValue, session.getFactory() );
} }
} }