Hibernate relationship

Software version that were used:

  1. Spring Boot 1.5.9

The error message that triggered all the research:

2017-12-08 18:02:48.438 UTC [73] ERROR: constraint "uk_n7c2qd0x7l2yaq2xyyvs21rej" of relation "software_suite_instance" does not exist
2017-12-08 18:02:48.438 UTC [73] STATEMENT: alter table public.software_suite_instance drop constraint UK_n7c2qd0x7l2yaq2xyyvs21rej

The code fix was to properly map in both entities the link between them.

In the child entity we needed to add a field for the parent entity like:

@OneToMany
@MappedBy()
private ParentEntity parentEntity;

// Create a getter and setter for parentEntity

The error stopped showing up after this correction.

Advertisements

Published by

m5c

Java developper that loves photography

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s