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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:04:50+00:00 2026-06-12T02:04:50+00:00

I know that there is many question about it but i can not find

  • 0

I know that there is many question about it but i can not find a good answered for my problem .

I am using Jboss as 7, Spring and Hibernate (4) as JPA 2.0 provider so i have got simple @OneToMany bi-directional relationship :

I have got super class person like that:

@MappedSuperclass
@Inheritance(strategy=InheritanceType.JOINED)
public abstract class Person {

@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Long id;

@NotNull
@Size(min = 1, max = 25)
@Pattern(regexp = "[A-Za-z ]*", message = "must contain only letters and spaces")
private String name;  


public Person(String name) {
    super();
    this.name = name;
}

And class Member:

@Entity
@Table(uniqueConstraints = @UniqueConstraint(columnNames = "email"))
public class Member extends Person implements Serializable
{
   /** Default value included to remove warning. Remove or modify at will. **/
   private static final long serialVersionUID = 1L;


   @NotNull
   @NotEmpty
   @Email
   private String email;

   @NotNull
   @Size(min = 10, max = 12)
   @Digits(fraction = 0, integer = 12)
   @Column(name = "phone_number")
   private String phoneNumber;

   @OneToMany(cascade=CascadeType.ALL , mappedBy="member" , fetch=FetchType.EAGER)
   private List<Order> orders;

And also class Order:

@Entity
public class Order {

@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Integer id;

private float price; 

@ManyToOne(optional=false)
private Member member;

private String name;

So i think that it is a good configuration, but i test this application in HSQL in memory and i have got error :

Hibernate: alter table Order drop constraint FK48E972E548C740B
2012-09-20 16:25:37 org.hibernate.tool.hbm2ddl.SchemaExport perform
ERROR: HHH000389: Unsuccessful: alter table Order drop constraint FK48E972E548C740B
2012-09-20 16:25:37 org.hibernate.tool.hbm2ddl.SchemaExport perform
ERROR: Blad skladniowy w wyrazeniu SQL "ALTER TABLE ORDER[*] DROP CONSTRAINT FK48E972E548C740B "; oczekiwano "identifier"
Syntax error in SQL statement "ALTER TABLE ORDER[*] DROP CONSTRAINT FK48E972E548C740B "; expected "identifier"; SQL statement:
alter table Order drop constraint FK48E972E548C740B [42001-165]

And also :

Syntax error in SQL statement "CREATE TABLE ORDER[*] (ID INTEGER GENERATED BY DEFAULT AS IDENTITY, NAME VARCHAR(255), PRICE FLOAT NOT NULL, MEMBER_ID BIGINT NOT NULL, PRIMARY KEY (ID)) "; expected "identifier"; SQL statement:

And my JUnit test failed i dont know what is wrong with this configuration …

this is my simply junit :

  @Test
public void testInsertWithOrder(){
    Order order = new Order(20.0f, "first stuff");
    Order order2 = new Order(40.0f, "secondary stuff");
    List<Order> orders = new ArrayList<Order>();
    orders.add(order2);
    orders.add(order);

    Member member = new Member("Member name", "member23@gmail.com", "2125552141", orders);

    memberDao.register(member);

    List<Member> members = memberDao.findAllOrderedByName();

    Assert.assertNotNull(members);
    Assert.assertEquals(1, members.size());     

}
  • 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-12T02:04:51+00:00Added an answer on June 12, 2026 at 2:04 am

    Change table name from ‘order’ to something different, like PersonOrder

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

Sidebar

Related Questions

NOTE: I know there are many questions that talked about that but I'm still
I know there are multiple questions about this same question but I couldn't find
I know that there are many different questions about this sort of topic on
Firstly I know that there are many question and solutions to correct thread marshalling
It's my first question on SO. I know that there were many topics on
I know that there are many Delphi database related questions available, but I'm considering
I know there are many discussions about the emulator which is so slow that
There are many things that all programmers should know, but I am particularly interested
I know there are many other questions about the EXC_BAD_ACCESS error but this. I
I know this question has been asked 100x but I can't seem to find

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.