0

I am having an VO/Entity class with some field and its getter/setter. I want to map this entity to the multiple table in the Mapping file. For the Single table mapping with entity currently i am doing as below,

<?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
   http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
                 version="1.0">
    <entity class="ABC">
            <table name="ABCTABLE"/>
            <attributes>
                <id name="id">
                    <column name="id"/>
                </id>
                <basic name="fname">
                    <column name="fname"/>
                </basic>
            </attributes>
        </entity>
</entity-mappings>

The above code snippet is in my mapping.xml file. How i can map this ABC class to the multiple table.Any Suggestion must be appreciated.

Zia
  • 1,001
  • 1
  • 13
  • 25
  • You need update your model and using table per subclass, just following this tutorial https://www.javatpoint.com/table-per-subclass – Liping Huang Jul 30 '18 at 05:38
  • Does this make sense to you ? https://stackoverflow.com/questions/5215471/how-to-map-2-identical-tables-same-properties-to-1-entity – Shafin Mahmud Jul 30 '18 at 05:50
  • Could you tell us the high level motivation? If it is for multi tenant purposes Some JPA providers know this concept: http://www.eclipse.org/eclipselink/documentation/2.5/jpa/extensions/a_multitenant.htm – Andreas Jul 30 '18 at 05:52
  • HOW do you want to map one class to multiple tables? Using a primary table and some secondary tables? or what? You post some mapping, and what is wrong with it? –  Jul 30 '18 at 07:35

0 Answers0