I'm using Dropwizard 1.1.0, and cannot figure out how to make this work.
Here's what I've tried so far:
1. Created package.model.ColumnNames, a public class which implements
PhysicalNamingStrategy
2. Modified my configuration file to include:
database:
properties:
hibernate.physical_naming_strategy: package.model.ColumnNames
I know that *something* is checking to make sure that
package.model.ColumnNames is a valid naming strategy, because if I change
the config setting to package.model.ColumnNamesblahblahblah I get an
exception at startup:
Unable to resolve name [package.model.ColumnNamesasdf] as strategy
[org.hibernate.boot.model.naming.PhysicalNamingStrategy]
On my package.model.User class, I have these annotations:
@Entity
@Table
public class User ....
@Column(nullable = false)
private String firstName;
....
But when I run the app in debug, even though I have breakpoints set
throughout pacakge.model.ColumnNames, they aren't triggered at all. Not on
startup, and not when the DAO is invoked (via /api/users).
Is this a bug? Or am I doing something wrong?
On Thursday, March 30, 2017 at 3:28:10 AM UTC-4, Artem Prigoda wrote:
>
> I think it should possible now (Dropwizard 0.8+) to set up a custom naming
> strategy without copying SessionFactoryFactory. I believe it was
> implemented in this commit:
> https://github.com/dropwizard/dropwizard/commit/8fff08cc093a5214b12972abae6a73097ca4db9c
>
> Artem
>
> On Wednesday, March 29, 2017 at 3:13:57 AM UTC+2, Yana wrote:
>>
>> creating your own SessionFactoryFactory won't work due to it referencing
>> bundle.configure(Configuration configuration) is being called which is a
>> protected method on the bundle.
>>
>> On Friday, November 29, 2013 at 6:46:45 PM UTC-5, Mihai Cazacu wrote:
>>>
>>> Hi,
>>>
>>> I'm trying to specify in configuration file a naming strategy for my DB
>>> model (that prefers embedded underscores to mixed case names):
>>>
>>> database:
>>>> driverClass: org.h2.Driver
>>>> user: sa
>>>> password: sa
>>>> url: jdbc:h2:target/example
>>>> properties:
>>>> hibernate.hbm2ddl.auto: create-drop
>>>
>>> hibernate.ejb.naming_strategy:
>>>> org.hibernate.cfg.ImprovedNamingStrategy
>>>
>>>
>>> without success. Camel case field name:
>>>
>>> @Column
>>>> Long fullName
>>>
>>>
>>> is generated as a column name 'FULLNAME'.
>>>
>>> Am I missing something in order to make this to work?
>>>
>>> Thanks,
>>> Mihai
>>>
>>>
>>>
>>>
>>>
>>>
>>>
--
You received this message because you are subscribed to the Google Groups
"dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.