-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 
Author Message
 Post subject: Repeated column in mapping for entity
PostPosted: Wed Jun 04, 2008 4:59 pm 
Newbie

Joined: Fri May 30, 2008 9:05 am
Posts: 18
Hello, sorry for my bad english.

I now have a new problem (the most strange is that I think I have exactly the same code in two different computers, but I have the error only on one of them.

So, I am just trying to understand the use of oneToMany and ManyToOne annotations.

My database schema is very simple:

Code:
CREATE TABLE PERSON(
  ID INTEGER,
  NAME VARCHAR(50) NOT NULL,
  CONSTRAINT PK_PERSON PRIMARY KEY (ID)
);

CREATE TABLE ADDRESS(
  ID INTEGER,
  PERSON_ID INTEGER NOT NULL,
  ADDRESS VARCHAR(100) NOT NULL,
  CONSTRAINT PK_ADDRESS PRIMARY KEY (ID),
  CONSTRAINT FK_PERSON FOREIGN KEY (PERSON_ID)
     REFERENCES PERSON(ID)
   ON DELETE CASCADE
   ON UPDATE CASCADE
);


So I have a onetomany relation between Person and Address.

And the entities corresponding...

Person
Code:
@Entity
@Table(name="PERSON")
@NamedQueries({
    @NamedQuery(name="person.findAll", query="SELECT p FROM Person p"),
    @NamedQuery(name="person.findByName", query="SELECT p FROM Person p WHERE p.name LIKE :name")
})
public class Person implements Serializable {
   
    private static final long serialVersionUID = 1L;
    private Long id;
    private String name;
    private Collection<Address> addresses;
   
    public Person(){}
   
    public Person(String name){
        this.name= name;
    }
   
    /********************************/
   
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getId() {
        this.logger.info("<getId>");
        return id;
    }
   
    public void setId(Long id) {
        this.logger.info("<setId>");
        this.id = id;       
    }

    public String getName() {
        this.logger.info("<getName>");
        return name;
    }

    public void setName(String name) {
        this.logger.info("<setName>");
        this.name = name;       
    }
   
    @OneToMany(mappedBy="person_id",cascade=CascadeType.ALL)
    public Collection<Address> getAddresses() {
        return this.addresses;
    }

    public void setAddresses(Collection<Address> addresses) {
        this.addresses = addresses;
    }
   
    /**********************************/

    ...

}



Adress
Code:
@Entity
@Table(name="ADDRESS")
public class Address implements Serializable {
    private static final long serialVersionUID = 1L;

    private Long id;
    private Long person_id;
    private Person person;
   
    private String address;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }
   
    public Long getPerson_id() {
        return person_id;
    }

    public void setPerson_id(Long person_id) {
        this.person_id = person_id;
    }

    @ManyToOne
    @JoinColumn(name="person_id")
    public Person getPerson() {
        return person;
    }

    public void setPerson(Person person) {
        this.person = person;
    }
   
    public String getAddress() {
        return address;
    }

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

    ...
}


And I have the following error (at deployment):
[code]
org.hibernate.MappingException: Repeated column in mapping for entity: app.ejb.entity.Address column: person_id (should be mapped with insert="false" update="false")
[code]

I absolutely don't understand...

Does someone can identify the problem in this example? Because for me it's impossible to do more easy.

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 05, 2008 12:32 am 
Senior
Senior

Joined: Mon Feb 25, 2008 1:48 am
Posts: 191
Location: India
Your getPersonId() method in the Address class should include an annotation
Code:
@Column(insertable = false, updatable = false)
public Long getPerson_id() {
        return person_id;
}


(or)

u can modify the annotation in for getPerson() method as follows

Code:
@ManyToOne
    @JoinColumn(name="person_id", insertable = false, updatable = false)
    public Person getPerson() {
        return person;
    }

_________________
Sukirtha


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 05, 2008 4:22 am 
Newbie

Joined: Fri May 30, 2008 9:05 am
Posts: 18
Thank you, effectively it's ok like this

I could have try this with the message error, but I need to understand.

So, does someone can explain me why hibernate needs this type of precision?

Like habitually, I don't understand, it's a very simple oneToMany <-> ManyToOne annotation, so what's the problem.

What does mean the values insertable=false and updatable= false on the getPerson method, Hibernate already knows that it is not a column of the table Address, so insert what? updatewhat?

