-
Hi there! I'm using Micronaut Data JDBC and I have the following situation: There is an entity that exists in more than one DB schema. Since the entity's definition is the same one among schemas, I would like to have a unique A workaround I could use is to create a base entity with all the fields and several entities extending the base one and annotated with Another workaround is to use I'll appreciate any suggestions on this. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 15 replies
-
Some databases support defining the schema in the context. Maybe we can support overriding the schema in |
Beta Was this translation helpful? Give feedback.
-
Hey, I wanted to give an update on this discussion. In the end, I opted for using It would be awesome if I could use Micronaut Data JDBC to map the same entity to different schemas, but as far as I know it seems not to be possible (I couldn't, at least). |
Beta Was this translation helpful? Give feedback.
Hey, I wanted to give an update on this discussion.
In the end, I opted for using
JdbcOperations
and pass it a query created dynamically by hand (after validating parameters to avoid a SQL-injection vulnerability). This is because schemas can't be passed as a parameter toPreparedStatement
. It's not ideal but it saves me from more complexity and code duplication that, otherwise, I would have ended up with.It would be awesome if I could use Micronaut Data JDBC to map the same entity to different schemas, but as far as I know it seems not to be possible (I couldn't, at least).