You can also do this without using subclasses if you use two different persistence units.
Each persistence unit can specify a unique set of mappings (including table name). One way to achieve this is to create two orm.xml files. In persistence.xml you'll need something like this :
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="1.0">
<persistence-unit name="mapping-1">
. . .
<mapping-file>orm-1.xml</mapping-file>
. . .
</persistence-unit>
<persistence-unit name="mapping-2">
. . .
<mapping-file>orm-2.xml</mapping-file>
. . .
</persistence-unit>
</persistence>
Then within orm-1.xml :
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd"
version="1.0">
<package>mypackage</package>
<entity name="myEntity" class="myClass">
<table name="TABLE1">
</table>
</entity>
</entity-mappings>
And within orm-2.xml :
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd"
version="1.0">
<package>mypackage</package>
<entity name="myEntity" class="myClass">
<table name="TABLE2">
</table>
</entity>
</entity-mappings>
You'll need to create a separate EntityManagerFactory for each PersistenceUnit (probably not what you want), but if you wanted to use the same class on different databases (with different table names) this would be a way to go.