Two Laptop Bag*
The moose likes Object Relational Mapping and the fly likes Using a non-pk join column in @Formula annotation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Using a non-pk join column in @Formula annotation" Watch "Using a non-pk join column in @Formula annotation" New topic
Author

Using a non-pk join column in @Formula annotation

Benny Zlo
Greenhorn

Joined: Jan 28, 2012
Posts: 7

Hello,

I am trying to access a join column (the join is performed using @SecondaryTables annotation) in the @Formula annoation.

I have something like this


Now when I look at the query generated by hibernate, I see that he does not use the alias it made for sectable1 to get some_other_column in the @Formula, but it uses the alias it made for primary_table.

How can I fix this? I came across @JoinColumnsOrFormulas I am not really sure if it's relevant to my problem, but regardless I have seen that is available only since 3.5.1, and unfortunately we are using Hibernate 3.2 (don't ask), and upgrading at this time would be quite a problem. So is there any other way?

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using a non-pk join column in @Formula annotation
 
Similar Threads
difference between joinColumn and PrimaryKeyJoinColumni
Content based discrimination with Hibernate annotations
Hibernate generate timestamp on create and update
Hibernate: Problem with @SecondaryTable annotation
Embed on Secondary Table