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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:27:07+00:00 2026-05-16T08:27:07+00:00

I make use of: NetBeans IDE 6.7.1, GlassFish v2.1, Oracle 10g XE, JAVA 6

  • 0

I make use of: NetBeans IDE 6.7.1, GlassFish v2.1, Oracle 10g XE, JAVA 6 SE, JAVA 5 EE.

I have problem with an @ManyToMany annotation:

@ManyToMany(fetch=FetchType.EAGER)
@JoinTable(name="CUST_RENT_MOVIE", joinColumns={@JoinColumn(name="CUST_ID")}, inverseJoinColumns={@JoinColumn(name="TITLE")})
private Collection<CustRentMovie> rents = new ArrayList<CustRentMovie>();

part of the output of the GlassFish v2.1.1

Exception Description: The @JoinColumns on the annotated element [private java.util.Collection vc.domain.Customer.rents] from the entity class [class vc.domain.Customer] is incomplete. When the source entity class uses a composite primary key, a @JoinColumn must be specified for each join column using the @JoinColumns. Both the name and the referenceColumnName elements must be specified in each such @JoinColumn.
javax.persistence.PersistenceException: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.1 (Build b31g-fcs (10/19/2009))): oracle.toplink.essentials.exceptions.EntityManagerSetupException
Exception Description: predeploy for PersistenceUnit [vc_pu] failed.

part of the script that create the database:

CREATE table customer
(
cust_id NUMBER(5),    
CONSTRAINT cust_pk PRIMARY KEY (cust_id),
...
)

CREATE TABLE movie
(
title VARCHAR2(50) PRIMARY KEY,
...
)

CREATE TABLE cust_rent_movie
(
title VARCHAR2(50),
cust_id NUMBER(5),
rent_date DATE DEFAULT current_date NOT NULL,
return_date DATE,
CONSTRAINT cust_rent_movie_pk PRIMARY KEY (title, cust_id, rent_date),
CONSTRAINT CustRentMovie_movie_fk FOREIGN KEY (title) REFERENCES movie ON DELETE CASCADE,
CONSTRAINT CustRentMovie_cust_fk FOREIGN KEY (cust_id) REFERENCES customer ON DELETE CASCADE
)

the code of the Customer class

@Entity
@Table(name = "customer")
@SequenceGenerator(name="seq", sequenceName="cust_id_seq", allocationSize=1)
public class Customer implements Serializable
{

    @Id
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="seq")
    @Column(name="CUST_ID")
    private int id;


    @ManyToMany(fetch=FetchType.EAGER)
    @JoinTable(name="CUST_RENT_MOVIE", joinColumns={@JoinColumn(name="CUST_ID")}, inverseJoinColumns={@JoinColumn(name="TITLE")})
    private Collection<CustRentMovie> rents = new ArrayList<CustRentMovie>();


    public Collection<CustRentMovie> getRents()
    {
        return rents;
    }

    public void setRents(Collection<CustRentMovie> rents)
    {
        this.rents = rents;
    }
...
}

by mistake I put as type in the collection the class CustRentMovie instead of Movie So I changed the

private Collection<CustRentMovie> rents = new ArrayList<CustRentMovie>();

to

private Collection<Movie> movies = new ArrayList<Movie>();
  • 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-16T08:27:08+00:00Added an answer on May 16, 2026 at 8:27 am

    CustomerRentMovie’s PK is made up of three columns (title, cust_id, rent_date). Toplink is indicating that you need to specify all three as join columns in your @JoinColumn annotation (currently you have specified only cust_id).

    Changing the annotation to something like this should get you past this error.

    @JoinTable(name = "CUST_RENT_MOVIE", joinColumns = {
        @JoinColumn(name = "CUST_ID"),
        @JoinColumn(name = "TITLE"),
        @JoinColumn(name = "RENT_DATE") }, inverseJoinColumns = { @JoinColumn(name = "TITLE") })
    private Collection<CustRentMovie> rents = new ArrayList<CustRentMovie>();
    

    That said, Pascal’s question is valid – it looks like you intended to have a relationship from Customer to Movie, not Customer to CUST_RENT_MOVIE.

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

Sidebar

Related Questions

I make use of: NetBeans IDE 6.7.1, GlassFish v2.1, Oracle 10g XE, JAVA 6
I need to make use of some OWL ontologies in c#. Does anyone have
I'm trying to use NetBeans to compile C code and have the following versions
I'm a fairly experienced Java user, but I've just started trying to use NetBeans
Im using the Morena API's in order to make use of scanners thorough Java.
In the NetBeans 6.9 IDE, if you create a New Project >> Java >>
I'm using NetBeans and GlassFish 3.0.1 to create an EJB3 application. I have written
I'm trying to use Netbeans to make a web application using facelets. I want
I got a question about the IDEs: With Java, you use Netbeans or Eclipse,
I use to make use of wildcards in a Makefile in order to select

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.