hibernate: association with unmapped entity

     table : map__company__branches (company_id int, branch_id int, is_primary_branch tinyint(1))

    public class company
    {
     @ManyToMany(fetch = FetchType.LAZY)
     @JoinTable(name = "map__company__branches", joinColumns = { @JoinColumn(name = "company_id") })
     @MapKeyManyToMany(joinColumns = { @JoinColumn(name = "branch_id") })
         @column(name="is_primary_branch")
         Map<Branch, Boolean> branchMap;
    }

Since Boolean type is not mapped entity so its giving error "targeting an unmapped class".

Answers


For this case you need collection mapping (@ElementCollection in JPA 2.0 annotations or @CollectionOfElements in Hibernate annotations) rather than relationship mapping (@...To...).

For example, with JPA 2.0 annotations:

@ElementCollection
@CollectionTable(name = "map__company__branches",
    joinColumns = @JoinColumn(name = "company_id"))
@MapKeyJoinColumn(name = "branch_id")
@Column(name = "is_primary_branch")
Map<Branch, Boolean> branchMap; 

Need Your Help

Escaping characters by doubling them in PHP

php escaping quotes

Is there a simple way to escape/unescape an arbitrary character in PHP by doubling it, for example:

Retrieving uploaded Blob info from a regular handler

python google-app-engine blobstore webapp2

I would like to use Google's BlobStore for my GAE app. I want the user to upload an image along with other form data. I know I can just use self.request.get event from within a BlobstoreUploadHan...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.