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: 
There is a Kotlin compiler plugin for lombok. **It is still experimental** and it can be used with **Gradle** or **Maven**.

It only supports a hand full of annotations, including

* `@Getter`, `@Setter`
* `@NoArgsConstructor`, `@RequiredArgsConstructor`, and `@AllArgsConstructor`
* `@Data`
* `@With`
* `@Value`

Seem to work as expected. Unfortunately, they do not support the `@Builder` annotation but you can request to be added in [YouTrack](https://youtrack.jetbrains.com/issue/KT-46959)

See the [Lombok compiler plugin](https://kotlinlang.org/docs/lombok.html) in the kotlin documentation for more information.

Update 1
--------

The `@Builder` annotation ticket mentioned above has been fixed! The target version for the fix is `1.8.0-Beta`.
As it was mentioned in comments above, delombok helps.
In case of maven build it would be:

```
<plugin>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok-maven-plugin</artifactId>
    <version>${lombok.version}.0</version>
    <executions>
        <execution>
            <id>delombok</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>delombok</goal>
            </goals>
            <configuration>
                <formatPreferences>
                    <javaLangAsFQN>skip</javaLangAsFQN>
                </formatPreferences>
                <verbose>true</verbose>
            </configuration>
        </execution>
        <execution>
            <id>test-delombok</id>
            <phase>generate-test-sources</phase>
            <goals>
                <goal>testDelombok</goal>
            </goals>
            <configuration>
                <verbose>true</verbose>
            </configuration>
        </execution>
    </executions>
</plugin>

```