@Any(metaColumn = @Column(name = "property_type")) @AnyMetaDef(idType = "long", metaType = "string", metaValues = { @MetaValue(targetEntity = example.Tractor.class, value = "tractor"), @MetaValue(targetEntity = example.Smartphone.class, value = "smartphone") }) @JoinColumn(name = "property_id") @ToOne public Device getMyStuff() { return myStuff; }
private void fillMetaDefs(final AttributeAccessor attribute, final GeneratorDialect dialect) { final AnyMetaDef metaDef = attribute.getAnnotation(AnyMetaDef.class); if (metaDef == null) { throw new IllegalArgumentException("Missing AnyMetaDef for " + attribute); } for (final MetaValue metaValue : metaDef.metaValues()) { this.anyClasses.put(metaValue.targetEntity(), PrimitiveColumnExpression.create(metaValue.value(), dialect)); } }