public void addField(Field field) { if (field == null) throw new NullPointerException("field is null"); if (field instanceof Id) { if (attributes == null) attributes = new Attributes(); attributes.getId().add((Id) field); } else if (field instanceof Basic) { if (attributes == null) attributes = new Attributes(); attributes.getBasic().add((Basic) field); } else if (field instanceof Transient) { if (attributes == null) attributes = new Attributes(); attributes.getTransient().add((Transient) field); } else if (field instanceof AttributeOverride) { throw new IllegalArgumentException("Mapped super class does not support attribute override"); } else { throw new IllegalArgumentException("Unknown field type " + field.getClass()); } }
for (final Id id : attributes.getId()) { this.fields.put(id.getName(), id); for (final Basic basic : attributes.getBasic()) { this.fields.put(basic.getName(), basic); for (final RelationField relationField : attributes.getOneToOne()) { this.relations.put(relationField.getName(), relationField); for (final RelationField relationField : attributes.getOneToMany()) { this.relations.put(relationField.getName(), relationField); for (final RelationField relationField : attributes.getManyToOne()) { this.relations.put(relationField.getName(), relationField); for (final RelationField relationField : attributes.getManyToMany()) { this.relations.put(relationField.getName(), relationField);
Map<String, RelationField> rightRelationships = rightAttributes.getRelationshipFieldMap(); final Attributes leftAttributes = leftEntity.getAttributes(); Map<String, RelationField> leftRelationships = leftAttributes.getRelationshipFieldMap(); leftOneToOne.setSyntheticField(leftSynthetic); setCascade(rightRole, leftOneToOne); addRelationship(leftOneToOne, leftRelationships, leftAttributes.getOneToOne()); rightOneToOne.setMappedBy(leftFieldName); setCascade(leftRole, rightOneToOne); addRelationship(rightOneToOne, rightRelationships, rightAttributes.getOneToOne()); leftOneToMany.setMappedBy(rightFieldName); setCascade(rightRole, leftOneToMany); addRelationship(leftOneToMany, leftRelationships, leftAttributes.getOneToMany()); rightManyToOne.setSyntheticField(rightSynthetic); setCascade(leftRole, rightManyToOne); addRelationship(rightManyToOne, rightRelationships, rightAttributes.getManyToOne()); leftManyToOne.setSyntheticField(leftSynthetic); setCascade(rightRole, leftManyToOne); addRelationship(leftManyToOne, leftRelationships, leftAttributes.getManyToOne()); rightOneToMany.setMappedBy(leftFieldName); setCascade(leftRole, rightOneToMany); addRelationship(rightOneToMany, rightRelationships, rightAttributes.getOneToMany()); leftManyToMany.setSyntheticField(leftSynthetic);
/** * Create an instance of {@link Attributes } */ public Attributes createAttributes() { return new Attributes(); }
if (entity.getAttributes().isEmpty()){ entity.setAttributes(null);
for (final Id id : attributes.getId()) { this.fields.put(id.getName(), id); for (final Basic basic : attributes.getBasic()) { this.fields.put(basic.getName(), basic); for (final RelationField relationField : attributes.getOneToOne()) { this.relations.put(relationField.getName(), relationField); for (final RelationField relationField : attributes.getOneToMany()) { this.relations.put(relationField.getName(), relationField); for (final RelationField relationField : attributes.getManyToOne()) { this.relations.put(relationField.getName(), relationField); for (final RelationField relationField : attributes.getManyToMany()) { this.relations.put(relationField.getName(), relationField);
final Map<String, RelationField> rightRelationships = rightAttributes.getRelationshipFieldMap(); final Attributes leftAttributes = leftEntity.getAttributes(); final Map<String, RelationField> leftRelationships = leftAttributes.getRelationshipFieldMap(); leftOneToOne.setSyntheticField(leftSynthetic); setCascade(rightRole, leftOneToOne); addRelationship(leftOneToOne, leftRelationships, leftAttributes.getOneToOne()); rightOneToOne.setMappedBy(leftFieldName); setCascade(leftRole, rightOneToOne); addRelationship(rightOneToOne, rightRelationships, rightAttributes.getOneToOne()); leftOneToMany.setMappedBy(rightFieldName); setCascade(rightRole, leftOneToMany); addRelationship(leftOneToMany, leftRelationships, leftAttributes.getOneToMany()); rightManyToOne.setSyntheticField(rightSynthetic); setCascade(leftRole, rightManyToOne); addRelationship(rightManyToOne, rightRelationships, rightAttributes.getManyToOne()); leftManyToOne.setSyntheticField(leftSynthetic); setCascade(rightRole, leftManyToOne); addRelationship(leftManyToOne, leftRelationships, leftAttributes.getManyToOne()); rightOneToMany.setMappedBy(leftFieldName); setCascade(leftRole, rightOneToMany); addRelationship(rightOneToMany, rightRelationships, rightAttributes.getOneToMany()); leftManyToMany.setSyntheticField(leftSynthetic);
/** * Create an instance of {@link Attributes } */ public Attributes createAttributes() { return new Attributes(); }
if (entity.getAttributes() != null && entity.getAttributes().isEmpty()) { entity.setAttributes(null);
for (Id id : attributes.getId()) { String name = id.getName(); ids.put(name, id); for (Basic basic : attributes.getBasic()) { String name = basic.getName(); fields.put(name, basic); for (RelationField relationField : attributes.getOneToOne()) { String name = relationField.getName(); relations.put(name, relationField); for (RelationField relationField : attributes.getOneToMany()) { String name = relationField.getName(); relations.put(name, relationField); for (RelationField relationField : attributes.getManyToOne()) { String name = relationField.getName(); relations.put(name, relationField); for (RelationField relationField : attributes.getManyToMany()) { String name = relationField.getName(); relations.put(name, relationField);
public void addField(final Field field) { if (field == null) throw new NullPointerException("field is null"); if (field instanceof Id) { if (attributes == null) attributes = new Attributes(); attributes.getId().add((Id) field); } else if (field instanceof Basic) { if (attributes == null) attributes = new Attributes(); attributes.getBasic().add((Basic) field); } else if (field instanceof Transient) { if (attributes == null) attributes = new Attributes(); attributes.getTransient().add((Transient) field); } else if (field instanceof AttributeOverride) { throw new IllegalArgumentException("Mapped super class does not support attribute override"); } else { throw new IllegalArgumentException("Unknown field type " + field.getClass()); } }
final Map<String, RelationField> rightRelationships = rightAttributes.getRelationshipFieldMap(); final Attributes leftAttributes = leftEntity.getAttributes(); final Map<String, RelationField> leftRelationships = leftAttributes.getRelationshipFieldMap(); leftOneToOne.setSyntheticField(leftSynthetic); setCascade(rightRole, leftOneToOne); addRelationship(leftOneToOne, leftRelationships, leftAttributes.getOneToOne()); rightOneToOne.setMappedBy(leftFieldName); setCascade(leftRole, rightOneToOne); addRelationship(rightOneToOne, rightRelationships, rightAttributes.getOneToOne()); leftOneToMany.setMappedBy(rightFieldName); setCascade(rightRole, leftOneToMany); addRelationship(leftOneToMany, leftRelationships, leftAttributes.getOneToMany()); rightManyToOne.setSyntheticField(rightSynthetic); setCascade(leftRole, rightManyToOne); addRelationship(rightManyToOne, rightRelationships, rightAttributes.getManyToOne()); leftManyToOne.setSyntheticField(leftSynthetic); setCascade(rightRole, leftManyToOne); addRelationship(leftManyToOne, leftRelationships, leftAttributes.getManyToOne()); rightOneToMany.setMappedBy(leftFieldName); setCascade(leftRole, rightOneToMany); addRelationship(rightOneToMany, rightRelationships, rightAttributes.getOneToMany()); leftManyToMany.setSyntheticField(leftSynthetic);
/** * Create an instance of {@link Attributes } * */ public Attributes createAttributes() { return new Attributes(); }
if (entity.getAttributes() != null && entity.getAttributes().isEmpty()) { entity.setAttributes(null);
for (final Id id : attributes.getId()) { final String name = id.getName(); ids.put(name, id); for (final Basic basic : attributes.getBasic()) { final String name = basic.getName(); fields.put(name, basic); for (final RelationField relationField : attributes.getOneToOne()) { final String name = relationField.getName(); relations.put(name, relationField); for (final RelationField relationField : attributes.getOneToMany()) { final String name = relationField.getName(); relations.put(name, relationField); for (final RelationField relationField : attributes.getManyToOne()) { final String name = relationField.getName(); relations.put(name, relationField); for (final RelationField relationField : attributes.getManyToMany()) { final String name = relationField.getName(); relations.put(name, relationField);
public void addField(final Field field) { if (field == null) throw new NullPointerException("field is null"); if (field instanceof Id) { if (attributes == null) attributes = new Attributes(); attributes.getId().add((Id) field); } else if (field instanceof Basic) { if (attributes == null) attributes = new Attributes(); attributes.getBasic().add((Basic) field); } else if (field instanceof Transient) { if (attributes == null) attributes = new Attributes(); attributes.getTransient().add((Transient) field); } else if (field instanceof AttributeOverride) { throw new IllegalArgumentException("Mapped super class does not support attribute override"); } else { throw new IllegalArgumentException("Unknown field type " + field.getClass()); } }
entity.setAttributes(new Attributes());