-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
3,384 additions
and
22 deletions.
There are no files selected for viewing
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/main/java/com/ticket/TicketSystem/CustomPhysicalNamingStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license | ||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template | ||
*/ | ||
package com.ticket.TicketSystem; | ||
|
||
/** | ||
* | ||
* @author Carron Muleya | ||
*/ | ||
import org.hibernate.boot.model.naming.Identifier; | ||
import org.hibernate.boot.model.naming.PhysicalNamingStrategy; | ||
import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment; | ||
|
||
public class CustomPhysicalNamingStrategy implements PhysicalNamingStrategy { | ||
|
||
private static final String TABLE_PREFIX = "bf_"; | ||
|
||
@Override | ||
public Identifier toPhysicalCatalogName(Identifier name, JdbcEnvironment context) { | ||
return apply(name); | ||
} | ||
|
||
@Override | ||
public Identifier toPhysicalSchemaName(Identifier name, JdbcEnvironment context) { | ||
return apply(name); | ||
} | ||
|
||
@Override | ||
public Identifier toPhysicalTableName(Identifier name, JdbcEnvironment context) { | ||
return apply(name); | ||
} | ||
|
||
@Override | ||
public Identifier toPhysicalSequenceName(Identifier name, JdbcEnvironment context) { | ||
return apply(name); | ||
} | ||
|
||
@Override | ||
public Identifier toPhysicalColumnName(Identifier name, JdbcEnvironment context) { | ||
return name; | ||
} | ||
|
||
private Identifier apply(Identifier name) { | ||
if (name == null) { | ||
return null; | ||
} | ||
String newName = TABLE_PREFIX + name.getText(); | ||
return Identifier.toIdentifier(newName); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters