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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:37:51+00:00 2026-06-01T16:37:51+00:00

I have 2 tables in database User and Link. The userid is a foreign

  • 0

I have 2 tables in database User and Link. The userid is a foreign in the link table. I have used hibernate reverse engg xml to create the model classes in java.
It has created the User, Link, LinkId class. Here the Link class links the 2 tables, while LinkId contains the attributes of Link.
I am trying to query the link table using the userid. The query I have is “createQuery(
“from com.paypal.socialpay.models.LinkId li where li.userid=?”).setInteger(0, id).list();”

But on execution of the query I get “java.lang.IllegalArgumentException: No positional parameters in query: from com.paypal.socialpay.models.LinkId li where li.userid=?”

Can someone tell me what I am doing wrong

class name="com.paypal.socialpay.models.Link" table="link" catalog="socialdb">
    <composite-id name="id" class="com.paypal.socialpay.models.LinkId">
        <key-property name="id" type="int">
            <column name="id" />
        </key-property>
        <key-property name="userid" type="java.lang.Integer">
            <column name="userid" />
        </key-property>
        <key-property name="title" type="string">
            <column name="title" length="100" />
        </key-property>
        <key-property name="price" type="string">
            <column name="price" length="100" />
        </key-property>
        <key-property name="description" type="string">
            <column name="description" length="500" />
        </key-property>
        <key-property name="contentname" type="string">
            <column name="contentname" length="100" />
        </key-property>
        <key-property name="contentpreviewname" type="string">
            <column name="contentpreviewname" length="100" />
        </key-property>
        <key-property name="contentdisplayname" type="string">
            <column name="contentdisplayname" length="100" />
        </key-property>
        <key-property name="contentpreviewdisplayname" type="string">
            <column name="contentpreviewdisplayname" length="100" />
        </key-property>
        <key-property name="downloadlink" type="string">
            <column name="downloadlink" length="100" />
        </key-property>
        <key-property name="contentsavelocation" type="string">
            <column name="contentsavelocation" length="150" />
        </key-property>
        <key-property name="previewsavelocation" type="string">
            <column name="previewsavelocation" length="150" />
        </key-property>
    </composite-id>
    <many-to-one name="user" class="com.paypal.socialpay.models.User" update="false" insert="false" fetch="select">
        <column name="id" not-null="true" />
    </many-to-one>
</class>
  • 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-01T16:37:53+00:00Added an answer on June 1, 2026 at 4:37 pm

    Try to use this:

    session.createQuery("from Link where userid=:userId")
        .setParameter("userId", id)
        .list()
    

    UPDATE: I believe the mapping should look like this:

        <id name="id" column="id">
          <generator class="native"/> 
        </id>
        <property name="userid" column="userid"/>
    

    etc. with properties, not <key-property>s

    The query doesn’t work because you’re trying to select from a LinkId – which is not entity, but a key of Link. Probably some reverse engineering issue.

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

Sidebar

Related Questions

I have two tables in my database: user and media_contact . The media_contact table
I have the following XML document: <database name=pressPlay> <table name=users> <column name=userID type=INT constraints=tableID_c
Imagine we have two tables in the database, user (FK id_role) and role (PK
I have a database table where the user marks files to be downloaded. Subsequently,
I have 2 tables (Users, Wall). The UserID in the Wall table is a
I have a simple database with two tables. Users and Configurations. A user has
I have two tables User and UserRole which are they connected using a link
I have encrypted back-end ACCDB on Win/2003 network. Front-end on user workstations. Link tables
I have a database with three tables: user_table country_table city_table I want to write
Consider the below situation I have a database table as below user_id user_rank ------------------

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.