use of org.hibernate.annotations.ListIndexJdbcType in project hibernate-orm by hibernate.
the class BasicValueBinder method prepareListIndex.
private void prepareListIndex(XProperty listAttribute) {
implicitJavaTypeAccess = typeConfiguration -> Integer.class;
final ManagedBeanRegistry beanRegistry = buildingContext.getBootstrapContext().getServiceRegistry().getService(ManagedBeanRegistry.class);
explicitJavaTypeAccess = (typeConfiguration) -> {
final ListIndexJavaType javaTypeAnn = findAnnotation(listAttribute, ListIndexJavaType.class);
if (javaTypeAnn != null) {
final Class<? extends BasicJavaType<?>> javaType = normalizeJavaType(javaTypeAnn.value());
if (javaType != null) {
final ManagedBean<? extends BasicJavaType<?>> bean = beanRegistry.getBean(javaType);
return bean.getBeanInstance();
}
}
return null;
};
explicitJdbcTypeAccess = (typeConfiguration) -> {
final ListIndexJdbcType jdbcTypeAnn = findAnnotation(listAttribute, ListIndexJdbcType.class);
if (jdbcTypeAnn != null) {
final Class<? extends JdbcType> jdbcType = normalizeJdbcType(jdbcTypeAnn.value());
if (jdbcType != null) {
final ManagedBean<? extends JdbcType> bean = beanRegistry.getBean(jdbcType);
return bean.getBeanInstance();
}
}
final ListIndexJdbcTypeCode jdbcTypeCodeAnn = findAnnotation(listAttribute, ListIndexJdbcTypeCode.class);
if (jdbcTypeCodeAnn != null) {
return typeConfiguration.getJdbcTypeRegistry().getDescriptor(jdbcTypeCodeAnn.value());
}
return null;
};
}
Aggregations