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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T03:37:58+00:00 2026-05-29T03:37:58+00:00

I am working on an Java/J2EE web application. The persistence of data is made

  • 0

I am working on an Java/J2EE web application. The persistence of data is made by JPA/TopLink. And I have an issue with this entity :

    @Entity
@Table(name = "articlecatalogue_has_article", catalog = "artisance", schema = "public")
@NamedQueries({@NamedQuery(name = "ArticlecatalogueHasArticle.findAll", query = "SELECT a FROM ArticlecatalogueHasArticle a"), @NamedQuery(name = "ArticlecatalogueHasArticle.findByArcIntId", query = "SELECT a FROM ArticlecatalogueHasArticle a WHERE a.articlecatalogueHasArticlePK.arcIntId = :arcIntId"), @NamedQuery(name = "ArticlecatalogueHasArticle.findByArtIntId", query = "SELECT a FROM ArticlecatalogueHasArticle a WHERE a.articlecatalogueHasArticlePK.artIntId = :artIntId"), @NamedQuery(name = "ArticlecatalogueHasArticle.findByAhaDecQuantite", query = "SELECT a FROM ArticlecatalogueHasArticle a WHERE a.ahaDecQuantite = :ahaDecQuantite"), @NamedQuery(name = "ArticlecatalogueHasArticle.findByAhaDecPrixvente", query = "SELECT a FROM ArticlecatalogueHasArticle a WHERE a.ahaDecPrixvente = :ahaDecPrixvente")})
public class ArticlecatalogueHasArticle implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected ArticlecatalogueHasArticlePK articlecatalogueHasArticlePK;
    @Column(name = "aha_dec_quantite")
    private BigDecimal ahaDecQuantite;
    @Column(name = "aha_dec_prixvente")
    private BigDecimal ahaDecPrixvente;
    @JoinColumn(name = "art_int_id", referencedColumnName = "art_int_id", insertable = false, updatable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Article article;
    @JoinColumn(name = "arc_int_id", referencedColumnName = "arc_int_id", insertable = false, updatable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Articlecatalogue articlecatalogue;

And the multiple primary keys :

@Embeddable
public class ArticlecatalogueHasArticlePK implements Serializable {
    @Basic(optional = false)
    @Column(name = "arc_int_id")
    private int arcIntId;
    @Basic(optional = false)
    @Column(name = "art_int_id")
    private int artIntId;

When I try to make persistent an ArticlecatalogueHasArticle entity I have this following error :

Local Exception Stack: 
Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.1 (Build b60e-fcs (12/23/2008))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: ERREUR: une valeur NULL viole la contrainte NOT NULL de la colonne « arc_int_id »
Error Code: 0
Call: INSERT INTO artisance.public.articlecatalogue_has_article (aha_dec_prixvente, aha_dec_quantite, art_int_id, arc_int_id) VALUES (?, ?, ?, ?)
    bind => [null, 1, null, null]

Whereas the fields arcIntId and artIntId are not null in the entity which I want to make persistent. I think the problem is due to the double instance of the columns “art_int_id” and “arc_int_id” in the ArticlecatalogueHasArticlePK and in the ArticlecatalogueHasArticle @JoinColumn, but I am not sure and I do not know how to solve the problem.

Any help is appreciated.

  • 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-29T03:37:59+00:00Added an answer on May 29, 2026 at 3:37 am

    Ensure you are setting the id values in the articlecatalogueHasArticlePK, if you do not set them, then they will be null.

    You could also remove the articlecatalogueHasArticlePK, and use a IdClass instead of an EmbeddedId. Then you only need to put @Id on your ManyToOne, and don’t need any duplicates.

    You could also put insertable/updateable false on the basics and true on the ManyToOne if you want to pick the ids up from the relationships.

    See,
    http://en.wikibooks.org/wiki/Java_Persistence/Identity_and_Sequencing#Primary_Keys_through_OneToOne_and_ManyToOne_Relationships

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

Sidebar

Related Questions

I have been working in Java/J2ee projects, in which I follow the Maven structure.
I'm working in J2EE web project, which has lots of Java, SQL scripts, JS,
Background about myself: I have about 3 years experience working in Java/J2EE. I am
I have been developing a Java application using J2EE and a Derby database. My
I'm working with J2EE application and my web application has to recognize the user
My Java EE web application is working fine with Glassfish 2.1. Now I want
I have weird problem. I'm using Eclipse for writing J2EE (java, jsf, javascript) application
I have a working java web app for document management. On document creation i
I have been working with Java a couple of years, but up until recently
I'm working with java, trying to use the AudioFormat Class. I have the following

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.