-->
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: Problem with @CollectionOfElements for @Embeddable?
PostPosted: Mon Dec 27, 2010 9:30 pm 
Newbie

Joined: Mon Jun 20, 2005 12:20 pm
Posts: 17
Hi All,

I just cannot use @CollectionOfElements with @Embeddable. The following is my classes and mappings:

@MappedSuperclass
public abstract class AbstractEntity implements Serializable {
@CollectionOfElements
protected Set<Audit> audits;
...
}

@Embeddable
public class Audit implements Serializable {
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "user_id", nullable = false)
protected User user;

@Temporal(TemporalType.TIMESTAMP)
@Column(name = "time_stamp")
protected Date timeStamp = null;
...
}

@Entity
@Table(name = "test_result")
public class TestResult extends AbstractEntity {
...
}

Hibernate created the following table:

CREATE TABLE `test_result_audits` (
`test_result_id` bigint(20) NOT NULL,
`timeStamp` datetime DEFAULT NULL,
`user` tinyblob,
KEY `FK7698D96DD913D5B7` (`test_result_id`),
CONSTRAINT `FK7698D96DD913D5B7` FOREIGN KEY (`test_result_id`) REFERENCES `test_result` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

The annotations in the Embeddable class are totally ignored. I have tried different ways in the past several days, but nothing worked.

Any help will be appreciated.

-ZJ


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