私は Java 開発者です。私はspring 4.0.1とhibernate 4.2.21を使用しています。私は次のようなクラスを持っています:
@Entity
@Inheritance(...)
public abstract class Feature{
@Id
@GeneratedValue
protected Long id;
...
}
今、私は次のようにいくつかのクラスを持っています:
Label.java クラス:
@Entity
public class Label extends Feature{
protected String str;
...
}
Point.java クラス:
@Entity
public class Point extends Feature{
protected Integer intg;
...
}
クラスから拡張された 20 を超えるエンティティ クラスがありFeature
ます。ハードコードを書かずに、このクラス ( や など) をプロジェクトに Label
動的に追加する方法はありますか?Point
更新:
たとえば、Hibernate はデータベースからデータを取得し、このデータに従ってモデルを作成します。
- 出来ますか?
- 私はどのように行いますか?