Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » eclipselink generates table on the wrong schema
eclipselink generates table on the wrong schema [message #730638] Wed, 28 September 2011 18:43 Go to next message
Luiz E. is currently offline Luiz E.Friend
Messages: 100
Registered: September 2010
Senior Member
hi all.
i have a relation like this


@Entity
@Table(schema="ecf")
public class ImpressoraFiscal implements Serializable{
private static final long serialVersionUID = 6246259319048104042L;

@OneToMany(cascade={CascadeType.ALL}, orphanRemoval=true)
private List<Aliquota> aliquotas = new ArrayList<Aliquota>();



and

@Entity
@Table(schema="ecf")
public class Aliquota implements Serializable {
private static final long serialVersionUID = -1473589350884030504L;

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


and as you can see, both table are in 'ecf' schema. this kind of relationship generates a table like 'ImpressoraFiscal_Aliquota'. so far, everything is ok
but this is weird: this table 'ImpressoraFiscal_Aliquota' is generated on 'public' schema (i'm using postgre)
is this the expected behavior?

thanks in advanced
Re: eclipselink generates table on the wrong schema [message #730863 is a reply to message #730638] Thu, 29 September 2011 12:09 Go to previous messageGo to next message
Guy Pelletier is currently offline Guy PelletierFriend
Messages: 19
Registered: July 2009
Junior Member
The behavior is correct since you are allowing the join table to default on the OneToMany. You'll need to add @JoinTable(schema="ecf") to have it in the same schema.

Alternatively, you can specify a schema default in XML under the <persistence-unit-defaults> to apply to all your tables.

Cheers,
Guy
Re: eclipselink generates table on the wrong schema [message #731049 is a reply to message #730863] Thu, 29 September 2011 18:43 Go to previous message
Luiz E. is currently offline Luiz E.Friend
Messages: 100
Registered: September 2010
Senior Member
thank you!
the @JoinTable did the trick!
Previous Topic:eclipselink generates table on the wrong schema
Next Topic:@Embeddable Inheritance
Goto Forum:
  


Current Time: Thu Mar 28 22:22:29 GMT 2024

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

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

Back to the top