Quantcast
Channel: Spring Community Forums - Data
Viewing all articles
Browse latest Browse all 297

Will this even work?

$
0
0
I am having a problem with SpringData, Hibernate and HSQLDB. I'm trying to set up a class as follows. Note that the @GeneratedValue and the @Id are on different columns. (I did not come up with this design.) Is this a valid strategy?


Code:

@Data
@Entity
@Table(name = "ACCTS")
public class MyAccount implements java.io.Serializable {


    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name="ACCOUNT_ID", nullable=false, precision=10, scale=0)
    private long accountId;

    @Id
    @Column(name="ACCOUNT_NUMBER", unique=true, nullable=false, precision=9, scale=0)
    private int accountNumber1;

    @Column(name="PRIMARY_NUMBER", nullable=false, precision=9, scale=0)
    private int accountNumber2;

}


Viewing all articles
Browse latest Browse all 297

Trending Articles