Question: I have two entities with following relationShip (these entities are taken for example purpose only)

```
public class Entity
{
    public long ID { get; set; }
}

public class Doctor : Entity
{
    public string Name {get; set;}
    public string sprcialization { get; set;}
    public string Icollection<JrDoctor> childDoctors { get; set;}
}

public class JrDoctor : Entity
{
    public long? DoctorId { get; set;}
    public virtual Doctor Doctor { get; set;}

    public long? JuniorDoctorId { get; set;}
    [ForeignKey("JuniorDoctorId")]
    public virtual Doctor JuniorDoctor { get; set;}
}

```

this relationship in entityframework is creating an extra column Doctor\_Id in JrDoctor table. Why is it so? and how can I avoid it using data annotations.

Answer: 
Generally, no, it doesn't. The reason of that behavior is that Lombok is an annotation processor for javac but when the kotlin compiler runs it uses javac as well but with no annotation processing so this is why kotlin don't see declarations that wasn't yet generated.

The only workaround for now is to define strict compilation order: Java first and after that kotlin. Unfortunately this approach has great disadvantage: you can't use Kotlin code from Java in this case. To workaround it you may need multimodule project that may cause a lot of pain
To add to Sergey Mashkov's response (adding here I don't have enough rep points to comment on it), here's an [example app](https://github.com/rojiani/kotlin-lombok-integration) of a Gradle multi-project setup where Kotlin can see the Lombok-generated code (without kapt or delomboking. Caveats do apply - namely, Kotlin can call the Java code, but Java can't call the Kotlin code in that particular module (as this would create a circular dependency). This kind of build might be suitable if you have an existing Java codebase and all new code is written in Kotlin, though.

I would love to see full Lombok/Kotlin support, however. While Kotlin is fully interoperable with Java, the reality is that Lombok is very widely used, and this issue may prevent a large number of developers who would like to switch to Kotlin from doing so.