0

I know this question has been asked manytimes and i went through the solutions but couldnt get the idea of where iam missing. Please find below the entities for which Iam getting the issue.

@Entity
@Table(name = "debit_file", schema = "test")
public class DebitFile  extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "test.debit_file_seq")
@SequenceGenerator(name = "test.debit_file_seq", sequenceName = "test.debit_file_seq", allocationSize = 1)
@Column(name = "id")
private Long id;

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

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

@Column(name = "no_of_records")
private int noOfRecords;

@Column(name = "no_of_records_processed")
private int noOfProcessedRecords;

@Column(name = "no_of_records_unprocessed")
private int noOfUnprocessedRecords;

@Column(name = "created_at")
private Date createdDate;

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

@OneToMany(fetch = FetchType.EAGER)
@JoinColumn(name = "file_id", referencedColumnName = "id", updatable = false, insertable = false)
private List<DebitFileRecord> debitFileRecordList = new ArrayList<>();

 getters() and setters() below...
}

Second enity class as below:

@Entity
@Table(name="debit_file_record", schema = "test")
public class DebitFileRecord {

@Id
@GeneratedValue(generator = "UUID")
@GenericGenerator(name="UUID", strategy="org.hibernate.id.UUIDGenerator")
@Column(name="id" , updatable = false, nullable = false)
private UUID id;

@Column(name="transaction_date")
private Date transactionDate;

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

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

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

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

@Column(name = "file_id")
private Long fileId;

getters() and setters below...
}

As shown in the above code it is avery simple mapping but iam still getting

repeated column mapping for entity DebitFile column: created_at 
(should be mapped with insert="false" update="false").

I dont see any error in the code. Can someone please help me understand the issue.

1 Answer 1

1

Several things to check :

  1. Does the BaseEntity also include another field which are mapped to "created_at" ?
  2. Does the DebitFile or the BaseEntity has any getter that are mapped to "created_at" ?

If yes for (1) , remove createdDate from DebitFile as it is already defined in the BaseEntity.

If yes for (2) , remove the mapping from the getter as it is already defined in the field.

Sign up to request clarification or add additional context in comments.

1 Comment

Iam feeling like a foolish now. I did not even bothered to check why BaseEntity is there. Thank you very much. Saved my day. I spent more than 2 hours on this issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.