Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6704397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:17:02+00:00 2026-05-26T07:17:02+00:00

In order to remove few special characters coming from my host database tables into

  • 0

In order to remove few special characters coming from my host database tables into my application, I had to create my own datatype.

@Column(name="LAST_UPDATED_BY", nullable=false, length=24)
@Type(type="com.xx.CleanedString")
public String getLastUpdatedBy() {
    return this.lastUpdatedBy;
}
public void setLastUpdatedBy(String lastUpdatedBy) {
    this.lastUpdatedBy = lastUpdatedBy;
}

CleanedString implements UserType whose sqlTypes() is defined as an int[] { Types.CHAR }. Basically it rebuilds String after iterating the char array and filtering it out the special characters.

public int[] sqlTypes() {
    return new int[] { Types.CHAR };
}

Application works perfectly fine but I am having problem running my DBUnit. When Hibernate creates the table in HSQLDB (I have hibernate.hbm2ddl.auto set to create-drop), it is creating a column of type CHARACTER with length as 1. It is ignoring the length attribute of my @column specified 24 above.

Is there a way to specify column length in this scneraio?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:17:03+00:00Added an answer on May 26, 2026 at 7:17 am

    Try setting it to Types.VARCHAR

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do I remove duplicates from a list, while preserving order? Using a set
In order to fully use LinqToSql in an ASP.net 3.5 application, it is necessary
In order to create an arbitrary precision floating point / drop in replacement for
I want to add few fields to every model in my django application. This
I created a simple databse using Oracle that has several tables and a few
I am looking for a way to quickly remove items from a C# List<T>
I'm trying to convert the RealViewSwitcher based on the work from Marc Reichelt into
I have read a few lines of text into an array of C-strings. The
I've install mono-runtime via apt in order to run my Mono console application on
I'm writing a script to remove some build artifacts older than 1 week. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.