//...this is the entity with a whitespace char
@Entity
@Table(name="TSP010")
public class Test
{
@Id
@GeneratedValue
int id;
char value = ' ';
}
//...this is the test case
EntityManagerFactory emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT);
//...insert
Object id;
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
Test t = new Test();
em.persist(t);
id = t.getId();
em.getTransaction().commit();
em.close();
//...select fails with StringIndexOutOfBoundsException!!!
//because of the char property
em = emf.createEntityManager();
em.getTransaction().begin();
t = em.find(Test.class, id);
em.getTransaction().commit();
em.close();
//...this is the entity with a whitespace char
{ @Id @GeneratedValue int id; char value = ' '; }@Entity
@Table(name="TSP010")
public class Test
//...this is the test case
EntityManagerFactory emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT);
//...insert
Object id;
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
Test t = new Test();
em.persist(t);
id = t.getId();
em.getTransaction().commit();
em.close();
//...select fails with StringIndexOutOfBoundsException!!!
//because of the char property
em = emf.createEntityManager();
em.getTransaction().begin();
t = em.find(Test.class, id);
em.getTransaction().commit();
em.close();
emf.close();
assertTrue(' ' == t.getValue());