Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem generating @CollectionTable(indexes #36

Closed
mikezerosix opened this issue Oct 30, 2020 · 1 comment
Closed

Problem generating @CollectionTable(indexes #36

mikezerosix opened this issue Oct 30, 2020 · 1 comment

Comments

@mikezerosix
Copy link

mikezerosix commented Oct 30, 2020

It works fine on runing project with auto-ddl=create, and it generates the SQL correctly:
CREATE INDEX fk_parent_child on child(paretn_id);

But running the plugin with default settings with only packages setting added, I get an error :

Failed to execute goal com.devskiller.jpa2ddl:jpa2ddl-maven-plugin:0.9.12:generate (default-cli) on project Foobaa: Unable to create index (parent_id) on table Parent: database column 'parent_id' not found. Make sure that you use the correct column name which depends on the naming strategy in use (it may not be the same as the property name in the entity, especially for relational types)

@Entity 
public class Parent {

  ...  

  @ElementCollection
  @JoinColumn
  @OnDelete(action = OnDeleteAction.CASCADE)
  @CollectionTable(indexes = {@Index(name = "fk_parent_child", columnList = "parent_id")})
  public final Set<Child> owners = new HashSet<>();
@jkubrynski
Copy link
Member

The problem is with resolving unique constraints in H2. This is going to work correctly with resolving #40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants