[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4962) @ManyToOne with @JoinTable fails

Lukasz Antoniak (JIRA) noreply at atlassian.com
Tue Mar 20 13:06:48 EDT 2012


    [ https://hibernate.onjira.com/browse/HHH-4962?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46032#comment-46032 ] 

Lukasz Antoniak commented on HHH-4962:
--------------------------------------

Unfortunately we don't plan to release another version of 3.6 branch. IMO you can have a look at pull request including my two commits, modify source code, and try to build Envers on your own.
If you need any help please let me know (find my mail in the source code).

Links:
- https://github.com/hibernate/hibernate-orm/pull/216
- https://github.com/lukasz-antoniak/hibernate-core/commit/12464d7d73292db8c60cd619840868ccd5918ce9
- https://github.com/lukasz-antoniak/hibernate-core/commit/19c7a8197f485abf7e1bd0547025df311a9ad049

> @ManyToOne with @JoinTable fails
> --------------------------------
>
>                 Key: HHH-4962
>                 URL: https://hibernate.onjira.com/browse/HHH-4962
>             Project: Hibernate ORM
>          Issue Type: Bug
>          Components: envers
>    Affects Versions: 3.3.2
>            Reporter: Clint Popetz
>            Assignee: Lukasz Antoniak
>             Fix For: 4.1.0
>
>         Attachments: test.tar.gz
>
>
> $ cat src/main/java/test/User.java 
> package test;
> import javax.persistence.*;
> import org.hibernate.envers.Audited;
> import java.util.Set;
> The below code fails with "org.hibernate.MappingException: Unable to read the mapped by attribute for widgets in test.User!" but is supported by JPA, at least under hibernate.
> @Entity
> @Audited
> public class User
> {
>     @Id
>     private long id;
>     @OneToMany(mappedBy="user")
>     private Set<Widget> widgets;
> }
> $ cat src/main/java/test/Widget.java 
> package test;
> import javax.persistence.*;
> import org.hibernate.envers.Audited;
> @Entity
> @Audited
> public class Widget
> {
>     @Id
>     private long id;
>     @ManyToOne(fetch=FetchType.LAZY)
> 	@JoinTable(name = "widget_to_user", 
> 		joinColumns = @JoinColumn(name = "widget_id"), 
> 		inverseJoinColumns = @JoinColumn(name = "user_id"))
> 	private User user;
> }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list