0

I am pretty new in hibernate community so I do not know which direction to choose. Basically I have an war and db for it, but I have my own project with db. the problem is that some of the tables have the same names, thus is it possible somehow to map tables so the other project will call prefixed table (not the original, e.g. PREFIX_TEST, while originally TEST). I read about Naming Strategy, but I;m not sure if I can use it, I have no persistence.xml

Thanks a lot

bearbearbear
  • 95
  • 2
  • 10

1 Answers1

0

If the prefixing is only needed for several tables, you can either define the table mapping:

@Entity
@Table(name="PREFIX_TEST")
public class Test { ... }

or create an entity with a name matching the prefixed table:

@Entity
public class PrefixTest { ... }

If you want to modify the names of all tables, you can use a naming strategy as explained here.

However you would need a persistence.xml for that.

EDIT: The fact that you only have access to the packaged application is not a big issue if all you want to change is the persistence.xml. A [jwe]ar file is a simple zip file, so you can unpack it, add or change the persistence.xml, repack and deploy.

Community
  • 1
  • 1
kostja
  • 58,629
  • 47
  • 170
  • 219