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

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -