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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:06:16+00:00 2026-05-23T03:06:16+00:00

class X { Y y; // manyToOne } class Y { Long id; }

  • 0
class X {
Y y; // manyToOne
}
class Y {
Long id;
}

@NamedQuery(name = "someName", query = "from X where y.id in :ids")

I have public, table, entity and all other things on the Entities but I didn’t wrote them here.

TypedQuery<X> query = getEntityManager().createNamedQuery("someName", X.class);
query.setParameter("ids", someListOfLongs); // HERE I GET THE ERROR
queryFinal.getResultList();

Parameter value [[Ljava.lang.Object;@90d0bf] was not matching type [java.lang.Long]

I tried with or without (), I changed the version of Hibernate-Core to 3.6.4 (from JBoss 6.0.0.Final), otherwise if I wrote in :ids without () I’d got an error.

Please Help.

The IN always worked, the problem was that List<Long> wasn't actually List<Long> was List<Object[]>. 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-05-23T03:06:17+00:00Added an answer on May 23, 2026 at 3:06 am

    I also use JBoss AS 6 and this exact construct, but it just works.

    This is an example of a query:

    <named-query name="Item.getByItemIDs">
        <query>
            SELECT
                i
            FROM
                Item i
            WHERE
                i.ID in (:itemsIDs)
        </query>
    </named-query>
    

    And of a class using it:

    @Override
    public List<Item> getByItemIDs(List<Long> itemIDs) {
        return entityManager.createNamedQuery("Item.getByItemIDs", Item.class)
                            .setParameter("itemIDs", itemIDs)
                            .getResultList();
    }
    

    As your exception indicated [[Ljava.lang.Object;@90d0bf] (which is an Object[]), maybe you should try List<Long> as in my example?

    (p.s. You can use the fluid API of JPA to make your code a little less verbose)

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

Sidebar

Related Questions

I have two entities: Event and Comment. @Entity @Table(name = events) public class Event
Here my EJB @Entity @Table(name = modelos) @NamedQueries({ @NamedQuery(name = Modelos.findAll, query = SELECT
I have the following annotated Hibernate entity classes: @Entity public class Cat { @Column(name
I have the following entities: @Entity public class Alert implements Serializable { private long
@Entity public class Store {} @Entity @Table(name = storeitem) public class StoreItem { @Id
I have this mapping: [Class(Table = foo, Name = Foo)] public class Foo {
let be the following entities: @Entity public class Person { @Id long id; @ManyToOne
Say I have a unidirectional @ManyToOne relationship like the following: @Entity public class Parent
Key Entity: @Entity public class KeyEntity { @Id @GeneratedValue(strategy = GenerationType.TABLE) public Long id;
i have an entity that contains two other entities with @ManyToOne relationship. @Entity public

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.