Hibernate version:
3.2
Hi!
Urls holds urls and gzhtml holds the gzipped HTML code. Pretty simple.
Code:
public class Urls
{
@Id
@GeneratedValue( generator = "hibernate-uuid" )
private String id;
@Column( name = "url" )
private String url;
@OneToOne
@PrimaryKeyJoinColumn
private GzHtml gzHtml;
Code:
public class GzHtml
{
@Id
@Column( name = "url_id" )
private String urlId;
@Column( name = "html" )
private byte[] html;
Now I simply want to save a new entity but the following code only saves the Urls entity, not GzHtml. Why? What am I doing wrong?
Code:
Urls u = new Urls();
u.setUrl( url.toString() );
GzHtml h = new GzHtml();
h.setHtml( Utility.compress( html ) );
u.setGzHtml( h );
session.save( u );