我正在使用jpa和hibernate。有两个类:
SRTP_KEY_LEN = 16
SRTP_SALT_LEN = 14
def get_srtp_key_salt(src, idx):
key_start = idx * SRTP_KEY_LEN
salt_start = 2 * SRTP_KEY_LEN + idx * SRTP_SALT_LEN
return (
src[key_start:key_start + SRTP_KEY_LEN] +
src[salt_start:salt_start + SRTP_SALT_LEN]
)
material = connection.export_keying_material(
b'EXTRACTOR-dtls_srtp',
2 * (SRTP_KEY_LEN + SRTP_SALT_LEN))
if is_server:
srtp_tx_key = get_srtp_key_salt(material, 1)
srtp_rx_key = get_srtp_key_salt(material, 0)
else:
srtp_tx_key = get_srtp_key_salt(material, 0)
srtp_rx_key = get_srtp_key_salt(material, 1)
当我尝试进行查询时,我得到一个例外。这是我的疑问:
@Entity(name = "constant")
@Table(name = "CONSTANT")
public class Constant extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.AUTO, generator = "CONSTANT_SEQ")
private Long constantID;
private String title;
}
@Entity(name = "constantValue")
@Table(name = "CONSTANT_VALUE")
public class ConstantValue extends BaseEntity {
@Id
@SequenceGenerator(sequenceName = "CONSTANT_VALUE_SEQ", name = "CONSTANT_VALUE_SEQ", allocationSize = 1, initialValue = 1)
@GeneratedValue(strategy = GenerationType.AUTO, generator = "CONSTANT_VALUE_SEQ")
private Long constantValueID;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "CONSTANT_ID")
private Constant constant;
}
如何在查询中使用o.constant.title?
这是例外:
select o from constantValue o where o.constant.constantID=4 and (upper(o.constant.title) like upper(:constant.title) )