@Override protected NodeData getAnnotationNodes(String enclosingClass, String fieldName, String mappedClass) { final List<Expression> joinColumns = getJoinColumns(enclosingClass, fieldName, mappedClass); if (joinColumns != null && joinColumns.size() > 1) { final Comment fixme = new BlockComment("\nFIXME: JPA_CONVERSION\n" + "For compound primary keys, make sure the join columns are in the correct order.\n"); AnnotationExpr annotation = new SingleMemberAnnotationExpr(new NameExpr(SIMPLE_NAME), new ArrayInitializerExpr(joinColumns)); annotation.setComment(fixme); return new NodeData(annotation, new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), SIMPLE_NAME), false, false), Collections.singletonList(new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), "PrimaryKeyJoinColumn"), false, false))); } return null; } }
@Override protected NodeData getAnnotationNodes(String enclosingClass, String fieldName, String mappedClass) { final FieldDescriptor fd = OjbUtil.findFieldDescriptor(mappedClass, fieldName, descriptorRepositories); if (fd != null) { final Class<?> fc = ResolverUtil.getType(enclosingClass, fieldName); if (isEnum(fc)) { final Comment fixme = new BlockComment("\nFIXME:\n" + "Enums must be annotated with the @Enumerated annotation.\n " + "The @Enumerated annotation should set the EnumType.\n" + "If the EnumType is not set, then the Enumerated annotation is defaulted to EnumType.ORDINAL.\n" + "This conversion program cannot tell whether EnumType.ORDINAL is the appropriate EnumType."); AnnotationExpr enumerated = new NormalAnnotationExpr(new NameExpr(SIMPLE_NAME), Collections.singletonList(new MemberValuePair("value", new NameExpr("EnumType.")))); enumerated.setComment(fixme); return new NodeData(enumerated, new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), SIMPLE_NAME), false, false), Collections.singletonList(new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), "TemporalType"), false, false))); } } return null; }
@Override protected NodeData getAnnotationNodes(String enclosingClass, String fieldName, String mappedClass) { final List<Expression> joinColumns = getJoinColumns(enclosingClass, fieldName, mappedClass); if (joinColumns != null && joinColumns.size() > 1) { final Comment fixme = new BlockComment("\nFIXME: JPA_CONVERSION\n" + "For compound primary keys, make sure the join columns are in the correct order.\n"); AnnotationExpr annotation = new SingleMemberAnnotationExpr(new NameExpr(SIMPLE_NAME), new ArrayInitializerExpr(joinColumns)); annotation.setComment(fixme); return new NodeData(annotation, new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), SIMPLE_NAME), false, false), Arrays.asList( new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PrimaryKeyJoinColumnResolver.PACKAGE),PrimaryKeyJoinColumnResolver.SIMPLE_NAME), false, false) , new ImportDeclaration(new QualifiedNameExpr(new NameExpr(JoinColumnResolver.PACKAGE),JoinColumnResolver.SIMPLE_NAME), false, false) )); } return null; } }