What does the bit data type map to in a Java Domain Object When you have a column of the bit data type what Class would be used to represent that in a Java POJO mapping that table to an object which is using javax.persistence annotations?

I tried Boolean, which didn't work and produced the following errors:


  org.hibernate.exception.SQLGrammarException: could not insert: [com.DomainClassName]
  java.sql.SQLException: Incorrect syntax near '-'.


EDIT:  a Java boolean does map to the bit data type in SQL Server.  I had a column name with a dash in it that I had to change.
Incorrect syntax near '-'.


This tells me that you've named a database, table or column with a dash in it, not that POJO is having an issue mapping your columns.

As an example, if you've named your entity bar-none and POJO issues the following CREATE TABLE statement:

CREATE TABLE dbo.foo(bar-none BIT);


Or this one:

CREATE TABLE dbo.foo-bar(none BIT);


You will get this error:


  Msg 102, Level 15, State 1, Line 1
  Incorrect syntax near '-'.


And in fact even if you declare a data type that does not exist in SQL Server, such as Boolean, Frank or WhatTheHeckDataTypeIsThis, the parser will still barf with the above error due to the hyphen, before it even bothers validating the data type(s).

So, please check your table name and column names and be sure that your names don't use dashes, spaces or other special characters, that they aren't reserved words, and that each name you provide obeys the well-documented rules for identifiers. While you can get around this error if you can coerce POJO to properly delimit bad names with [square brackets], this is not a best practice.