Hibernate with PivotTable Names

0

Good Morning / Afternoon / Evening Personal! in a scenario where a bd table must have a name and concatenated dates like that would get with hibernate since the base name is annotated in the model.

As it is:

@Entity
@Table(name="nome_da_tabela")

As I'm imagining:

@Entity
@Table(name="nome_da_tabela"+data)

I would like to know if it is possible to do this or even something similar, thank you already.

    
asked by anonymous 13.10.2016 / 19:13

1 answer

0

If you are using Hibernate you can extend the ImprovedNamingStrategy class (which inherits from the NamingStrategy interface and generates the methods) and override the method that generates the table in the database. The methods and signatures can check the link:

link

Override methods as you use them:

@Override
public String columnName(String columnName)
{
    return columnName;
}

@Override
public String tableName(String tableName)
{
    return tableName;
}
    
13.10.2016 / 21:52