Questions tagged [joincolumn]
82 questions
0
votes
1 answer
EF6.1.3 Join columns (like in hibernate)
I'm using Entitiy Framework 6.1.3 and I want to add a relation from N tables to 1 table with more than 1 join columns. The following example will help you to understand my problem:
Table P (protocol table) with these columns:
protocol_id (int,…

mxdeluxe
- 43
- 7
0
votes
0 answers
Refactoring Entities with common fields but with different @JoinColumn parameters
I have several entities that have same fields which are common to many tables. But those fields are not linked with the same parameter name in the relational tables(see object_1 and object_2 in the attached image).
I creacted an abstract class…

Aguid
- 943
- 2
- 10
- 24
0
votes
1 answer
Wrong column type in jpa many to many relationship
I have the following many-to-many relationship
@ManyToMany
@JoinTable(
name="response"
, joinColumns={
@JoinColumn(name="id_response", referencedColumnName="id_response")
}
, inverseJoinColumns={
…

anais1477
- 466
- 1
- 17
- 36
0
votes
1 answer
JPA JoinColumn save id external entity class inside another entity class
I have entityclass ProjectData. In this class I have UserData entity object.
I use @JoinColumn annotation to get userData when I get ProjectData- it work properly.
But if I create new ProjectData I don't know how to save userDataId to…

lucas999
- 169
- 1
- 2
- 11
0
votes
1 answer
Hibernate LEFTJOIN not generated for @ManyToOne reflexive relationship
I have a table with reflexive association:
A container could be associated to a parent (Column container_id).
A container can have containers as child.
@Entity
public class Container implements Serializable {
@ManyToOne
@JoinColumn(name =…

Ahmed MANSOUR
- 2,369
- 2
- 27
- 35
0
votes
1 answer
Insert entity with join columns
I want to insert in database the entity "CategorieTresorerie" having two join columns. The problem is, one of them (RegroupementCategorieTresorerie) is trying to insert automatically... But this one is already in database, so i have a duplicate key…

Ravi NAGALINGAM
- 13
- 1
- 1
- 6
0
votes
0 answers
Attempt to set column to two different values and cause InvalidStateException in OneToOne mapping
I have a table ConfigManagementSettings and foreign to table DeviceGroup as below:
@Entity
@Table(name = "device_group")
public class DeviceGroup extends devicemanage.repository.base.entity.base.EntityBase implements Serializable
{
private…

Bruce
- 647
- 2
- 12
- 30
0
votes
0 answers
Doctrine specify logical name for JoinColumn
I'm using Doctrine 2. I have an associative entity which points to two entities. Both are part of the composite key.
My problem is that JoinColumn only allows to specify the physical name, not the logical name. I need the two to be different.…

afilina
- 878
- 1
- 11
- 25
0
votes
1 answer
Column not generated when using JoinColumn (JPA/Hibernate)
I have the following Entities:
@Entity
@IdClass(IntegrationMappingPK.class)
public class IntegrationMapping {
@Id
@ManyToOne
private IntegrationProject project;
@Id
private String mappingName;
...
}
@Entity
public class…

H. Schulz
- 897
- 8
- 11
0
votes
0 answers
Hibernate create row instead of update
I Have 2 Entity : User and Role linked with a JoinTable user_role
@Entity
@Table(name = "core_users")
public class User implements Serializable {
public User(long id, String name, String password, Calendar passwordExpiresOn, Role group,…

Xenturio
- 13
- 2
- 7
0
votes
2 answers
Advice wanted - SPRING JPA JoinColumns
Just started exploring SPRING and JPA. So bear with me, please.
Lets assume I have two tables
EMPLOYEE TABLE ATTACHMENT TABLE
--------------------------- -------------------------------------------
ID | FIRSTNAME | LASTNAME |…

user1872371
- 321
- 2
- 12
0
votes
2 answers
How exactly work the @OneToMany JPA annotation in this example? Is it related to a table column or an entity class field?
I have 2 DB tables named respectivelly T_ACCOUNT and T_ACCOUNT_BENEFICIARY.
These tables have the following structure:
create table T_ACCOUNT (ID integer identity primary key, NUMBER varchar(9), NAME varchar(50) not null, CREDIT_CARD varchar(16),…

AndreaNobili
- 40,955
- 107
- 324
- 596
0
votes
0 answers
JPA ManyToOne with potentially null JoinColumn
I have a relationship I cannot figure out how (or even if) JPA can map it.
Two tables are joined by multiple columns. The columns combined are a unique, but not primary, key.
@ManyToOne
@JoinColumns({
@JoinColumn(name = "TYPE",…

tzimnoch
- 216
- 1
- 13
0
votes
1 answer
optional field for @joincolumn annotation
I have to use below syntax for one column in my model class
@JoinColumn(name = "Username", referencedColumnName = "name", optional = true)
private user username;
But I am getting compilation error at "optional", I am Using persistence-api-1.0.jar,…

user3824049
- 155
- 2
- 4
- 16
0
votes
1 answer
Hibernate - using @JoinColumn without declaring a relationship
Is it possible to use @JoinColumn in hibernate without declaring a relationship? I need to know if I can map an Object without declaring a relationship. (I know it defeats the purpose of having an ORM but I'm curious if it's possible)…

dilm
- 687
- 2
- 7
- 14