1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[JBoss] Unique constraint not created in JPA

Discussão em 'StackOverflow' iniciado por Stack, Setembro 13, 2021.

  1. Stack

    Stack Membro Participativo

    I have created the following entity bean, and specified two columns as being unique. Now my problem is that the table is created without the unique constraint, and no errors in the log. Does anyone have an idea?

    @Entity
    @Table(name = "cm_blockList", uniqueConstraints = @UniqueConstraint(columnNames = {"terminal", "blockType"}))
    public class BlockList {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private int id;
    @ManyToOne(cascade = CascadeType.PERSIST)
    @JoinColumn(name="terminal")
    private Terminal terminal;
    @Enumerated(EnumType.STRING)
    private BlockType blockType;
    private String regEx;
    }

    Continue reading...

Compartilhe esta Página