Home Why does SqlExceptionHelper interpret boolean constraint violation as \x00
Reply: 0

Why does SqlExceptionHelper interpret boolean constraint violation as \x00

user1368
1#
user1368 Published in May 21, 2018, 11:19 am

I have the following domain object

@Table(uniqueConstraints={@UniqueConstraint(columnNames={"name", "company_id", "global"}, name="UC_name_companyId_global")})
@Entity
@Audited
public class AccessLevel implements Serializable, GlobalEntityInstance {

private static final long serialVersionUID = -7215569721971710808L;

  @Size(min = 2)
  @Column(nullable = false)
  private String name;

  @ManyToOne(optional = false)
  private Company company;

  @Column
  private boolean global = false;

  @Column(nullable = false)
  private GeneralStatus status;
}

The company attribute is mapped to column company_id.

I've created a test case to test that when an Access Level is added with the same 'name', 'company' and 'global' value a DataIntegrityViolationException is thrown. The excetion is being thrown, my questions is about the message:

o.h.engine.jdbc.spi.SqlExceptionHelper : Duplicate entry 'Temp Level-1-\x00' for key 'UC_name_companyId_global'

What in the heck is '\x00' (or '\x01' if true is saved) and why does the SqlExceptionHelper map/resolve a boolean value to it? Shouldnt the Duplicate entry key be 'Temp Level-1-false'?

Thanks in advance, Grant

UPDATE:

Im currently using MySQl 5.6

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.415327 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO