2 Replies Latest reply on Feb 2, 2006 5:04 AM by liudan2005

    how to map entity to multiple tables with same structure

    liudan2005

      For performance reasons, I have 100 tables with same structures. They are fo r example: t_london, t_france, t_liverpool .... If I wanna map them to entity beans. I need to have for example: London.class, France.class, Liverpool.class. Is there any way to map one class to 100 tables. For example, City.class is mapped to t_london, t_france, t_liverpool .... what's the best way to achive this?

        • 1. Re: how to map entity to multiple tables with same structure
          ejb3workshop

          I can see a flame war coming up on this topic. Personally I would imagine that the database with proper indexes should perform adequately using a single table for this. I seriously doubt that there is a signifant performance improvement by splitting the data into multiple tables. I would suggest you use a single Entity with a single table and add and index on the location column.

          Just my 2 cents worths.

          If you actually have done some analysis on this using both models I would be very interested in the statistics.If it's just a hunch I would use one table and spend the money saved in development time on faster drives. :-)

          Alex

          • 2. Re: how to map entity to multiple tables with same structure
            liudan2005

            I am thinking of using table partition to split the large table so that i don't have to split tables. Havn't got an environment to test yet.