postgresql « Table « JPA Q&A

1. PostgreSQL identity in JPA single table hierarchy

I'm seeing strange behaviour when using PostgreSQL in a Hibernate/JPA environment with a single table inheritance hierarchy. Firstly my environment:

  • PostgreSQL 8.3
  • Spring 2.5.6SEC01
  • Hibernate-entitymanager 3.4.0.GA (installed from Glassfish update tool)
  • Hibernate-distribution 3.3.1.GA (installed from Glassfish ...

2. JPA - Wrong table created

Given those entities :

class SportTeam {
   long id;
   private Set<PLayer> players;
   private Set<Player> ...

3. Upper case table names in PostgreSQL

I have a very large PostgreSQL database that I will be using with JBoss Seam. The database uses mixed-case column names per naming convensions at Sun Microsystems and IBM. Until finding this post, I was very surprised by the potential need to have to change all column names in the PostgreSQL database to lowercase in order for hibernate and PostgreSQL to ...

4. Add first item to a postgresql table

Im using hibernate 3.2 with postgresql 8.1. I have an Employee class, and I am trying to save the very first employee to the table session = factory.openSession(); session.beginTransaction();; session.getTransaction().commit(); I get this error: Hibernate: select nextval ('hibernate_sequence') org.hibernate.exception.SQLGrammarException: could not get next sequence value ... Caused by: org.postgresql.util.PSQLException: ERROR: relation "hibernate_sequence" does not exist I created the table by ...

5. Hibernate doesn't create tables on PostgreSQL

@Entity public class Player { private String nickname; private int id = -1; @Id public int getId() { return id; } public void setId(int id) { ...