Hibernate/JPA and PostgreSQL - Primary Key?
        Posted  
        
            by Shadowman
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Shadowman
        
        
        
        Published on 2010-05-12T23:02:36Z
        Indexed on 
            2010/05/12
            23:04 UTC
        
        
        Read the original article
        Hit count: 323
        
I'm trying to implement some basic entities using Hibernate/JPA. Initially the code was deployed on MySQL and was working fine. Now, I'm porting it over to use PostgreSQL. In MySQL, my entity class defines its primary key as an auto-incrementing long value with the following syntax:
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
However, I've found that I get errors with PostgreSQL when I try and insert numerous records at a time. What do I need to annotate my primary key with to get the same auto-incrementing behavior in PostgreSQL as I have with MySQL? Thanks for any help you can provide!
© Stack Overflow or respective owner