下面列出了怎么用javax.persistence.EmbeddedId的API类实例代码及写法,或者点击链接到github查看源代码。
public static BeanAttributeInformation getUniquePrimaryKey(Class<?> entityClass) {
BeanInformation entityInformation = BeanInformation.get(entityClass);
List<String> attributeNames = entityInformation.getAttributeNames();
BeanAttributeInformation pkAttribute = null;
for (String attributeName : attributeNames) {
BeanAttributeInformation attribute = entityInformation.getAttribute(attributeName);
if (attribute.getAnnotation(Id.class).isPresent() || attribute.getAnnotation(EmbeddedId.class).isPresent()) {
if (pkAttribute != null) {
throw new IllegalStateException(
"compount primary keys not yet support, consider use of EmbeddedId for " + entityClass.getName());
}
pkAttribute = attribute;
}
}
if (pkAttribute == null) {
throw new IllegalStateException("no primary key found for " + entityClass.getName() + ", use @Id or @EmbeddedId");
}
return pkAttribute;
}
@Override
public Optional<ResourceFieldType> getFieldType(BeanAttributeInformation attributeDesc) {
Optional<OneToOne> oneToOne = attributeDesc.getAnnotation(OneToOne.class);
Optional<OneToMany> oneToMany = attributeDesc.getAnnotation(OneToMany.class);
Optional<ManyToOne> manyToOne = attributeDesc.getAnnotation(ManyToOne.class);
Optional<ManyToMany> manyToMany = attributeDesc.getAnnotation(ManyToMany.class);
if (oneToOne.isPresent() || oneToMany.isPresent() || manyToOne.isPresent() || manyToMany.isPresent()) {
return Optional.of(ResourceFieldType.RELATIONSHIP);
}
Optional<Id> id = attributeDesc.getAnnotation(Id.class);
Optional<EmbeddedId> embeddedId = attributeDesc.getAnnotation(EmbeddedId.class);
if (id.isPresent() || embeddedId.isPresent()) {
return Optional.of(ResourceFieldType.ID);
}
return Optional.empty();
}
public Boolean hasIdClassOrEmbeddedId() {
if ( hasIdClassOrEmbeddedId == null ) {
hasIdClassOrEmbeddedId = false;
if ( getClassWithIdClass( true ) != null ) {
hasIdClassOrEmbeddedId = true;
}
else {
final ElementsToProcess process = getElementsToProcess();
for ( PropertyData property : process.getElements() ) {
if ( property.getProperty().isAnnotationPresent( EmbeddedId.class ) ) {
hasIdClassOrEmbeddedId = true;
break;
}
}
}
}
return hasIdClassOrEmbeddedId;
}
private boolean isProcessingId(XMLContext.Default defaults) {
boolean isExplicit = defaults.getAccess() != null;
boolean correctAccess =
( PropertyType.PROPERTY.equals( propertyType ) && AccessType.PROPERTY.equals( defaults.getAccess() ) )
|| ( PropertyType.FIELD.equals( propertyType ) && AccessType.FIELD
.equals( defaults.getAccess() ) );
boolean hasId = defaults.canUseJavaAnnotations()
&& ( isPhysicalAnnotationPresent( Id.class ) || isPhysicalAnnotationPresent( EmbeddedId.class ) );
//if ( properAccessOnMetadataComplete || properOverridingOnMetadataNonComplete ) {
boolean mirrorAttributeIsId = defaults.canUseJavaAnnotations() &&
( mirroredAttribute != null &&
( mirroredAttribute.isAnnotationPresent( Id.class )
|| mirroredAttribute.isAnnotationPresent( EmbeddedId.class ) ) );
boolean propertyIsDefault = PropertyType.PROPERTY.equals( propertyType )
&& !mirrorAttributeIsId;
return correctAccess || ( !isExplicit && hasId ) || ( !isExplicit && propertyIsDefault );
}
@DB()
protected String buildSelectByIdSql(final StringBuilder sql) {
if (_idField == null) {
return null;
}
if (_idField.getAnnotation(EmbeddedId.class) == null) {
sql.append(_table).append(".").append(DbUtil.getColumnName(_idField, null)).append(" = ? ");
} else {
final Class<?> clazz = _idField.getClass();
final AttributeOverride[] overrides = DbUtil.getAttributeOverrides(_idField);
for (final Field field : clazz.getDeclaredFields()) {
sql.append(_table).append(".").append(DbUtil.getColumnName(field, overrides)).append(" = ? AND ");
}
sql.delete(sql.length() - 4, sql.length());
}
return sql.toString();
}
protected T findById(final ID id, final boolean removed, final Boolean lock) {
final StringBuilder sql = new StringBuilder(_selectByIdSql);
if (!removed && _removed != null) {
sql.append(" AND ").append(_removed.first());
}
if (lock != null) {
sql.append(lock ? FOR_UPDATE_CLAUSE : SHARE_MODE_CLAUSE);
}
final TransactionLegacy txn = TransactionLegacy.currentTxn();
PreparedStatement pstmt = null;
try {
pstmt = txn.prepareAutoCloseStatement(sql.toString());
if (_idField.getAnnotation(EmbeddedId.class) == null) {
prepareAttribute(1, pstmt, _idAttributes.get(_table)[0], id);
}
final ResultSet rs = pstmt.executeQuery();
return rs.next() ? toEntityBean(rs, true) : null;
} catch (final SQLException e) {
throw new CloudRuntimeException("DB Exception on: " + pstmt, e);
}
}
/**
* 构造方法
*
* @param metadata
*/
HibernateMetadata(Class<?> clazz) {
ormClass = clazz;
ormName = clazz.getName();
ReflectionUtility.doWithFields(ormClass, (field) -> {
if (Modifier.isStatic(field.getModifiers()) || Modifier.isTransient(field.getModifiers())) {
return;
}
if (field.isAnnotationPresent(Version.class)) {
versionName = field.getName();
return;
}
Class<?> type = ClassUtility.primitiveToWrapper(field.getType());
if (String.class == type) {
fields.put(field.getName(), type);
} else if (type.isEnum()) {
fields.put(field.getName(), type);
} else if (Collection.class.isAssignableFrom(type) || type.isArray()) {
fields.put(field.getName(), List.class);
} else if (Date.class.isAssignableFrom(type)) {
fields.put(field.getName(), Date.class);
} else {
fields.put(field.getName(), Map.class);
}
if (field.isAnnotationPresent(Id.class) || field.isAnnotationPresent(EmbeddedId.class)) {
primaryName = field.getName();
primaryClass = type;
}
});
Table table = clazz.getAnnotation(Table.class);
if (table != null) {
for (Index index : table.indexes()) {
indexNames.add(index.columnList());
}
}
}
private void setKey(T meta) {
if (meta.getPrimaryKey() == null) {
boolean generated = false;
ArrayList<MetaAttribute> pkElements = new ArrayList<>();
for (MetaAttribute attr : meta.getAttributes()) {
if (attr.getAnnotation(Id.class) != null || attr.getAnnotation(EmbeddedId.class) != null) {
pkElements.add(attr);
attr.setPrimaryKeyAttribute(true);
boolean attrGenerated = attr.getAnnotation(GeneratedValue.class) != null;
if (pkElements.size() == 1) {
generated = attrGenerated;
} else if (generated != attrGenerated) {
throw new IllegalStateException(
"cannot mix generated and not-generated primary key elements for " + meta.getId());
}
}
}
if (!pkElements.isEmpty()) {
MetaPrimaryKey primaryKey = new MetaPrimaryKey();
primaryKey.setName(meta.getName() + "$primaryKey");
primaryKey.setElements(pkElements);
primaryKey.setUnique(true);
primaryKey.setParent(meta, true);
primaryKey.setGenerated(generated);
meta.setPrimaryKey(primaryKey);
if (pkElements.size() == 1) {
// single pk element cannot be nullable
MetaAttribute pkElement = pkElements.get(0);
pkElement.setNullable(false);
}
}
}
}
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public ResourceInformation build(final Class<?> resourceClass) {
String resourceType = getResourceType(resourceClass);
String resourcePath = getResourcePath(resourceClass);
MetaDataObject meta = metaProvider.discoverMeta(resourceClass).asDataObject();
DefaultResourceInstanceBuilder instanceBuilder = new DefaultResourceInstanceBuilder(resourceClass);
BeanInformation beanInformation = BeanInformation.get(resourceClass);
ResourceFieldAccess resourceAccess = getResourceAccess(resourceClass);
List<ResourceField> fields = getResourceFields(resourceClass, resourceAccess, false);
handleIdOverride(resourceClass, fields);
Class<?> superclass = resourceClass.getSuperclass();
String superResourceType = superclass != Object.class
&& superclass.getAnnotation(MappedSuperclass.class) == null ? context.getResourceType(superclass)
: null;
TypeParser typeParser = context.getTypeParser();
ResourceInformation information =
new ResourceInformation(typeParser, resourceClass, resourceType, resourcePath, superResourceType,
instanceBuilder, fields, OffsetLimitPagingSpec.class);
information.setValidator(new JpaOptimisticLockingValidator(meta));
information.setAccess(resourceAccess);
information.setVersionRange(getVersionRange(resourceClass));
ResourceField idField = information.getIdField();
BeanAttributeInformation idAttr = beanInformation.getAttribute(idField.getUnderlyingName());
if (idAttr.getAnnotation(EmbeddedId.class).isPresent()) {
information.setIdStringMapper(new JpaIdMapper(meta));
}
return information;
}
public ComponentPropertyHolder(
Component component,
String path,
PropertyData inferredData,
PropertyHolder parent,
MetadataBuildingContext context) {
super( path, parent, inferredData.getPropertyClass(), context );
final XProperty embeddedXProperty = inferredData.getProperty();
setCurrentProperty( embeddedXProperty );
this.component = component;
this.isOrWithinEmbeddedId =
parent.isOrWithinEmbeddedId()
|| ( embeddedXProperty != null &&
( embeddedXProperty.isAnnotationPresent( Id.class )
|| embeddedXProperty.isAnnotationPresent( EmbeddedId.class ) ) );
this.isWithinElementCollection = parent.isWithinElementCollection() ||
parent instanceof CollectionPropertyHolder;
if ( embeddedXProperty != null ) {
// this.virtual = false;
this.embeddedAttributeName = embeddedXProperty.getName();
this.attributeConversionInfoMap = processAttributeConversions( embeddedXProperty );
}
else {
// could be either:
// 1) virtual/dynamic component
// 2) collection element/key
// temp
// this.virtual = true;
this.embeddedAttributeName = "";
this.attributeConversionInfoMap = processAttributeConversions( inferredData.getClassOrElement() );
}
}
public String buildInLineDirtyCheckingBodyFragment(JavassistEnhancementContext context, CtField currentValue) {
StringBuilder builder = new StringBuilder();
try {
// should ignore primary keys
if ( PersistentAttributesHelper.hasAnnotation( currentValue, Id.class )
|| PersistentAttributesHelper.hasAnnotation( currentValue, EmbeddedId.class ) ) {
return "";
}
String readFragment = inheritanceMetadata.isInherited() && !inheritanceMetadata.isVisible()
? "super." + inheritanceMetadata.getReaderName() + "()"
: "this." + currentValue.getName();
if ( currentValue.getType().isPrimitive() || currentValue.getType().isEnum() ) {
// primitives || enums
builder.append( String.format( " if ( %s != $1 )", readFragment ) );
}
else {
// if the field is a collection we return since we handle that in a separate method
for ( CtClass ctClass : currentValue.getType().getInterfaces() ) {
if ( ctClass.getName().equals( Collection.class.getName() ) ) {
// if the collection is not managed we should write it to the tracker
if ( context.isMappedCollection( currentValue ) ) {
return "";
}
}
}
builder.append(
String.format(
" if ( !Objects.deepEquals( %s, $1 ) )",
readFragment
)
);
}
builder.append( String.format( " { %s(\"%s\"); }", EnhancerConstants.TRACKER_CHANGER_NAME, currentValue.getName() ) );
}
catch (NotFoundException ignore) {
}
return builder.toString();
}
static Implementation wrap(
TypeDescription managedCtClass,
ByteBuddyEnhancementContext enhancementContext,
FieldDescription persistentField,
Implementation implementation) {
if ( enhancementContext.doDirtyCheckingInline( managedCtClass ) ) {
if ( enhancementContext.isCompositeClass( managedCtClass ) ) {
implementation = Advice.to( CodeTemplates.CompositeDirtyCheckingHandler.class ).wrap( implementation );
}
else if ( !EnhancerImpl.isAnnotationPresent( persistentField, Id.class )
&& !EnhancerImpl.isAnnotationPresent( persistentField, EmbeddedId.class )
&& !( persistentField.getType().asErasure().isAssignableTo( Collection.class )
&& enhancementContext.isMappedCollection( persistentField ) ) ) {
implementation = new InlineDirtyCheckingHandler( implementation, managedCtClass, persistentField.asDefined() );
}
if ( enhancementContext.isCompositeClass( persistentField.getType().asErasure() )
&& EnhancerImpl.isAnnotationPresent( persistentField, Embedded.class ) ) {
implementation = Advice.withCustomMapping()
.bind( CodeTemplates.FieldValue.class, persistentField )
.bind( CodeTemplates.FieldName.class, persistentField.getName() )
.to( CodeTemplates.CompositeFieldDirtyCheckingHandler.class )
.wrap( implementation );
}
}
return implementation;
}
@Override
protected void write(JpaRepositoryMeta merged, Class<?> entityClass) throws Exception {
Map<String, Object> model = new HashMap<>();
Field[] fields = entityClass.getDeclaredFields();
for (Field field : fields) {
Id declaredAnnotation = field.getDeclaredAnnotation(Id.class);
if (declaredAnnotation != null) {
merged.setIdType(field.getType().getSimpleName());
break;
}
EmbeddedId embeddedId = field.getDeclaredAnnotation(EmbeddedId.class);
if (embeddedId != null) {
merged.setIdType(field.getType().getSimpleName());
merged.addImportFullType(field.getType().getName());
}
}
ConfigChecker.notBlank(merged.getIdType(), "ID must not be null");
model.put("meta", merged);
File file = new File(getRepositoryFilePath(entityClass));
if (file.exists()) {
if (!overwrite) {
return;
}
file.delete();
logger.info("overwrite {}", file.getName());
}
file.createNewFile();
String mapper = renderTemplate("jpaRepository", model);
try (FileOutputStream os = new FileOutputStream(file)) {
os.write(mapper.getBytes());
}
}
public static Field findField(final Class<?> clazz, final String columnName) {
for (final Field field : clazz.getDeclaredFields()) {
if (field.getAnnotation(Embedded.class) != null || field.getAnnotation(EmbeddedId.class) != null) {
findField(field.getClass(), columnName);
} else {
if (columnName.equals(DbUtil.getColumnName(field))) {
return field;
}
}
}
return null;
}
private void setKey(T meta) {
if (meta.getPrimaryKey() == null) {
boolean generated = false;
ArrayList<MetaAttribute> pkElements = new ArrayList<>();
for (MetaAttribute attr : meta.getAttributes()) {
if (attr.getAnnotation(Id.class) != null || attr.getAnnotation(EmbeddedId.class) != null) {
pkElements.add(attr);
boolean attrGenerated = attr.getAnnotation(GeneratedValue.class) != null;
if (pkElements.size() == 1) {
generated = attrGenerated;
} else if (generated != attrGenerated) {
throw new IllegalStateException(
"cannot mix generated and not-generated primary key elements for " + meta.getId());
}
}
}
if (!pkElements.isEmpty()) {
MetaPrimaryKey primaryKey = new MetaPrimaryKey();
primaryKey.setName(meta.getName() + "$primaryKey");
primaryKey.setElements(pkElements);
primaryKey.setUnique(true);
primaryKey.setParent(meta, true);
primaryKey.setGenerated(generated);
meta.setPrimaryKey(primaryKey);
}
}
}
private boolean hasJpaAnnotations(MetaAttribute attribute) {
List<Class<? extends Annotation>> annotationClasses = Arrays.asList(Id.class, EmbeddedId.class, Column.class,
ManyToMany.class, ManyToOne.class, OneToMany.class, OneToOne.class, Version.class,
ElementCollection.class);
for (Class<? extends Annotation> annotationClass : annotationClasses) {
if (attribute.getAnnotation(annotationClass) != null) {
return true;
}
}
return false;
}
private static void collectIdNamesFromFields(final List<String> idList, final Class<?> clazz) {
for (final Field field : clazz.getDeclaredFields()) {
if (field.getAnnotation(Id.class) != null) {
idList.add(getPropertyName(field));
} else if (field.getAnnotation(EmbeddedId.class) != null) {
final Class<?> fieldType = field.getType();
// all fields have to be used as a composite ID
for (final Field idField : fieldType.getDeclaredFields()) {
idList.add(field.getName() + "." + getPropertyName(idField));
}
}
}
}
@Test
public void testGetNamesOfIdPropertiesFromASingleClassHavingAFieldAnnotatedWithEmbeddedId() throws Exception {
// GIVEN
final String simpleClassName = "EntityClass";
final String compositeIdPropertyName = "compositeKey";
final String id1PropertyName = "key1";
final String id2PropertyName = "key2";
final JPackage jp = jCodeModel.rootPackage();
final JDefinedClass jIdTypeClass = jp._class(JMod.PUBLIC, "IdType");
jIdTypeClass.annotate(Embeddable.class);
jIdTypeClass.field(JMod.PRIVATE, Integer.class, id1PropertyName);
jIdTypeClass.field(JMod.PRIVATE, String.class, id2PropertyName);
final JDefinedClass jClass = jp._class(JMod.PUBLIC, simpleClassName);
jClass.annotate(Entity.class);
jClass.field(JMod.PRIVATE, jIdTypeClass, compositeIdPropertyName).annotate(EmbeddedId.class);
buildModel(testFolder.getRoot(), jCodeModel);
compileModel(testFolder.getRoot());
final Class<?> entityClass = loadClass(testFolder.getRoot(), jClass.name());
// WHEN
final List<String> namesOfIdProperties = EntityUtils.getNamesOfIdProperties(entityClass);
// THEN
assertThat(namesOfIdProperties.size(), equalTo(2));
assertThat(namesOfIdProperties,
hasItems(compositeIdPropertyName + "." + id1PropertyName, compositeIdPropertyName + "." + id2PropertyName));
}
@Test
public void testGetNamesOfIdPropertiesFromASingleClassHavingAMethodAnnotatedWithEmbeddedId() throws Exception {
// GIVEN
final String simpleClassName = "EntityClass";
final String compositeIdPropertyName = "compositeKey";
final String id1PropertyName = "key1";
final String id2PropertyName = "key2";
final JPackage jp = jCodeModel.rootPackage();
final JDefinedClass jIdTypeClass = jp._class(JMod.PUBLIC, "IdType");
jIdTypeClass.annotate(Embeddable.class);
jIdTypeClass.field(JMod.PRIVATE, Integer.class, id1PropertyName);
jIdTypeClass.field(JMod.PRIVATE, String.class, id2PropertyName);
final JDefinedClass jClass = jp._class(JMod.PUBLIC, simpleClassName);
jClass.annotate(Entity.class);
final JMethod method = jClass.method(JMod.PUBLIC, jIdTypeClass, "getCompositeKey");
method.annotate(EmbeddedId.class);
method.body()._return(JExpr._null());
buildModel(testFolder.getRoot(), jCodeModel);
compileModel(testFolder.getRoot());
final Class<?> entityClass = loadClass(testFolder.getRoot(), jClass.name());
// WHEN
final List<String> namesOfIdProperties = EntityUtils.getNamesOfIdProperties(entityClass);
// THEN
assertThat(namesOfIdProperties.size(), equalTo(2));
assertThat(namesOfIdProperties,
hasItems(compositeIdPropertyName + "." + id1PropertyName, compositeIdPropertyName + "." + id2PropertyName));
}
@Override
protected Field findIdField(Class<?> clazz) {
Field idField;
idField = getReferencedField(clazz, Id.class);
if (idField == null) {
idField = getReferencedField(clazz, EmbeddedId.class);
}
return idField;
}
@Test
public void testGetNamesOfIdPropertiesFromAClassHierarchyHavingAMethodAnnotatedWithEmbeddedId() throws Exception {
// GIVEN
final String simpleClassNameBase = "EntityClass";
final String simpleClassNameB = "SubEntityClass";
final String compositeIdPropertyName = "compositeKey";
final String id1PropertyName = "key1";
final String id2PropertyName = "key2";
final JPackage jp = jCodeModel.rootPackage();
final JDefinedClass jIdTypeClass = jp._class(JMod.PUBLIC, "IdType");
jIdTypeClass.annotate(Embeddable.class);
jIdTypeClass.field(JMod.PRIVATE, Integer.class, id1PropertyName);
jIdTypeClass.field(JMod.PRIVATE, String.class, id2PropertyName);
final JDefinedClass jBaseClass = jp._class(JMod.PUBLIC, simpleClassNameBase);
jBaseClass.annotate(Entity.class);
jBaseClass.annotate(Inheritance.class).param("strategy", InheritanceType.TABLE_PER_CLASS);
final JMethod method = jBaseClass.method(JMod.PUBLIC, jIdTypeClass, "getCompositeKey");
method.annotate(EmbeddedId.class);
method.body()._return(JExpr._null());
final JDefinedClass jSubclass = jp._class(JMod.PUBLIC, simpleClassNameB)._extends(jBaseClass);
jSubclass.annotate(Entity.class);
buildModel(testFolder.getRoot(), jCodeModel);
compileModel(testFolder.getRoot());
final Class<?> entityClass = loadClass(testFolder.getRoot(), jSubclass.name());
// WHEN
final List<String> namesOfIdProperties = EntityUtils.getNamesOfIdProperties(entityClass);
// THEN
assertThat(namesOfIdProperties.size(), equalTo(2));
assertThat(namesOfIdProperties,
hasItems(compositeIdPropertyName + "." + id1PropertyName, compositeIdPropertyName + "." + id2PropertyName));
}
private void addResultMap() {
List<ResultMapping> resultMappings = new ArrayList<>();
entity.doWithProperties((PropertyHandler<MybatisPersistentProperty>) p -> {
if (p.isAnnotationPresent(EmbeddedId.class) || p.isEmbeddable()) {
((MybatisPersistentEntityImpl) entity)
.getRequiredPersistentEntity(p.getActualType()).doWithProperties(
(PropertyHandler<MybatisPersistentProperty>) ep -> {
resultMappings.add(
assistant.buildResultMapping(ep.getType(),
String.format("%s.%s", p.getName(),
ep.getName()),
ep.getColumnName(), ep.getType(),
ep.getJdbcType(), null, null, null,
null, ep.getSpecifiedTypeHandler(),
p.isIdProperty()
? Collections.singletonList(
ResultFlag.ID)
: null));
});
return;
}
resultMappings.add(assistant.buildResultMapping(p.getType(), p.getName(),
p.getColumnName(), p.getType(), p.getJdbcType(), null, null, null,
null, p.getSpecifiedTypeHandler(),
p.isIdProperty() ? Collections.singletonList(ResultFlag.ID) : null));
});
addResultMap(RESULT_MAP, entity.getType(), resultMappings);
}
private String buildIdCaluse(boolean clearly, boolean byId) {
if (!entity.hasIdProperty()) {
return null;
}
MybatisPersistentProperty p = entity.getRequiredIdProperty();
if (p.isAnnotationPresent(EmbeddedId.class)) {
return findNormalColumns(((MybatisPersistentEntityImpl) this.entity)
.getRequiredPersistentEntity(p.getActualType()))
.stream()
.map(ep -> ep.getColumnName() + " = "
+ (null != ep.getSpecifiedTypeHandler()
? String.format(
"#{%s,jdbcType=%s,typeHandler=%s}",
clearly ? ((byId ? "__id"
: p.getName()) + '.'
+ ep.getName())
: ep.getName(),
ep.getJdbcType().name(),
ep.getSpecifiedTypeHandler()
.getName())
: String.format("#{%s,jdbcType=%s}", clearly
? ((byId ? "__id" : p.getName()) + '.'
+ ep.getName())
: ep.getName(),
ep.getJdbcType().name())))
.collect(Collectors.joining(" and "));
}
return p.getColumnName() + " = "
+ (null != p.getSpecifiedTypeHandler()
? String.format("#{%s,jdbcType=%s,typeHandler=%s}",
byId ? "__id" : p.getName(), p.getJdbcType().name(),
p.getSpecifiedTypeHandler().getName())
: String.format("#{%s,jdbcType=%s}", byId ? "__id" : p.getName(),
p.getJdbcType().name()));
}
@EmbeddedId
@AttributeOverrides({
@AttributeOverride(name = "studentId", column = @Column(name = "STUDENT_ID", nullable = false, precision = 5, scale = 0)),
@AttributeOverride(name = "classesId", column = @Column(name = "CLASSES_ID", nullable = false, precision = 4, scale = 0)),
@AttributeOverride(name = "status", column = @Column(name = "STU_CLASSES_STATUS", nullable = false, length = 1)) })
public StudentClassesId getId() {
return this.id;
}
/**
* Gets the embedded id.
*
* @return the embedded id
*/
@EmbeddedId
@AttributeOverrides({
@AttributeOverride(name = "issue", column = @Column(name = "EMBEDDED_ID_ISSUE")),
@AttributeOverride(name = "ballotId", column = @Column(name = "EMBEDDED_ID_BALLOT_ID")),
@AttributeOverride(name = "intressentId", column = @Column(name = "EMBEDDED_ID_INTRESSENT_ID")),
@AttributeOverride(name = "concern", column = @Column(name = "EMBEDDED_ID_CONCERN"))
})
public VoteDataEmbeddedId getEmbeddedId() {
return embeddedId;
}
/**
* Gets the value of the embeddedId property.
*
* @return
* possible object is
* {@link ViewRiksdagenPartyBallotSupportAnnualSummaryEmbeddedId }
*
*/
@EmbeddedId
@AttributeOverrides({
@AttributeOverride(name = "date", column = @Column(name = "EMBEDDED_ID_DATE")),
@AttributeOverride(name = "party", column = @Column(name = "EMBEDDED_ID_PARTY")),
@AttributeOverride(name = "otherParty", column = @Column(name = "EMBEDDED_ID_OTHER_PARTY"))
})
public ViewRiksdagenPartyBallotSupportAnnualSummaryEmbeddedId getEmbeddedId() {
return embeddedId;
}
/**
* Gets the value of the embeddedId property.
*
* @return
* possible object is
* {@link ViewRiksdagenPartyCoalationAgainstAnnualSummaryEmbeddedId }
*
*/
@EmbeddedId
@AttributeOverrides({
@AttributeOverride(name = "year", column = @Column(name = "EMBEDDED_ID_YEAR", precision = 10, scale = 0)),
@AttributeOverride(name = "groupAgainst", column = @Column(name = "EMBEDDED_ID_GROUP_AGAINST"))
})
public ViewRiksdagenPartyCoalationAgainstAnnualSummaryEmbeddedId getEmbeddedId() {
return embeddedId;
}
/**
* Gets the value of the embeddedId property.
*
* @return
* possible object is
* {@link RiksdagenCommitteeEmbeddedId }
*
*/
@EmbeddedId
@AttributeOverrides({
@AttributeOverride(name = "detail", column = @Column(name = "EMBEDDED_ID_DETAIL")),
@AttributeOverride(name = "orgCode", column = @Column(name = "EMBEDDED_ID_ORG_CODE"))
})
public RiksdagenCommitteeEmbeddedId getEmbeddedId() {
return embeddedId;
}
/**
* Gets the value of the embeddedId property.
*
* @return
* possible object is
* {@link RiksdagenVoteDataBallotPoliticianPeriodSummaryEmbeddedId }
*
*/
@EmbeddedId
@AttributeOverrides({
@AttributeOverride(name = "voteDate", column = @Column(name = "EMBEDDED_ID_VOTE_DATE")),
@AttributeOverride(name = "intressentId", column = @Column(name = "EMBEDDED_ID_INTRESSENT_ID"))
})
public RiksdagenVoteDataBallotPoliticianPeriodSummaryEmbeddedId getEmbeddedId() {
return embeddedId;
}
/**
* Gets the value of the embeddedId property.
*
* @return
* possible object is
* {@link RiksdagenVoteDataBallotEmbeddedId }
*
*/
@EmbeddedId
@AttributeOverrides({
@AttributeOverride(name = "ballotId", column = @Column(name = "EMBEDDED_ID_BALLOT_ID")),
@AttributeOverride(name = "concern", column = @Column(name = "EMBEDDED_ID_CONCERN")),
@AttributeOverride(name = "issue", column = @Column(name = "EMBEDDED_ID_ISSUE"))
})
public RiksdagenVoteDataBallotEmbeddedId getEmbeddedId() {
return embeddedId;
}