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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:46:29+00:00 2026-06-12T14:46:29+00:00

I use hibernate 3.5.4-final. I have two JPA classes. @Entity @Table(name = SPI_V_OP_OBJ_SUBJECT_VR) public

  • 0

I use hibernate 3.5.4-final. I have two JPA classes.

    @Entity
    @Table(name = "SPI_V_OP_OBJ_SUBJECT_VR")
    public class OpSubject_vr extends PersistenceEntity implements Serializable {

        private static final long serialVersionUID = 1858749317461707015L;
        /** id */
        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "ID",
                nullable = false)
        private Long id;

        /** name */
        @Column(name = "F_NAME")
        private String f_name;


        /** type */
        @Column(name = "SUBJECT_TYPE")
        private String subject_type;


        /** okved */
        @ManyToMany
        @JoinTable(name = "SPI_V_OP_OBJ_SUBJECT_VR_OKVED",
                   joinColumns = {@JoinColumn(name = "OBJECT_ID",
                                              referencedColumnName = "ID",
                                              nullable = false)},
                   inverseJoinColumns = {@JoinColumn(name = "SPR_ID",
                                                     referencedColumnName = "ID",
                                                     nullable = false)})
        private List<OpSprOkved> okved_id_mult = new ArrayList<>();
}

and

@Entity
@Table(name = "SPI_V_OP_SPR_OKVED")
public class OpSprOkved extends PersistenceEntity implements Serializable {

    /** id */
    @Id
    @Column(name = "ID", nullable = false)
    private Long id;

    /** code*/
    @Column(name = "CODE")
    private String code;

    /** name*/
    @Column(name = "name")
    private String name;
}

Attribute okved_id_mult is multiple. I want to select objects OpSubject_vr with empty attribute okved_id_mult.

I tried

select ent from OpSubject_vr ent where okved_id_mult is empty; (hibernate error)

select ent from OpSubject_vr ent where okved_id_mult is null; (hibernate error)

select distinct ent from OpSubject_vr ent join ent.okved_id_mult i1 where i1.code is null;(return 0 objects)

  • 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-12T14:46:30+00:00Added an answer on June 12, 2026 at 2:46 pm
    1. Query is fine but you need to qualify okved_id_mult as ent.okved_id_mult.
    2. It is illegal to restrict on collection attributes.
    3. You need to modify the query to use left join. Then it is logically equivalent to the first query.

    See the test case at https://github.com/BatooOrg/BatooJPA/tree/master/community/src/test/java/org/batoo/jpa/community/test/t2

    • 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
I'm using Hibernate 3.6.7-Final and Spring 3.0.5. I have entity like this @Entity public
I use Hibernate with Java. I have two tables which are associated with foreign
I tried to use Hibernate Envers to log the entity histroy. but failed. My
I'm attempting to use hibernate entity manager with mysql and glassfish. I'm getting the
I have a Web Application that use Hibernate 3.0. When I restart my database
I have some EJBs that use Hibernate to persist data to the database. I
My problem is, i have a table User and Table Group (this table use
I have a spring-hibernate web application featured with hazelcast version:1.9.4.8 I use default hazelcast
I'm using Hibernate 3.5.6-Final in Java. Since I don't have access to the Hibernate

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.