Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dali » one to one mapping problems
one to one mapping problems [message #434530] Tue, 31 July 2007 02:17 Go to next message
Eclipse UserFriend
Originally posted by: zhshfeng_xx.126.com

in dali tutorial 1.0,there is a problem in onetoone maping.as so:

@OneToOne(targetEntity=com.zsf.test.Address.class)
@JoinColumn(name="ADDR_ID", referencedColumnName = "ADDRESS_ID", table =
"ADDRE", insertable = false, updatable = false)
private String address;

why JPA report "table 'ADDRE' for join column 'ADDR_ID' can not be
resolved "

ADDRE
package com.zsf.test;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Column;
import javax.persistence.Basic;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.AUTO;

@Entity
@Table(name="ADDRE", schema = "ZSF")
public class Address {
@Id
@Column(name="ADDRESS_ID", table = "ADDRE", insertable = false, updatable
= false)
@GeneratedValue(strategy=AUTO)
private long id;
@Basic
@Column(name="COUNTRY", table = "ADDRE")
private String country;
@Basic
@Column(name="CITY", table = "ADDRE")
private String city;
@Basic
@Column(name="PROVINCE", table = "ADDRE")
private String stateOrProvince;
@Basic
@Column(name="STREET", table = "ADDRE")
private String street;
@Basic
@Column(name="P_CODE", table = "ADDRE")
private String postalCode;

public long getId() {
return id;
}

public void setId(long id) {
this.id = id;
}

public String getCountry() {
return country;
}

public void setCountry(String country) {
this.country = country;
}

public String getCity() {
return city;
}

public void setCity(String city) {
this.city = city;
}

public String getStateOrProvince() {
return stateOrProvince;
}

public void setStateOrProvince(String stateOrProvince) {
this.stateOrProvince = stateOrProvince;
}

public String getStreet() {
return street;
}

public void setStreet(String street) {
this.street = street;
}

public String getPostalCode() {
return postalCode;
}

public void setPostalCode(String postalCode) {
this.postalCode = postalCode;
}

}
Re: one to one mapping problems [message #434533 is a reply to message #434530] Tue, 31 July 2007 14:00 Go to previous message
Neil Hauge is currently offline Neil HaugeFriend
Messages: 475
Registered: July 2009
Senior Member
Dali is most likely reporting this as an error because no ADDRE table
exists on the database. The table name should be ADDRESS in the join
column and in the table definition for the Entity. Give that a try.

Neil

zsf wrote:

> in dali tutorial 1.0,there is a problem in onetoone maping.as so:

> @OneToOne(targetEntity=com.zsf.test.Address.class)
> @JoinColumn(name="ADDR_ID", referencedColumnName = "ADDRESS_ID", table =
> "ADDRE", insertable = false, updatable = false)
> private String address;

> why JPA report "table 'ADDRE' for join column 'ADDR_ID' can not be
> resolved "
Re: one to one mapping problems [message #605096 is a reply to message #434530] Tue, 31 July 2007 14:00 Go to previous message
Neil Hauge is currently offline Neil HaugeFriend
Messages: 475
Registered: July 2009
Senior Member
Dali is most likely reporting this as an error because no ADDRE table
exists on the database. The table name should be ADDRESS in the join
column and in the table definition for the Entity. Give that a try.

Neil

zsf wrote:

> in dali tutorial 1.0,there is a problem in onetoone maping.as so:

> @OneToOne(targetEntity=com.zsf.test.Address.class)
> @JoinColumn(name="ADDR_ID", referencedColumnName = "ADDRESS_ID", table =
> "ADDRE", insertable = false, updatable = false)
> private String address;

> why JPA report "table 'ADDRE' for join column 'ADDR_ID' can not be
> resolved "
Previous Topic:New to JPA
Next Topic:NPE when launching JPA Project wizard
Goto Forum:
  


Current Time: Thu Apr 25 12:45:22 GMT 2024

Powered by FUDForum. Page generated in 0.02778 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top