JSF backing bean and Hibernate mapping
===

I've got a pretty straight-forward problem I think but I couldn't come up with a nice structure for the classes with Hibernate or find examples of best practices.

I've got one table test with a mapped class Test. On one page controlled by a bean I've got all the items in a list for administrative editing (AdminTest) and in another page the same items are listed but for normal users with things like radio-buttons to influence them (ShowTest) without altering the database.

Since Hibernate seem to insist that you specify a directly mapped class when you retrieve items with the addEntity-function (in my classes ending with Manager) it feels like I'm forced to do something like this:

    class Test { ... }

    class AdminTest extends Test { ... }

    @ManagedBean
    class AdminTestManager {

	    List<AdminTest> items;

    }

    class ShowTest extends Test { ... }

    @ManagedBean
    class ShowTestManager {

	    List<ShowTest> items;

    }

Then have separate mapping for both AdminTest and ShowTest to the same table with the same fields. This is really bad since I need to update both mappings whenever I add a field to the table test.

It feels like I've missed something here, that you should really just need the one Test mapped to the table test then have some pretty inheritance mapping but those require some identifier like a column or one-to-one mapped table.

Another solution I was thinking about was removing "extends" from ShowTest and AdminTest and after "items" have been retrieved from the database I loop over the items and create one manually for every item. However it feels about the same that I need to update the classes AdminTest and ShowTest with getters to the getters of the properties of Test instead of having copies of the mapping files. Plus performance-wise it feels like I'm initializing all the items twice.