Refine search
@Entity(name = "Match") @Table(name = "Match", catalog = "hibernate_orm_test_collation", schema = "dbo") public static class Match { @Id long id; String match; @ElementCollection @CollectionTable(catalog = "hibernate_orm_test_collation", schema = "dbo") private Map<Integer, Integer> timeline = new TreeMap<>(); }
/** * @author Steve Ebersole */ @Entity public class Container { @Id private Integer id; @ElementCollection private List<Item> items; }
/** * @return the authorizedGrantTypes */ @ElementCollection(fetch = FetchType.EAGER) @CollectionTable( name="client_grant_type", joinColumns=@JoinColumn(name="owner_id") ) @Column(name="grant_type") public Set<String> getGrantTypes() { return grantTypes; }
@Entity public class WealthyPerson extends Person { @ElementCollection protected Set<Address> vacationHomes = new HashSet<Address>(); @ElementCollection protected Set<Address> legacyVacationHomes = new HashSet<Address>(); @ElementCollection @CollectionTable(name = "WelPers_VacHomes", indexes = @Index( columnList = "countryName, type_id")) protected Set<Address> explicitVacationHomes = new HashSet<Address>(); }
@Entity(name = "A") @Audited public static class A extends AbstractEntity { @ElementCollection private Map<B, C> map = new HashMap<>(); public Map<B, C> getMap() { return map; } public void setMap(Map<B, C> map) { this.map = map; } }
@ElementCollection( targetClass = String.class, fetch = FetchType.EAGER ) @CollectionType( type = "DefaultableList" ) @JoinColumn( name = "ENT_ID" ) @OrderColumn( name = "POS" ) @Column(name = "VAL") public List getValues() { return values; }
@ElementCollection(fetch = FetchType.EAGER) @CollectionTable( name = "investments", joinColumns = @JoinColumn( name = "customer_id" ) ) public List<Investment> getInvestments() { return investments; } public void setInvestments(List<Investment> investments) {
@ElementCollection( fetch = FetchType.EAGER ) @MapKeyColumn( name = "NAME" ) @Lob @Column( name = "VALUE", length = 65535 ) @Override public Map<String, String> getParameters() { return parameterMap; }
@ElementCollection @JoinColumn @JoinTable(name = "T_NICKNAMES_D") @OrderBy( "desc" ) public Set<String> getNickNamesDescendingNaturalSort() { return nickNamesDescendingNaturalSort; }
private void readElementCollection(DeployBeanPropertyAssocMany<?> prop, ElementCollection elementCollection) { if (!elementCollection.targetClass().equals(void.class)) { prop.setTargetType(elementCollection.targetClass()); prop.setDbColumn(column.name()); prop.setDbLength(column.length()); prop.setDbScale(column.scale()); prop.getTableJoin().addJoinColumn(true, collectionTable.joinColumns(), localTable);
public EcInfo(Attribute attr, Attribute idAttr) { attr.attache = this; ElementCollection ec = attr.field.getAnnotation(ElementCollection.class); targetClass = ec.targetClass(); Class<?> type = attr.field.getType(); if (type.isArray()) { assert (ct.name().length() > 0) : "Please sepcify the table for " + attr.field.getName(); StringBuilder selectBuf = new StringBuilder("SELECT "); StringBuilder insertBuf = new StringBuilder("INSERT INTO "); StringBuilder clearBuf = new StringBuilder("DELETE FROM "); clearBuf.append(ct.name()).append(" WHERE "); selectBuf.append(attr.columnName); selectBuf.append(" FROM ").append(ct.name()).append(", ").append(attr.table); selectBuf.append(" WHERE "); for (JoinColumn jc : ct.joinColumns()) { selectBuf.append(ct.name()).append(".").append(jc.name()).append("="); if (jc.referencedColumnName().length() == 0) { selectBuf.append(idAttr.table).append(".").append(idAttr.columnName); valuesBuf.append(idAttr.table).append(".").append(idAttr.columnName); clearBuf.append(ct.name()).append(".").append(jc.name()).append("=?"); } else { selectBuf.append(attr.table).append(".").append(jc.referencedColumnName());
@Test public void testNoChildren() throws Exception { reader = getReader( Entity2.class, "field1", "element-collection.orm1.xml" ); assertAnnotationPresent( ElementCollection.class ); assertAnnotationNotPresent( OrderBy.class ); assertAnnotationNotPresent( OrderColumn.class ); assertAnnotationNotPresent( MapKey.class ); assertAnnotationNotPresent( MapKeyClass.class ); assertAnnotationNotPresent( MapKeyTemporal.class ); assertAnnotationNotPresent( MapKeyEnumerated.class ); assertAnnotationNotPresent( MapKeyColumn.class ); assertAnnotationNotPresent( MapKeyJoinColumns.class ); assertAnnotationNotPresent( MapKeyJoinColumn.class ); assertAnnotationNotPresent( Column.class ); assertAnnotationNotPresent( Temporal.class ); assertAnnotationNotPresent( Enumerated.class ); assertAnnotationNotPresent( Lob.class ); assertAnnotationNotPresent( AttributeOverride.class ); assertAnnotationNotPresent( AttributeOverrides.class ); assertAnnotationNotPresent( AssociationOverride.class ); assertAnnotationNotPresent( AssociationOverrides.class ); assertAnnotationNotPresent( CollectionTable.class ); assertAnnotationNotPresent( Access.class ); ElementCollection relAnno = reader.getAnnotation( ElementCollection.class ); assertEquals( FetchType.LAZY, relAnno.fetch() ); assertEquals( void.class, relAnno.targetClass() ); }
protected boolean supportsElementCollection(Field field) { ElementCollection otm = field.getAnnotation(ElementCollection.class); if (otm.fetch() == FetchType.LAZY) { assert (false) : "Doesn't support laz fetch: " + field.getName(); return false; } CollectionTable ct = field.getAnnotation(CollectionTable.class); if (ct == null) { assert (false) : "No collection table sepcified for " + field.getName(); return false; } return true; }
final Class<?> targetElement = elementCollectionAnn.targetClass(); collectionBinder.setTargetEntity( context.getBootstrapContext().getReflectionManager().toXClass( targetElement )
@Entity( name = "Movie" ) public static class Movie { @Id private Integer id; String title; @ElementCollection // @OneToMany Map<Person,String> cast; }
/** * @return the defaultACRvalues */ @ElementCollection(fetch = FetchType.EAGER) @CollectionTable( name="client_default_acr_value", joinColumns=@JoinColumn(name="owner_id") ) @Column(name="default_acr_value") public Set<String> getDefaultACRvalues() { return defaultACRvalues; }
@ElementCollection @CollectionTable(name = "user_email_addresses2", joinColumns = @JoinColumn(name = "user_id", referencedColumnName = "id")) public Set<EmailAddress> getEmailAddresses2() { return emailAddresses2; }
assertAnnotationPresent( Access.class ); ElementCollection relAnno = reader.getAnnotation( ElementCollection.class ); assertEquals( FetchType.EAGER, relAnno.fetch() ); assertEquals( Entity3.class, relAnno.targetClass() ); assertEquals( AccessType.PROPERTY, reader.getAnnotation( Access.class )
fetchType = elementCollection.fetch();
Map mapper = (Map) objects.get(key).get(f.getName()); if (mapper == null) continue; Class targetClass = ec.targetClass(); Class mapKeyClass = mkc.value(); Map<Object, Object> fieldValue = new HashMap();