Questions tagged [joincolumn]

82 questions
0
votes
2 answers

Entities created correctly from Json with @JoinColumn on the opposite side

I thought I understood the JPA's @JoinColumns annotation and mappedBy parameter, but then I needed to create new entities from this Json of a Question. It has a set of answer choices which need to be mapped to new entities as well. I decided that…
Ondrej Sotolar
  • 1,352
  • 1
  • 19
  • 29
0
votes
1 answer

hibernate, join table and join column with complex addiction

While studying Hibernate I encountered this problem. Making a query from the Contract tables (i want to get list avalible contracts in db). I can't display Tariff entity fields in my jsp (e.g. Contract.Tariff.title). At the same time, in the entity…
Ivan Ivan
  • 3
  • 1
  • 3
0
votes
1 answer

Hibernate - How to do @Query update with reference to @JoinColumn attribute

@Entity public class TransactionInfo { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @OneToOne @JoinColumn(name="txnRequestId") private TransactionRequest txnRequest; .. } I would like to do a…
Sandeepan Nath
  • 9,966
  • 17
  • 86
  • 144
0
votes
1 answer

How to join separate table data column in Hibernate

Is there any possible variant to insert data from another table into Hibernate entity. For example we have the following DB-model: ItemTable: ITEM_ID NUMBER not null, ITEM_NAME VARCHAR2, I_OBJECT_ID NUMBER; ObjectTable: OBJECT_ID NUMBER not…
0
votes
1 answer

JoinColumn Hibernate / API

I'm having the following problem: I want to simply join the table Markets (main) and Telephones, but I'm facing some problems while doing this with annotations. I simply want to use the Comercio.id as the corresponding foreign key from…
crzy
  • 23
  • 5
0
votes
2 answers

How to select just a few data to display using JoinColumnn

In spring java especially in JoinColumn, if we do JoinColumn for example JoinColumn(name="guest_id"). Then all guest data will be displayed. Whereas I only want to retrieve only one data, which is the name only. @Column(name = "guest_id") private…
0
votes
1 answer

how to join two collection through same column name in mongoose and derive data?

i want to derive price based on same column name that is route_name from two models.how to do it? 1st model : - var routeSchema = mongoose.Schema({ route_name: String, from_city: String, to_city : String, stoppage_point:…
Arazu Gajera
  • 19
  • 1
  • 7
0
votes
0 answers

JPA @JoinColumn not working properly with REST

Im learning Spring Security with REST, and I have 2 MySQL tables, one for users and one for authorities. The user_id from authorities table is foreign key for id from user table. I want to use these roles from authorities table with Spring Security…
user9608350
0
votes
1 answer

JPA: receive several columns from table linked with current as manytoone

i'm new at JPA and need some advice. I have two tables, Car and Driver linked as ManyTyOne. And I would obtain Car entity with info about several drivers. Now i can get from Driver only driver_id, it looks like this, but need to receive also…
maggalka
  • 1
  • 2
0
votes
0 answers

Nullable JOINCOLUMN field transient exception Hibernate

I am working with spring hibernate project where a model has a foreign key which mapped with @joincolumn as shown below. class Customer { @JoinColumn(name="CUSTOMER_RM_ID",nullable=true) @OneToOne(fetch=FetchType.EAGER) private RmSm…
Vipin CP
  • 3,642
  • 3
  • 33
  • 55
0
votes
0 answers

parent entity reference not saved in child entity while using @joincolumns

Below are the entity classes and the methods I have written . When I tries to insert the entities using Spring Data JPA , I am stetting all the values properly and the entities are getting saved . But according the hibernate mapping that I…
saikat_ds
  • 11
  • 2
0
votes
2 answers

broken column mapping: OneToOne unidirectional with two join columns

I have two given tables (posgres) with the following fields (all big ints): Transaction: transactionid reader_id readertrxref ... Reversal: reversalid trxref readerid ... There is an optional 1:1 relationship between Transaction and Reversal:…
badera
  • 1,495
  • 2
  • 24
  • 49
0
votes
0 answers

Hibernate throwing error in One-to-one relationship

I am trying to implement a one-to-one mapping and below is the entities involved: UserID which acts as composite primary key: @Embeddable public class UserID implements Serializable { private static final long serialVersionUID = 1L; …
CuriousMind
  • 8,301
  • 22
  • 65
  • 134
0
votes
1 answer

JPA - Retrieving records from various entities that share the same ForeignKey after an ID is passed in at the API

Consider the following dummy data entities and its defined relationships: Entity Business @Entity @Table(name = "business") public class Business { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") public Long…
0
votes
1 answer

How to do one-one mapping between 2 tables having composite key in hibernate?

I have 2 tables vanTb and vanSiteTb. The primary key for vanTb is vId. The vanSiteTb has a composite primary key of 2 columns viz. vNum and vSiteC. The vanTb have also 2 columns vNum and vSiteC. There is a one to one relation between these 2…
azaveri7
  • 793
  • 3
  • 18
  • 48