R
R
reus2017-12-21 15:37:21
Java
reus, 2017-12-21 15:37:21

How to set the name of the schema in which the binding table for @ManyToMany will be created?

In general I have two Entities.
I link them with:

@ManyToMany
private List<DistributedJPAWord> words;

But the problem is that the linking table should not be created in the schema of the given "hibernate.default_schema" property.
How to choose a schema other than default for @ManyToMany binding in Hibernate?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2018-01-20
@dj1m

Well, you can write something like

@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinTable(name = "words_table", catalog = "anotherscheme", .....

but in general it is somehow even strange that at the level of the database it is necessary to create another schema for the binding table. I think the problem is something else.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question