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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:37:21+00:00 2026-06-03T02:37:21+00:00

I have the following Entities @Entity public class Conversation implements Serializable { @Id private

  • 0

I have the following Entities

@Entity
public class Conversation implements Serializable {

    @Id
    private int Id;

    @Column
    private Alias AliasA;

    // SNIP
}

and

@Entity
public class Alias implements Serializable {

    @Id
    private String alias;

    @Column
    private String personalName;

    @OneToMany(mappedBy = "alias", cascade = CascadeType.ALL)
    @MapKeyColumn(name="address")
    private Map<String, Recipient> recipients = new HashMap<String, Recipient>();
}

and

@Entity
public class Recipient implements Serializable {

    @Id
    @GeneratedValue
    private long id;

    @Column
    private String address;

    @Column
    private RecipientStatus status;

    @ManyToOne
    private Alias alias;
}

And I would like to make something like the following JPQL query

SELECT conversation FROM Conversation conversation WHERE :sender MEMBER OF conversation.aliasA.recipients AND conversation.adId=:adID

Where :sender is in the key of my Map. The MEMBER OF keyword however only seems to work with Sets and not with Maps. I believe that JPA 2.0 should offer the KEY keyword, but this doesn’t seem to be implemented in OpenJPA yet. Is there an alternative to this?

Update: Added information to clarify my question.

  • 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-03T02:37:22+00:00Added an answer on June 3, 2026 at 2:37 am

    While axtavt’s answer gave me the hint I needed, the answer was actually, that the error checking in IntelliJ 10.5.4 is not to be trusted in this case.

    The KEY keyword does indeed work and the correct query was

    SELECT conversation FROM Conversation conversation JOIN conversation.aliasA.recipients recipients WHERE KEY(recipients) = :senderAddress AND conversation.adId=:adID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following entities: @Entity public class Alert implements Serializable { private long
Suppose I have the following 2 entities: @Entity public class Person implements Serializable {
Say, I have following entities: @Entity public class A { @Id @GeneratedValue private Long
I have the following entities: @Entity public class Owner{ @Id @Column(name = OWNER_ID) @OneToMany()
I have the following entities in Entity Framework: public class School { public int
Suppose I have the following entities: @Entity @Table(name = A) public class A implements
I have two entities: @Entity public class File ....... @Id @GeneratedValue(strategy=GenerationType.AUTO) private int id;
I have the following two entities: @Entity class Relation{ @ManyToOne private User user; //some
I have the following 2 entities: @Entity(name = Employee) @Table(name = EMPLOYEE) public class
We have the following two entities with many-to-many association: @Entity public class Role {

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.