|
Hello,
I have a very basic setup - Category has a list of Product}}s. Then I'm using {{SchemaExport to generate the schema. First I tried hibernate 4.3.10.Final and i tried mapping my product like this:
@OrderColumn( name = "product_order" )
@OneToMany( fetch = FetchType.LAZY, targetEntity = ProductModel.class )
@JoinTable( name = "category_products", joinColumns = @JoinColumn( name = "category_pk" ), inverseJoinColumns = @JoinColumn( name = "product_pk" ) )
private Collection<ProductModel> products;
or like this:
@OrderColumn( name = "product_order" )
@OneToMany( mappedBy = "category", fetch = FetchType.LAZY, targetEntity = ProductModel.class )
private Collection<ProductModel> products;
None of those seemed to work - the product_order column is never generated. I also tried Hibernate5 - same result: the @OrderColumn is never generated.
I attach a project that reproduces the problem. To run it, in the command line simply run mvn spring-boot:run and wait for the spring app to start. Then in target/schema.sql you see the generated schema.
I mark this issue as blocker, because indeed it is blocking me - I cannot sort my collections, and I believe it is validation of the JPA spec.
|