Where is there several mappings of the same column in this example???


Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 05, 2008 4:27 am 
Regular
Regular

Joined: Wed Apr 09, 2008 10:28 am
Posts: 52
i'm assuming your creating the tables by yourself. Actually you can let this be done by hibernate. But anyway when u create the tables by hand you have to add the approipriate constraints in your classes too which you did set up in the creates.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 05, 2008 4:53 am 
Newbie

Joined: Fri May 30, 2008 9:05 am
Posts: 18
Ah, ok, thank you.

But why is it needed only for the join column. Logically, I should have the same errors on any column where I set NOT NULL in my script, no?

And even with this, I don't understand the meaning of insertable=false, updatable=false, what is the corresponding constraint in my database schema? (it is at the top of the post)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 05, 2008 5:10 am 
Newbie

Joined: Wed Nov 16, 2005 6:09 pm
Posts: 5
In your Address class you have:
private Long person_id;
private Person person;

By default, person_id will map to the column person_id.
For person, you explicitly map person based on person_id.

So you have two fields mapped by person_id.

On update or insert, what value should be persisted to the person_Id column. There are two choices - either person_id or person.getId(). By specifying insert = false and update = false on one of the person_id mappings, you are ensuring hibernate is clear on how to persist to the person_id column.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 05, 2008 5:55 am 
Newbie

Joined: Fri May 30, 2008 9:05 am
Posts: 18
Yes I understand, thank you again, but, sorry if I insist, there is something strange for me.

Firstly, we are always speaking about mapping. But in my mind, a map is only for [column] <-> [attribute] (or columns<->class)

Always in my mind, in the case of getPerson, person_id is just used to do the relation with Person (no notion of mapping here), and the only mapping for the attribute person_id is the column of the same name, person_id...

The use of ManyToOne annotation should be sufficient for hibernate to know that Person will not be mapped on the person_id column!!! So, it should also know which attributes use for which column, and which column ise used for the relation.

I am sure I am wrong, and there is certainly something very simple I haven't seen. So this is how I come to these annotations.

In the oneToMany relation, if I don't set any option, hibernate is not agree, it absolutely needs the mappedby attribute (until here I can understand, because several different foreign keys in address could reference Person). So i had to add the mappedBy property. After this, if I don't set the person_id attribute in the address class, there is a problem. So I add it and this causes the problem I now have.

So finally, which tables you would have create, and with which annotations in your entities. With the differences, I will maybe see what's happening in my case.

Thank you for all.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 05, 2008 6:22 am 
Newbie

Joined: Wed Nov 16, 2005 6:09 pm
Posts: 5
Quote:
person_id is just used to do the relation with Person (no notion of mapping here)


This is a mapping. You explicitly map tell hibernate that Person is mapped to address using the person_id.

Look at it from the other angle. Map person_id once with just the ManyToOne annotation.

@Entity
@Table(name="ADDRESS")
public class Address implements Serializable {
private static final long serialVersionUID = 1L;

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

@ManyToOne
@JoinColumn(name="person_id")
private Person person;

private String address;

public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Person getPerson() {
return person;
}
public void setPerson(Person person) {
this.person = person;
}
}

You assign a person (via setPerson) and hibernate will correctly update/insert the person_id column. Just one mapping for person_id. Simple.

If you accept this works, then adding a person_id field is adding a second mapping. With two mappings for one field, hibernate needs to be able to determine which value to persist in the person_id field.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 05, 2008 12:13 pm 
Newbie

Joined: Fri May 30, 2008 9:05 am
Posts: 18
Thank you.

I actually use the annotations as proposed in the last post.
As there is no id_person attribute in my address entity, I have to remove the mappedBy="id_person" attribute from the Person Entity. Else, hibernate will say that he needs the attribute "id_person".

So I have removed mappedBy (it's the only difference in the person entity compared to this I displayed before).

This is what happens now when I try to parse the collection returned by person.getAddresses (from a stateless bean, in the same tier than entities):

Code:
EJB5018: An exception was thrown during an ejb invocation on [PersonManagerBean]
javax.ejb.EJBException
        at com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:3869)
        at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3769)
        at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3571)
        at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1354)
        at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1316)
        at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:205)
        at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:127)
        at $Proxy50.doTest(Unknown Source)
        at app.servlets.TestServlet.processRequest(TestServlet.java:66)
        at app.servlets.TestServlet.doGet(TestServlet.java:82)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
        at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
        at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
        at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:380)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
        at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
