English 中文(简体)
如何在使用JPA2的实体绘制EnumSet(或Enums清单)地图
原标题:How to map EnumSet (or List of Enums) in an entity using JPA2

我有实体:

@Entity
@Table(schema="", name="PERSON")
public class Person {
    List<PaymentType> paymentTypesList;
    //some other fields     
    //getters and setters and other logic
}

并且我已承诺支付:

public enum PaymentType {
    FIXED, CO_FINANCED, DETERMINED;
}

如何坚持个人及其遗体清单(在这份清单中,我必须列出数量可变的遗体,其中可能包括其中之一,或两个或全部)。

实体使用Pangres,使用JPA通知创建,使用Hibernate管理。

问题回答

Ask yourself, wheter PaymentTypes can随时间变化。

我将创设一个<代码>@Entity PayType,并有一个名称属性,并在<代码>PaymentType和Person/code>之间建立一个<代码>@Many2Many

Another approach: @ElementCollection See ElementCollection from From Wikibooks, the open-content textbooks collection





相关问题
Matrix to Represent a Triangle in Screen Space

So i have a set of four points in 3D Space. P1 [0, 0, 0] P2 [128, 0, 0] P3 [0, 128, 0] P4 [128, 128, 0] Which I m then projecting orthographically to the screen effectively giving me two ...

Using LINQ To SQL with multiple database tables

I have an employee class with as follows: public class Employee { public string FirstName { get; set; } public string LastName { get; set; } public string UserName { get; set; } ...

Mapping points from Euclician 2-space onto a Poincare disc

For some reason it seems that everyone writing webpages about Poincare discs is only concerned with how to represent lines and measure distances. I d like to morph a collection of 2D points (as ...

Fluent NHibernate, varbinary(max) and SQLite

I have a varbinary field in my sql server database that needs to be varbinary(max). I create my database with NHibernate and I use Fluent Nhibernate for my mappings. I also use SQLite for my unit ...

Javascript redirect

I am working with javascript and here is what I am trying to do: 1. Send a get request which looks like "http://localhost:8080/myapp/verify.htm?verifyId=Agkvhs" My requests reaches my verify.jsp in ...

热门标签