question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow beans to be used as Hibernate naming strategies

See original GitHub issue

Spring Boot already contains it’s own SpringNamingStrategy jpa naming strategy.

In many projects all database objects require to have it’s own prefix like abc_customers.

It would be nice if Boot’s SpringNamingStrategy would support setting a prefix e.g. using a property like: spring.jpa.hibernate.naming-strategy.prefix=abc

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:1
  • Comments:15 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
wilkinsonacommented, Nov 22, 2017

Rather than offering a configuration property that can be used to apply a table name prefix, and only when you’re using Boot’s default naming strategies, I’d prefer a more general purpose solution.

This branch contains a proposal that allows the user to provide ImplicitNamingStrategy and PhysicalNamingStrategy beans that are automatically applied to Hibernate by Boot’s auto-configuration. In addition to providing more flexibility than a table name prefix property, using beans means that the naming strategies can be auto-configured by a library and can be customised or back-off as is appropriate for that library’s needs.

1reaction
wilkinsonacommented, Aug 16, 2018

And before doing that, please take a moment to read the relevant section of the documentation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hibernate 5 Naming Strategy Configuration - Baeldung
Hibernate 5 provides two different naming strategies for use with Hibernate entities: an Implicit Naming Strategy and a Physical Naming ...
Read more >
Set hibernate naming strategy as Spring bean - Stack Overflow
I want to provide custom NamingStrategy to add prefix to every table managed by hibernate. I found I can use property: spring.jpa.hibernate.
Read more >
Naming Strategies in Hibernate 5 - Thorben Janssen
Hibernate's naming strategies define how to get the table and column names for an entity. You can implement your own mapping to fullfil...
Read more >
2. JPA Repositories - Spring
3, “Creating repository instances”. Beyond that it activates persistence exception translation for all beans annotated with @Repository to let exceptions being ...
Read more >
Chapter 2. Entity Beans
The default EJB3 naming strategy use the physical column name as the logical ... Hibernate Annotations allows you to use association annotations in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found