java - Find one record with two conditions instead of one in hibernate -
there 3 tables a,b , c, follows:
a: id ip b: id cid sip dip c: id
in a.java
,i want set <c>, a's ip smaller b's dip , bigger b's sip,and b's id joint c's id. follows:
@jointable(name="a", joincolumns={@joincolumn(name ="sip", referencedcolumnname = "ip"),@joincolumn(name ="dip", referencedcolumnname = "ip")}, inversejoincolumns={@joincolumn(name ="cid")}) @wherejointable(clause="ip::inet between sip::inet , dip::inet")
but didn't work. has happened come against problem before?
you looking joincolumsorformulas
. i'm not sure how table structure is, , trying join, below working example of join joins on (primarykey) @joincolumn
- sku , ids match query in @joinformula
@onetoone @joincolumnsorformulas({ @joincolumnorformula(formula = @joinformula(value = "(select a.id uk_products a.asin != '' , a.product_name != '' , a.seller_sku = sku)", referencedcolumnname = "id")), @joincolumnorformula(column = @joincolumn(name = "sku", referencedcolumnname = "seller_sku", insertable = false, updatable = false)) }) @joincolumn(name = "sku", referencedcolumnname = "seller_sku", insertable = false, updatable = false)
Comments
Post a Comment