-->
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.  [ 1 post ] 
Author Message
 Post subject: OneToOne + JoinColumn generating unexpected schema
PostPosted: Mon Jun 15, 2009 9:02 pm 
Newbie

Joined: Mon Feb 16, 2009 6:15 pm
Posts: 2
The code below is generating the following ddl. It seems to indicate that when serializing MySampleFuContainer it will serialize the entire instance of MySamplingFu, rather than emit the foreign key. What should the annotations look like to get an ordinary 1-1 association?

create table rlambda_production.MySampleFuContainer_table (
idSuper varchar(255) not null,
mysamplingfu_ tinyblob,
uuid varchar(255),
id varchar(255),
primary key (idSuper),
unique (uuid)
);

create table rlambda_production.MyBasicFu_table (
idSuper varchar(255) not null,
string_1 varchar(255),
string_2 varchar(255),
string_3 varchar(255),
string_4 varchar(255),
string_5 varchar(255),
string_6 varchar(255),
integer_ integer,
uuid varchar(255),
id varchar(255),
primary key (idSuper),
unique (uuid)
);

@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Table(name = "MySampleFuContainer_table", catalog = "lingo_production", uniqueConstraints = { @UniqueConstraint(columnNames = "uuid") })
public class MySampleFuContainer extends Container {

public final MySamplingFu mysamplingmumble_;

public MySampleFuContainer(MySamplingFu p1) {
mysamplingmumble_ = p1;
}

public <R, A> R accept(net.dslver.sampler.model.lingo.pipeline.persistence.sql.Container.Visitor<R, A> v, A arg) {
return v.visit(this, arg);
}

public boolean equals(Object o) {
if (this == o) return true;
if (o instanceof net.dslver.sampler.model.lingo.pipeline.persistence.sql.MySampleFuContainer) {
net.dslver.sampler.model.lingo.pipeline.persistence.sql.MySampleFuContainer x = (net.dslver.sampler.model.lingo.pipeline.persistence.sql.MySampleFuContainer) o;
return this.mysamplingmumble_.equals(x.mysamplingmumble_);
}
return false;
}

public int hashCode() {
return this.mysamplingmumble_.hashCode();
}

private String uuid;

private String id;

@JoinColumn(name = "idSuper", unique = false, nullable = true, insertable = true, updatable = true)
@OneToOne
public MySamplingFu getMysamplingmumble_() {
return this.mysamplingmumble_;
}

public void setUuid(String uuid) {
this.uuid = uuid;
}

@Column(name = "uuid", unique = false, nullable = true, insertable = true, updatable = true)
public String getUuid() {
return this.uuid;
}

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

@Id
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid")
@Column(name = "id", unique = false, nullable = true, insertable = true, updatable = true)
public String getId() {
return this.id;
}
}

@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class MySamplingFu implements java.io.Serializable {

public abstract <R, A> R accept(MySamplingFu.Visitor<R, A> v, A arg);

public interface Visitor<R, A> {

public R visit(net.dslver.sampler.model.lingo.pipeline.persistence.sql.MyPerfFu p, A arg);

public R visit(net.dslver.sampler.model.lingo.pipeline.persistence.sql.MyBindFu p, A arg);
}

@Id
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid")
private String idSuper;
}


@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Table(name = "MyBasicFu_table", catalog = "lingo_production", uniqueConstraints = { @UniqueConstraint(columnNames = "uuid") })
public class MyBasicFu extends MySamplingFu {

public final String string_1, string_2, string_3, string_4, string_5, string_6;

public final Integer integer_;

public MyBasicFu(String p1, String p2, String p3, String p4, Integer p5, String p6, String p7) {
string_1 = p1;
string_2 = p2;
string_3 = p3;
string_4 = p4;
integer_ = p5;
string_5 = p6;
string_6 = p7;
}

public <R, A> R accept(net.dslver.sampler.model.lingo.pipeline.persistence.sql.MySamplingFu.Visitor<R, A> v, A arg) {
return v.visit(this, arg);
}

public boolean equals(Object o) {
if (this == o) return true;
if (o instanceof net.dslver.sampler.model.lingo.pipeline.persistence.sql.MyBasicFu) {
net.dslver.sampler.model.lingo.pipeline.persistence.sql.MyBasicFu x = (net.dslver.sampler.model.lingo.pipeline.persistence.sql.MyBasicFu) o;
return this.string_1.equals(x.string_1) && this.string_2.equals(x.string_2) && this.string_3.equals(x.string_3) && this.string_4.equals(x.string_4) && this.integer_.equals(x.integer_) && this.string_5.equals(x.string_5) && this.string_6.equals(x.string_6);
}
return false;
}

public int hashCode() {
return 37 * (37 * (37 * (37 * (37 * (37 * (this.string_1.hashCode()) + this.string_2.hashCode()) + this.string_3.hashCode()) + this.string_4.hashCode()) + this.integer_.hashCode()) + this.string_5.hashCode()) + this.string_6.hashCode();
}

private String uuid;

private String id;

@Column(name = "string_1", unique = false, nullable = true, insertable = true, updatable = true)
public String getString_1() {
return this.string_1;
}

@Column(name = "string_2", unique = false, nullable = true, insertable = true, updatable = true)
public String getString_2() {
return this.string_2;
}

@Column(name = "string_3", unique = false, nullable = true, insertable = true, updatable = true)
public String getString_3() {
return this.string_3;
}

@Column(name = "string_4", unique = false, nullable = true, insertable = true, updatable = true)
public String getString_4() {
return this.string_4;
}

@Column(name = "string_5", unique = false, nullable = true, insertable = true, updatable = true)
public String getString_5() {
return this.string_5;
}

@Column(name = "string_6", unique = false, nullable = true, insertable = true, updatable = true)
public String getString_6() {
return this.string_6;
}

@Column(name = "integer_", unique = false, nullable = true, insertable = true, updatable = true)
public Integer getInteger_() {
return this.integer_;
}

public void setUuid(String uuid) {
this.uuid = uuid;
}

@Column(name = "uuid", unique = false, nullable = true, insertable = true, updatable = true)
public String getUuid() {
return this.uuid;
}

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

@Id
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid")
@Column(name = "id", unique = false, nullable = true, insertable = true, updatable = true)
public String getId() {
return this.id;
}
}


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

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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.