Tyvain
Tyvain

Reputation: 2760

JPA and H2 database doesn't work with immutable

I made a simplified example of the same problem that I can't solve on a bigger project.

The simplified project is here (play with it): https://gitlab.com/tyvain/h2bug

Description - using H2 mem database:

A simple entity with a schema can be access without problem from a jpa repo:

@Entity
@Table(name = "SCOLARITE.VOITURE")

But a immutable entity can't:

@Entity
@Immutable
@Subselect("SELECT DISTINCT ID FROM SCOLARITE.VOITURE")


Table "VOITURE" not found; SQL statement:
select voiturevie0_.id as id1_0_ from ( SELECT DISTINCT ID FROM SCOLARITE.VOITURE )

You can find the test that reproduce the error in the gitlab project.

What can I do to solve this ?

Upvotes: 0

Views: 268

Answers (1)

Simon Martinelli
Simon Martinelli

Reputation: 36223

Your Table annotation is wrong. You can't specify the schema in the name attribute. You have to use the schema attribute:

@Table(name = "VOITURE", schema = "SCOLARITE")

Upvotes: 1

Related Questions