Link to home
Start Free TrialLog in
Avatar of sunse
sunseFlag for United States of America

asked on

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;
    }
}
Avatar of Kent Olsen
Kent Olsen
Flag of United States of America image

InverseJoinColumn (line 4) seems to have an extra right paren.
Avatar of sunse

ASKER

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
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
Avatar of sunse

ASKER

I will be in touch with a reply
Avatar of sunse

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of sunse
sunse
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sunse

ASKER

Because I found the solution.