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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:57:45+00:00 2026-06-03T13:57:45+00:00

i have recs model mapping to a recs table in postgresql, some fields are

  • 0

i have recs model mapping to a recs table in postgresql, some fields are declared to be Set, when i ran the code, it threw errorr as:

org.hibernate.exception.SQLGrammarException: could not initialize a collection: Recs._recsDetailName
caused by: org.postgresql.util.PSQLException: ERROR: relation "recs__recsdetailname" does not exist

my recs model:

@Entity
@Table(name = "RECS", uniqueConstraints = @UniqueConstraint(columnNames = "id"))
public class Recs implements Serializable, Cloneable {

    /**
     * Serialized version unique identifier.
     */
    private static final long serialVersionUID = -7316874431882307750L;

    @Id
    @Column(name = "id")
    private int _id;

    @Basic
    @Column(name = "recs_num")
    private int _recsNum;

    @Basic
    @Column(name = "details")
    private String _details;

    @Column(name = "d_stamp")
    private Date _timeStamp;

    @ElementCollection(fetch = FetchType.EAGER) 
    @Column(name = "recs_detail_name")
    private Set<String> _recsDetailName;

    ..

my table:

        Column         |            Type             |  Modifiers                           
-----------------------+-----------------------------+-------------------------------
 id                    | integer                     | not null default 
 recs                  | xml                         | 
 recs_num              | integer                     | 
 details               | character varying(300)      | 
 d_stamp               | timestamp without time zone | default now()
 recs_detail_name      | text[]                   

|

a sample recs_detail_name in the db is like this:

{"TeleNav GPS Navigator","Photobucket for BlackBerry","Cellfire Mobile Coupons"}

anyone know what might be wrong??? Thanks

  • 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-03T13:57:45+00:00Added an answer on June 3, 2026 at 1:57 pm

    An ElementCollection is not mapped to a single column where the set would be serialized. It’s mapped using an additional table which contains a column for your String (recs_detail_name) and a foreign key column referencing the primary key of the owning table. This is of course described in the hibernate documentation.

    If you want to map a Set to a single column, you’ll have to use a custom user type.

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

Sidebar

Related Questions

Have some code: using (var ctx = new testDataContext()) { var options = new
Have you ever obfuscated your code before? Are there ever legitimate reasons to do
Have you ever created or encountered a self modifying code in Java? If yes,
I have a set of Access d/b's grouped already by year. within a given
I hope someone can help me out. I have a table that logs our
Have following listener for keyboard ArrowDown event(it's key code is 40 ): window.onload =
I have a little problem with a selectbox that have to have some marked
Have a look at the following code to find X^y. /* Find exponent in
Have written all the code in a silverlight class library (dll) and linked this
Have the following cronjob set up in root's crontab: (centos 5.x) 2 * *

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.