private void buildMapKeyJoinColumns(List<Annotation> annotationList, Element element) { MapKeyJoinColumn[] joinColumns = getMapKeyJoinColumns( element ); if ( joinColumns.length > 0 ) { AnnotationDescriptor ad = new AnnotationDescriptor( MapKeyJoinColumns.class ); ad.setValue( "value", joinColumns ); annotationList.add( AnnotationFactory.create( ad ) ); } }
public XAnnotation<?> createMapKeyJoinColumns( Collection<MapKeyJoinColumn> source) { return transform( MapKeyJoinColumns.class, javax.persistence.MapKeyJoinColumn.class, source, new Transformer<MapKeyJoinColumn, XAnnotation<javax.persistence.MapKeyJoinColumn>>() { public XAnnotation<javax.persistence.MapKeyJoinColumn> transform( MapKeyJoinColumn input) { return createMapKeyJoinColumn(input); } }); }
@OneToMany(mappedBy="portfolio",cascade = {CascadeType.ALL}, fetch = FetchType.EAGER, orphanRemoval=true) @Fetch(FetchMode.SUBSELECT) @MapKeyJoinColumns({ @MapKeyJoinColumn(name="symbol",referencedColumnName="symbol"), @MapKeyJoinColumn(name="isin",referencedColumnName="isin") }) public Map<Stock, PortfolioShare> getListShares() { return listShares; }