java - Exception when querying a table with field BIT : JPQL -


i working jpql. have table in fields are

1. name datatype-varchar  2. sub datatype-bit 

in pojo file

private string name;  private byte sub; 

insertion successfull as:

name= john sub=0

now when query table using :

   query = em.createquery("select c sample c c.name = '"+ (name)+ "'", sample.class); 

exception occurs:

javax.persistence.persistenceexception: exception [eclipselink-3002] (eclipse persistence services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.conversionexception exception description: object [false], of class [class java.lang.boolean], mapping [org.eclipse.persistence.mappings.directtofieldmapping[sub-->sample.sub]] descriptor [relationaldescriptor(com.org.test --> [databasetable(sample)])], not converted [class java.lang.byte]. 

i think when getting values internally taking bit false. how can resolve problem??

i think should use boolean here.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -