EJB3.0 Development Guide: Inheritance of Entity Bean: One Table Policy

xiaoxiao2021-03-06  48

This and single-form strategy is similar, and the only difference is that each entity bean is mapped to a separate table when it is stored.

Such as:

@Entity

@Inheritance (strategy = inheritancenesstype.table_per_class, discriminatortype = discriminatortype.string)

@DiscriminatorColumn (name = "p_type", nullable = true)

This example mainly has the following documents, this example mainly implements the inheritance relationship between Person and Man, Woman. This example is not much different from the previous example, that is, in the entity bean comment, change inheritancenesstype.single_table.

InheritanceType.Table_Per_Class.

Run {$ jboss_home} / bin's run.bat: run -c all, start JBoss.

HTTP: // localhost: 8080 / jmx-console / htmladaptor? action = inspectMben & name = jboss% 3AService% 3DHYPERSONIC% 2CDATABASE% 3DLOCALDB, then call the StartDatabaseManager () method to open the HSQL Management Tools Management Database.

Execute the EJBJAR TARGET in the ANT view of Eclipse. Or in the command line, enter this project directory, perform Ant Ejbjar, publish this EJB.

Execute Run Target in the ANT view of Eclipse. Or on the command line, enter this project directory, perform Ant Run, test this EJB.

转载请注明原文地址:https://www.9cbs.com/read-81452.html

New Post(0)