Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HHH-16957 Embeddable cannot have only one @generated field #8543

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.generator;

public interface CompositeBeforeExecutionGenerator extends BeforeExecutionGenerator, CompositeGenerator {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.generator;

public interface CompositeGenerator extends Generator {
Generator getGenerator(int attributeStateArrayPosition);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html.
*/
package org.hibernate.generator.internal;

import java.util.EnumSet;
import java.util.List;
import java.util.Map;

import org.hibernate.dialect.Dialect;
import org.hibernate.generator.CompositeGenerator;
import org.hibernate.generator.EventType;
import org.hibernate.generator.Generator;
import org.hibernate.generator.OnExecutionGenerator;

public class OnExecutionCompositeGenerator implements OnExecutionGenerator, CompositeGenerator {

final List<Generator> generators;
final EnumSet<EventType> eventTypes;
final boolean writePropertyValue;
final boolean referenceColumnsInSql;
final String[] referencedColumnValues;

public OnExecutionCompositeGenerator(
List<Generator> generators,
EnumSet<EventType> eventTypes,
boolean writePropertyValue,
boolean referenceColumnsInSql, String[] referencedColumnValues) {
this.generators = generators;
this.eventTypes = eventTypes;
this.writePropertyValue = writePropertyValue;
this.referenceColumnsInSql = referenceColumnsInSql;
this.referencedColumnValues = referencedColumnValues;
}

@Override
public EnumSet<EventType> getEventTypes() {
return eventTypes;
}

@Override
public boolean referenceColumnsInSql(Dialect dialect) {
return referenceColumnsInSql;
}

@Override
public boolean writePropertyValue() {
return writePropertyValue;
}

@Override
public String[] getReferencedColumnValues(Dialect dialect) {
return referencedColumnValues;
}

@Override
public boolean generatedOnExecution() {
return true;
}

@Override
public Generator getGenerator(int attributeStateArrayPosition) {
return generators.get( attributeStateArrayPosition );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
@SuppressWarnings("rawtypes")
public class BasicAttributeMapping
extends AbstractSingularAttributeMapping
implements SingularAttributeMapping, BasicValuedModelPart {
implements BasicValuedModelPart {
private final NavigableRole navigableRole;

private final String tableExpression;
Expand Down
Loading