Syntax error ")", delete this token, Syntax error: include enumBody to complete block statements, Syntax error: include enum Identifier to complete enumHeader

The method below causes the following errors:
Syntax error ")", delete this token, Syntax error: include enumBody to complete block statements, Syntax error: include enum Identifier to  complete enumHeader.  This is a method copied from the book Enterprise JavaBeans 3.0 and it occurs in all the instances where I use a JoinColumns in a JoinTable annotation (one to meny, many to many..)  What might be causing it?  I am pasting the entire class definition follwoing the method below

Thanks Sunse

  @OneToMany(cascade={CascadeType.ALL})
    @JoinTable(name="CUSTOMER_PHONE"),
    joinColumns={@JoinColumn(name="CUSTOMER_ID")},
    inverseJoinColumns={@JoinColumn(name="PHONE_ID")})
    public Collection<Phone> getPhoneNumber()
    {
          return phoneNumbers;
    }

package titan.domain;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;

import javax.persistence.*;

import titan.domain.CustomerType;
import titan.domain.Phone;


@Entity
@Table(name="CUSTOMER_TABLE")
public class Customer implements Serializable {
    private int id;
    private String firstName;
    private String lastName;
    private String street;
    private String city;
    private String state;
    private CustomerType customerType;
    private Address homeAddress;
    private CreditCard creditCard;
    private Collection<Phone> phoneNumbers = new ArrayList<Phone>();

 
    @Id
    @GeneratedValue
    public int getId()
    {
                  return id;
    }
    public void setId(int id)
    {
                  this.id = id;
    }

    @Column(name="LAST_NAME")
    public String getLastName()
    {
        return lastName;
    }
    public void setLastName(String last)
    {
                  this.lastName = last;
    }
   
    @Column(name="FIRST_NAME")
    public String getFirstName()
    {
          return firstName;
    }
   
    public void setFirstName(String first)
    {
          this.firstName = first;
    }
   
    @Enumerated(EnumType.STRING)
    public CustomerType getCustomerType()
    {
          return customerType;
    }
   
    public void setCustomerType(CustomerType type)
    {
          customerType = type;
    }
   
    @OneToOne(cascade={CascadeType.ALL})
    @PrimaryKeyJoinColumn
    public Address getAddress(){
          return homeAddress;
    }
   
    public void setAddress(Address address)
    {
          this.homeAddress = address;
    }
   
    @OneToOne(cascade={CascadeType.ALL})
    @JoinColumn(name="CREDIT_CARD_ID")
    public CreditCard getCreditCard()
    {
          return creditCard;
    }
   
    public void setCreditCard(CreditCard card)
    {
          this.creditCard = creditCard;
    }
 
    @OneToMany(cascade={CascadeType.ALL})
    @JoinColumn(name="CUSTOMER_ID")
    public Collection<Phone> getPhoneNumbers(){
          return phoneNumbers;
    }
   
    public void setPhoneNumbers(Collection<Phone> phones)
    {
          this.phoneNumbers = phones;
    }
   
    @OneToMany(cascade={CascadeType.ALL})
    @JoinTable(name="CUSTOMER_PHONE"),
    joinColumns={@JoinColumn(name="CUSTOMER_ID")},
    inverseJoinColumns={@JoinColumn(name="PHONE_ID")})
    public Collection<Phone> getPhoneNumber()
    {
          return phoneNumbers;
    }
}
sunseAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kent OlsenData Warehouse Architect / DBACommented:
InverseJoinColumn (line 4) seems to have an extra right paren.
0
sunseAuthor Commented:
Thank you Kdo,  Yes you are right; but when I remove the paren, still get the same error message.  I wonder if this is an Eclipse bug and there is any work around it.

Sunse
0
Kent OlsenData Warehouse Architect / DBACommented:
The same error appears to happen about 6 lines from the bottom, too.  Is that another spot that need correcting or a cut&paste error?

You might change the parameter name in setAddress.  Using a data type name as a value name can cause parse issues.

    public void setAddress(Address address)
    {
          this.homeAddress = address;
    }

becomes

    public void setAddress(Address addressValue)
    {
          this.homeAddress = addressValue;
    }

Kent
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

sunseAuthor Commented:
I will be in touch with a reply
0
sunseAuthor Commented:
Hi All,
I am still stack on the same problem

@ManyToMany
      @JoinTable(name="RESERVATION_CUSTOMER"), //Syntax error on token (","), invalid type
      joinColumns={@JoinColumn(name="RESERVATION_ID")}, //Multiple markers at this line. Synta //error, insert enum identifier to complete Enum header
      inverseJoinColumns={@JoinColumn(name="CUSTOMER_ID")}//Mytiple markers at this line, syntax //error, insert EnumBody to to complete block statement.  Syntax error, insert enum identifier to complete Enum Header.  Syntax erro insert ; to complete field declaration
public Set<Customer> getCustomers()
      {
            return customers;
      }

Thank you,

Sunse
0
sunseAuthor Commented:
I found the fix here: https://docs.jboss.org/hibernate/stable/annotations/reference/en/html/entity.html
This is the way to do it:  It must be some thing having to do with the type of server one is using.  In my case I am using JBOSS.
@ManyToMany
      @JoinTable(name="RESERVATION_CUSTOMER",
      joinColumns=@JoinColumn(name="RESERVATION_ID"),
      inverseJoinColumns=@JoinColumn(name="CUSTOMER_ID"))
      public Set<Customer> getCustomers()
      {
            return customers;
      }
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sunseAuthor Commented:
Because I found the solution.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.