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 8392585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:33:05+00:00 2026-06-09T19:33:05+00:00

I am using Hibernate as JPA provider. I have for example this class: @Question(multipleChoiceQuestion)

  • 0

I am using Hibernate as JPA provider. I have for example this class:

@Question("multipleChoiceQuestion")
@Entity
public class MultipleChoiceQuestion extends QuestionUnit {

    private ArrayList<String> questionContent;

    public MultipleChoiceQuestion() {
        this(null, null);
    }

    public MultipleChoiceQuestion(ArrayList<String> questionContent,
            AnswerUnit correctAnswer) {
        super(correctAnswer);
        this.questionContent = questionContent;
    }

    public ArrayList<String> getQuestionContent() {
        return this.questionContent;
    }
}

and if I persist it, the questionContent property is saved as blob. I know that I could use ElementCollection annotation to create seperate table for the contents of my ArrayList.

I am wondering though if this behaviour (saving collection that is a property as a blob) is specified somewhere in JPA specification or is it Hibernate specific?

  • 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-06-09T19:33:07+00:00Added an answer on June 9, 2026 at 7:33 pm

    I’ve seen this behaviour at JPA, so it’s not Hibernate specific. The thing is that, since you have no annotation for that attribute, and it’s an ArrayList of primitives (so no ids) and ArrayList is Serializable, JPA engine “understands” that attribute should me mapped as a BLOB.
    Obviously the concept of string is not really an object, therefore, it would not make sense to map a string as an object in your ORM. I found a very good post about the subject.

    In the item of hibernate specification – “2.2.2.5. Non-annotated property defaults” (I know, it’s not JPA. But Hibernate follows it):

    If a property is not annotated, the following rules apply:

    Otherwise, if the type of the property is Serializable, it is mapped
    as @Basic in a column holding the object in its serialized version;

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

Sidebar

Related Questions

I have an JPA entity like this: @Entity @Table(name = category) public class Category
We're using JPA with hibernate as the provider, we have a query that contains
I'm using Hibernate/JPA and have an @Entity object called Order, pointing at a MySQL
I'm using Spring with Hibernate as a JPA provider and are trying to get
JPA/Hibernate missing column I am using JPA with Hibernate as the provider. I had
We have a setup where we are using an embedded HSQLDB for backing Hibernate/JPA
I am using JPA 2.0 with hibernate as the jpa-provider. The direction for my
I have problems in mapping custom collection with JPA (Hiberante provider). For example when
I am using Glassfish 3.1, JEE6 JPA Annotations, Hibernate provider and Derby database in
I'm using Spring + Hibernate + JPA and I have a situation where I

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.