Caused by: org.hibernate.exception.SQLGrammarException: could not initialize a collection: [app.ejb.entity.Person.addresses#2]
        at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
        at org.hibernate.loader.Loader.loadCollection(Loader.java:2001)
        at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36)
        at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:565)
        at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:63)
        at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1716)
        at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344)
        at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
        at org.hibernate.collection.PersistentBag.iterator(PersistentBag.java:249)
        at app.ejb.session.PersonManagerBean.doTest(PersonManagerBean.java:83)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1067)
        at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:176)
        at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2895)
        at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3986)
        at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:197)
        ... 38 more
Caused by: java.sql.SQLException: Table not found in statement [select addresses0_.PERSON_id as PERSON1_2_, addresses0_.addresses_id as addresses2_2_, address1_.id as id1_0_, address1_.address as address1_0_, address1_.id_person as id3_1_0_, person2_.id as id0_1_, person2_.name as name0_1_ from PERSON_ADDRESS addresses0_ left outer join ADDRESS address1_ on addresses0_.addresses_id=address1_.id left outer join PERSON person2_ on address1_.id_person=person2_.id where addresses0_.PERSON_id=?]
        at org.hsqldb.jdbc.Util.throwError(Unknown Source)
        at org.hsqldb.jdbc.jdbcPreparedStatement.<init>(Unknown Source)
        at org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source)
        at com.sun.gjc.spi.base.ConnectionHolder.prepareStatement(ConnectionHolder.java:475)
        at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:505)
        at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:423)
        at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
        at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
        at org.hibernate.loader.Loader.doQuery(Loader.java:673)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
        at org.hibernate.loader.Loader.loadCollection(Loader.java:1994)
        ... 55 more
StandardWrapperValve[TestServlet]: PWC1406: Servlet.service() for servlet TestServlet threw exception
javax.ejb.EJBException
        at com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:3869)
        at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3769)
        at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3571)
        at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1354)
        at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1316)
        at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:205)
        at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:127)
        at $Proxy50.doTest(Unknown Source)
        at app.servlets.TestServlet.processRequest(TestServlet.java:66)
        at app.servlets.TestServlet.doGet(TestServlet.java:82)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
        at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
        at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
        at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:380)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
        at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
Caused by: org.hibernate.exception.SQLGrammarException: could not initialize a collection: [app.ejb.entity.Person.addresses#2]
        at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
        at org.hibernate.loader.Loader.loadCollection(Loader.java:2001)
        at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36)
        at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:565)
        at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:63)
        at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1716)
        at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344)
        at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
        at org.hibernate.collection.PersistentBag.iterator(PersistentBag.java:249)
        at app.ejb.session.PersonManagerBean.doTest(PersonManagerBean.java:83)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1067)
        at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:176)
        at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2895)
        at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3986)
        at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:197)
        ... 38 more
Caused by: java.sql.SQLException: Table not found in statement [select addresses0_.PERSON_id as PERSON1_2_, addresses0_.addresses_id as addresses2_2_, address1_.id as id1_0_, address1_.address as address1_0_, address1_.id_person as id3_1_0_, person2_.id as id0_1_, person2_.name as name0_1_ from PERSON_ADDRESS addresses0_ left outer join ADDRESS address1_ on addresses0_.addresses_id=address1_.id left outer join PERSON person2_ on address1_.id_person=person2_.id where addresses0_.PERSON_id=?]
        at org.hsqldb.jdbc.Util.throwError(Unknown Source)
        at org.hsqldb.jdbc.jdbcPreparedStatement.<init>(Unknown Source)
        at org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source)
        at com.sun.gjc.spi.base.ConnectionHolder.prepareStatement(ConnectionHolder.java:475)
        at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:505)
        at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:423)
        at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
        at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
        at org.hibernate.loader.Loader.doQuery(Loader.java:673)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
        at org.hibernate.loader.Loader.loadCollection(Loader.java:1994)
        ... 55 more


So I suppose there is an other problem in the annotations.
This trace doesn't help me a lot, and there is one thing I find particularly strange, the last "Caused by", hibernate is searching for a table named PERSON_ADDRESS. It maybe creates this table to manage the oneToMany, manyToOne relation. I don't know if it is important, but it's again strange for me.

If you have any ideas...

Thanks in advance.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.