VARCHAR « Data Type « JPA Q&A





1. JPA/Hibernate DDL generation; CHAR vs. VARCHAR    stackoverflow.com

I have a JPA/Hibernate data model that I am using the Hibernate hbm2ddl tool to generate database DDL. I have some strings that should be CHAR and some that may be ...

2. Why JPA, Hibernate and jTDS always uses varchar(8000) for String columns?    stackoverflow.com

I'm using JPA (Hibernate) and jTDS as my jdbc driver. Whenever the datatype of my entity columns are String, the created prepared statement uses varchar(8000) as its parameter. I've already tried ...

3. SQL Server Conversion Exception: Error converting data type varchar to numeric    stackoverflow.com

I am working on a project where the goal is to convert an existing application to SQL Server. However, I am running into issues with ID generation - specifically, the conversion ...

4. MAX of a varchar column using HQL    stackoverflow.com

I am trying to find the maximum value of a varchar column in mySQL DB using hibernate query language. This is the query i am trying to do, and this works fine ...

5. persisting to varchar: silently ignores too long String    forum.hibernate.org

Hello! When persisting a String of length eg. 1024 to a varchar column with a length of e.g. 255 (the string does not fit into the column) this is silenty ignored. the string is just cut. i'd like to be advised how to configure hibernate to either throw some exception or any other solution to give me the chance of an ...

6. Cast varchar to double Problem    forum.hibernate.org

7. Creating binary varchar column in MySQL portably?    forum.hibernate.org

MySQL has a "nice" feature where all varchar searches are case-insensitive. I have a column which is a Base64 encoded key which I want to store as a String but need to perform case-insensitive searches on. In mysql you can create a column as "varchar(X) binary" and MySQL will perform all queries on that column as case-sensitive. The problem is that ...

9. Want to generate CHAR(4) instead of VARCHAR(4)    forum.hibernate.org

I have property defined by the xdoclet tags: /** * @hibernate.property * type="com.zetools.wuwi.hibernate.usertype.PartnerStatusUserType" * length="4" * not-null="true" * @return Returns the status. */ which generates appropriate xml: The PartnerStatusUserType is of Types.CHAR. Generating the schema results in the type being char(1) instead of char(4). We would prefer to use char over ...





10. ilike with DB2 VARCHAR throwing error but CHAR isn't    forum.hibernate.org

Not sure why the Criteria query is bombing out on VARCHAR, but not for a CHAR field. (i.e. works for PRO_ABB_DSC but not for PRO_FU_DSC) See SQL generated below... This field was recently changed from CHAR to VARCHAR, so I suspect it may be a VARCHAR related issue...but why is the LCASE not working on VARCHAR? According to DB2 docs, the ...

11. Oracle VARCHAR insert, string truncated    forum.hibernate.org

Hibernate version: 2.1.8 Mapping documents: ECAT.SEQ_ECAT_ORDER_ORDER_ID yyyyMM 3

12. Null varchar comes out as empty String    forum.hibernate.org

I have a column as a varchar named "objective" that accepts mapped to a String like so: Upon insertion of a new object the column will receive and store . When the object is retrieved, an empty string ("") is pulled back. If another column is then altered, that empty string is stored in the ...

14. cast to VARCHAR(1024) in hql    forum.hibernate.org

15. More than 255 varchar's with a string type...    forum.hibernate.org

package de.leibert.util; import org.hibernate.dialect.MySQL5InnoDBDialect; import java.sql.Types; public class FLMysqlDialect extends MySQL5InnoDBDialect{ public FLMysqlDialect() { super(); } protected void registerVarcharTypes() { registerColumnType( Types.VARCHAR, "longtext" ); registerColumnType( Types.VARCHAR, "varchar(2000)" ); ...

16. Annotation to generate char() instead of varchar()    forum.hibernate.org

import java.sql.Types; import org.hibernate.dialect.MySQL5InnoDBDialect; public class OwnDialect extends MySQL5InnoDBDialect { public OwnDialect() { super(); registerColumnType( Types.VARCHAR, "char" ); //the "255" marks the maximum length, for ...