private void getMapKeyColumn(List<Annotation> annotationList, Element element) { Element subelement = element != null ? element.element( "map-key-column" ) : null; if ( subelement != null ) { AnnotationDescriptor ad = new AnnotationDescriptor( MapKeyColumn.class ); copyStringAttribute( ad, subelement, "name", false ); copyBooleanAttribute( ad, subelement, "unique" ); copyBooleanAttribute( ad, subelement, "nullable" ); copyBooleanAttribute( ad, subelement, "insertable" ); copyBooleanAttribute( ad, subelement, "updatable" ); copyStringAttribute( ad, subelement, "column-definition", false ); copyStringAttribute( ad, subelement, "table", false ); copyIntegerAttribute( ad, subelement, "length" ); copyIntegerAttribute( ad, subelement, "precision" ); copyIntegerAttribute( ad, subelement, "scale" ); annotationList.add( AnnotationFactory.create( ad ) ); } }
@ElementCollection @MapKeyColumn(name = "parameters_idx") @Column(name = "parameters_elt") @CollectionTable(name = "info_parameters") public Map<String, String> getParameters() { return parameters; }
/** * @return the attributes */ @ElementCollection(fetch = FetchType.EAGER) @CollectionTable(name = "MCRUserAttr", joinColumns = @JoinColumn(name = "id"), indexes = { @Index(name = "MCRUserAttributes", columnList = "name, value"), @Index(name = "MCRUserValues", columnList = "value") }) @MapKeyColumn(name = "name", length = 128) @Column(name = "value", length = 255) public Map<String, String> getAttributes() { return attributes; }
/** * Returns all set parameters of the job. * * @return the job parameters */ @ElementCollection(fetch = FetchType.EAGER) @CollectionTable(name = "MCRJobParameter", joinColumns = @JoinColumn(name = "jobID")) @MapKeyColumn(name = "paramKey", length = 128) @Column(name = "paramValue", length = 255) public Map<String, String> getParameters() { return parameters; }
/** * 获取属性 * * @return 属性 */ @ElementCollection(fetch = FetchType.EAGER) @CollectionTable(name = "xx_plugin_config_attribute") @MapKeyColumn(name = "name", length = 100) public Map<String, String> getAttributes() { return attributes; }
@ElementCollection(fetch = FetchType.EAGER) @CollectionTable(name = "User_Message_Attr", joinColumns = { @JoinColumn(referencedColumnName = "Id", name = "PayloadId") }) @Column(name = "Value") @MapKeyColumn(name = "Key") public Map<String, String> getAttr() { return attr; }
@ElementCollection @CollectionTable(name = "bucket_object_version_tags", foreignKey = @ForeignKey(name = RdbmsConstants.PREFIX + "bucket_object_version_tags_fk_bucket_object_version"), joinColumns = { @JoinColumn(name = "bucket_id", referencedColumnName = "bucket_id"), @JoinColumn(name = "object_name", referencedColumnName = "object_name"), @JoinColumn(name = "version_uuid", referencedColumnName = "version_uuid") }) @MapKeyColumn(name = "tag", nullable = false) @Column(name = "value", nullable = false) public Map<String, String> getTags() { return tags; }
@ElementCollection @CollectionTable(name = "account_tags", foreignKey = @ForeignKey(name = RdbmsConstants.PREFIX + "account_tags_fk_user_account"), joinColumns = { @JoinColumn(name = "account_id", referencedColumnName = "id") }) @MapKeyColumn(name = "tag", nullable = false) @Column(name = "value", nullable = false) public Map<String, String> getTags() { return tags; }
@ElementCollection @CollectionTable(name = "storage_tags", foreignKey = @ForeignKey(name = RdbmsConstants.PREFIX + "storage_tags_fk_storage"), joinColumns = { @JoinColumn(name = "owner_id", referencedColumnName = "owner_id"), @JoinColumn(name = "storage_name", referencedColumnName = "name") }) @MapKeyColumn(name = "tag", nullable = false) @Column(name = "value", nullable = false) public Map<String, String> getTags() { return tags; }
private static GeneratorColumn buildKeyColumn(final GeneratorTable table, final MapKeyColumn keyColumn, final String defaultKeyColumn) { if (keyColumn != null && keyColumn.name().length() > 0) { return table.resolveColumn(keyColumn.name()); } return table.resolveColumn(defaultKeyColumn); }
/** * Creates a new map property. * * @param sourceClass * the description of the current inspected class that contains this property * @param attribute * the accessor of the represented attribute * @param override * the configured assocation override */ @SuppressWarnings("unchecked") public MapProperty(final EntityClass<?> sourceClass, final AttributeAccessor attribute, final AssociationOverride override) { super(sourceClass, attribute, override, 1); // Initialize the key description final MapKeyClass keyClassAnnotation = attribute.getAnnotation(MapKeyClass.class); this.keyClass = getPropertyArgument(attribute, keyClassAnnotation != null ? keyClassAnnotation.value() : (Class<K>) void.class, 0); this.keyEntityClass = sourceClass.getContext().getDescription(this.keyClass); if (getMappedBy() != null) { this.keyConverter = null; this.keyColumn = null; } else { if (this.keyEntityClass != null) { // Entity key this.keyConverter = null; this.keyColumn = buildKeyColumn(getTable(), attribute.getAnnotation(MapKeyJoinColumn.class), attribute.getName() + "_KEY"); } else { // Primitive key this.keyConverter = PrimitiveProperty.createConverter(attribute, this.keyClass, true); this.keyColumn = buildKeyColumn(getTable(), attribute.getAnnotation(MapKeyColumn.class), attribute.getName() + "_KEY"); } } }
@EagerFetch @ElementCollection @JoinTable(name = "resource_instance_metadata", joinColumns = @JoinColumn(name = "resource_instance_id")) @MapKeyColumn(name = "meta_name") @Column(name = "meta_val") public Map<String, String> getMetadata() { return metadata; }
@ElementCollection(targetClass = String.class) @CollectionTable(name = "I18NLabel_Values") @MapKeyColumn(name="locale", length = 128) @MapKeyClass(Locale.class) @Column(name="value", length = 10 * 1024) public Map<Locale, String> getValues() { return values; }
@ElementCollection @CollectionTable(name = "RecordCollection_Locales", joinColumns = @JoinColumn(name = "recordCollection_id")) @MapKeyColumn(name = "locale", length = 128) @MapKeyClass(Locale.class) public Set<Locale> getLocales() { return locales; }
public MapKeyColumnDelegator(MapKeyColumn column) { this.column = column; }
@ElementCollection @MapKeyColumn(name = "color") @Column(name = "shape") public Map<Color, Shape> getColorShapeMap() { return colorShapeMap; }