I am absolutly new in Hibernate development and I have the following problem.

I have 2 entity classes that maps 2 DB tables:

1) The first entity class (the main one) is named **KM\_ProjectInfo** and map a DB table named **KM\_PROJECT**.

2) The second entity class is named **KM\_ProjectInfoStatus** and map a DB table named **KM\_PROJECT\_INFO\_STATUS**.

So the second one represent a specific field of the first one (a status of the row representd by an instance of the KM\_ProjectInfo class). Infact I have something like this:

1) **KM\_ProjectInfo** class:

```
@Entity
@Table(name = "KM_PROJECT")
public class KM_ProjectInfo implements Serializable {

    @Id
    @GeneratedValue
    private Long idProjectInfo;

    @Column(name = "name")
    private String name;

    @Column(name = "technology")
    private String technology;

    @ManyToOne
    @JoinColumn(name = "idCountry")
    private KMCountry country;

    @Column(name = "power")
    private long power;

    @Column(name = "cod")
    private String cod;

    @ManyToOne
    @JoinColumn(name = "idProjectInfoStatus")
    private KM_ProjectInfoStatus status;

    // GETTERS & SETTERS

}

```

2) **KM\_ProjectInfoStatus**:

```
@Entity
@Table(name = "KM_PROJECT_INFO_STATUS")
public class KM_ProjectInfoStatus implements Serializable {

    @Id
    @GeneratedValue
    private Long idProjectInfoStatus;

    @Column(name = "foldertech")
    private Long foldertech;

    @Column(name = "folderproject")
    private Long folderproject;

    // GETTERS & SETTERS

}

```

So, as you can see in the previous snippet, the **KM\_ProjectInfoStatuss** is a field of the **KM\_ProjectInfo** because I want that it contains the primary key of this table as foreign key.

In the logic of my application I want that at one row of the **KM\_PROJECT** table (so at one instance of the **KM\_ProjectInfo** entity class) is associated a single row of the **KM\_PROJECT\_INFO\_STATUS** (one instance of the **KM\_ProjectInfoStatus** entity class) because it represent a specific status for the **KM\_PROJECT** row.

In my code I have:

```
@ManyToOne
@JoinColumn(name = "idProjectInfoStatus")
private KM_ProjectInfoStatus status;

```

but I think that is wrong because at one row of my first table it is associated a specific single row of the second table. But maybe I am missing something about how Hibernate work.

Can you help me to understand what I am missing? What it work? Why I have **@ManyToOne** instead **@OneToOne**?

Tnx