APT generates invalid code for a field which is an interface type

Asked by FilipVercauteren

Hi,

I noticed when an entity contains a field which is an interface, a . is prefixed before the interface field declaration in the generated source. This issue also appears when you have java.sql.Blob or Clob fields (which are interfaces).
I would be great to have some kind of an @ignore annotation (without making the field transient) , to have such fields being skipped by the APT processor.

e.g.

import com.mysema.query.annotations.Entity;

interface SomeInterface {
}

@Entity
public class InterfaceBug {

 private SomeInterface someInterface;

 public void setSomeInterface(SomeInterface someInterface) {
  this.someInterface = someInterface;
 }

 public SomeInterface getSomeInterface() {
  return someInterface;
 }
}

generates (notice the . ):

import com.mysema.query.grammar.types.*;

/**
 * MetadataInterfaceBug is a Querydsl query type for InterfaceBug
 *
 */
public class MetadataInterfaceBug extends Path.PEntity<com.agfa.ris.server.model.InterfaceBug>{
 public static final MetadataInterfaceBug interfaceBug = new MetadataInterfaceBug("interfaceBug");
 public .MetadataSomeInterface someInterface;
    public .MetadataSomeInterface _someInterface() {
         if (someInterface == null) someInterface = new .MetadataSomeInterface(PathMetadata.forProperty(this,"someInterface"));
         return someInterface;
    }

    public MetadataInterfaceBug(java.lang.String path) {
       this(com.agfa.ris.server.model.InterfaceBug.class, path);
    }
    public MetadataInterfaceBug(Class<? extends com.agfa.ris.server.model.InterfaceBug> cl, java.lang.String path) {
       super(cl, "InterfaceBug", path);
       _someInterface();
    }
    public MetadataInterfaceBug(PathMetadata<?> metadata) {
      super(com.agfa.ris.server.model.InterfaceBug.class, "InterfaceBug", metadata);
    }
}

Thanks in advance !

Filip

Question information

Language:
English Edit question
Status:
Solved
For:
Querydsl Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Launchpad Janitor (janitor) said :
#1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Timo Westkämper (timo-westkamper) said :
#2

Sorry again for the huge gap.

Clob and Blob are now handled as simpe fields and using @com.mysema.query.annotations.Transient you can skip code generation.

Revision history for this message
Timo Westkämper (timo-westkamper) said :
#3

When using JDO annotation based code generation javax.jdo.annotations.NotPersistent should be used.