本文整理了Java中org.hibernate.cfg.Configuration.addAttributeConverter()
方法的一些代码示例,展示了Configuration.addAttributeConverter()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.addAttributeConverter()
方法的具体详情如下:
包路径:org.hibernate.cfg.Configuration
类名称:Configuration
方法名:addAttributeConverter
[英]Adds the AttributeConverter Class to this Configuration.
[中]将AttributeConverter类添加到此配置中。
代码示例来源:origin: hibernate/hibernate-orm
/**
* Adds the AttributeConverter instance to this Configuration. This form is mainly intended for developers
* to programmatically add their own AttributeConverter instance. HEM, instead, uses the
* {@link #addAttributeConverter(Class, boolean)} form
*
* @param attributeConverter The AttributeConverter instance.
*/
public void addAttributeConverter(AttributeConverter attributeConverter) {
addAttributeConverter( AttributeConverterDefinition.from( attributeConverter ) );
}
代码示例来源:origin: hibernate/hibernate-orm
/**
* Adds the AttributeConverter Class to this Configuration.
*
* @param attributeConverterClass The AttributeConverter class.
*/
public void addAttributeConverter(Class<? extends AttributeConverter> attributeConverterClass) {
addAttributeConverter( AttributeConverterDefinition.from( attributeConverterClass ) );
}
代码示例来源:origin: hibernate/hibernate-orm
/**
* Adds the AttributeConverter instance to this Configuration. This form is mainly intended for developers
* to programmatically add their own AttributeConverter instance. HEM, instead, uses the
* {@link #addAttributeConverter(Class, boolean)} form
*
* @param attributeConverter The AttributeConverter instance.
* @param autoApply Should the AttributeConverter be auto applied to property types as specified
* by its "entity attribute" parameterized type?
*/
public void addAttributeConverter(AttributeConverter attributeConverter, boolean autoApply) {
addAttributeConverter( AttributeConverterDefinition.from( attributeConverter, autoApply ) );
}
代码示例来源:origin: hibernate/hibernate-orm
/**
* Adds the AttributeConverter Class to this Configuration.
*
* @param attributeConverterClass The AttributeConverter class.
* @param autoApply Should the AttributeConverter be auto applied to property types as specified
* by its "entity attribute" parameterized type?
*/
public void addAttributeConverter(Class<? extends AttributeConverter> attributeConverterClass, boolean autoApply) {
addAttributeConverter( AttributeConverterDefinition.from( attributeConverterClass, autoApply ) );
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testBasicTimestampUsage() {
Configuration cfg = new Configuration();
cfg.addAttributeConverter( InstantConverter.class, false );
cfg.addAnnotatedClass( IrrelevantInstantEntity.class );
cfg.setProperty( AvailableSettings.HBM2DDL_AUTO, "create-drop" );
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testBasicUsage() {
Configuration cfg = new Configuration();
cfg.addAttributeConverter( IntegerToVarcharConverter.class, false );
cfg.addAnnotatedClass( Tester4.class );
cfg.setProperty( AvailableSettings.HBM2DDL_AUTO, "create-drop" );
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testErrorInstantiatingConverterClass() {
Configuration cfg = new Configuration();
try {
cfg.addAttributeConverter( BlowsUpConverter.class );
fail( "expecting an exception" );
}
catch (AnnotationException e) {
assertTyping( BlewUpException.class, ExceptionUtil.rootCause( e ) );
}
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testChangeImmutableAttribute(){
configuration().addAttributeConverter( ExifConverter.class);
configuration().addAttributeConverter( CaptionConverter.class);
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testImmutableAttribute(){
configuration().addAttributeConverter( ExifConverter.class);
configuration().addAttributeConverter( CaptionConverter.class);
Session s = openSession();
Transaction tx = s.beginTransaction();
代码示例来源:origin: apache/servicemix-bundles
@SuppressWarnings("unchecked")
public static void registerConverter(Configuration config, Class<?> converterClass) {
config.addAttributeConverter((Class<? extends AttributeConverter<?, ?>>) converterClass);
}
}
代码示例来源:origin: org.hibernate.orm/hibernate-core
/**
* Adds the AttributeConverter instance to this Configuration. This form is mainly intended for developers
* to programmatically add their own AttributeConverter instance. HEM, instead, uses the
* {@link #addAttributeConverter(Class, boolean)} form
*
* @param attributeConverter The AttributeConverter instance.
*/
public void addAttributeConverter(AttributeConverter attributeConverter) {
addAttributeConverter( new InstanceBasedConverterDescriptor( attributeConverter, classmateContext ) );
}
代码示例来源:origin: org.hibernate.orm/hibernate-core
/**
* Adds the AttributeConverter instance to this Configuration. This form is mainly intended for developers
* to programmatically add their own AttributeConverter instance. HEM, instead, uses the
* {@link #addAttributeConverter(Class, boolean)} form
*
* @param attributeConverter The AttributeConverter instance.
* @param autoApply Should the AttributeConverter be auto applied to property types as specified
* by its "entity attribute" parameterized type?
*/
public void addAttributeConverter(AttributeConverter attributeConverter, boolean autoApply) {
addAttributeConverter( new InstanceBasedConverterDescriptor( attributeConverter, autoApply, classmateContext ) );
}
代码示例来源:origin: org.hibernate.orm/hibernate-core
/**
* Adds the AttributeConverter Class to this Configuration.
*
* @param converterClass The AttributeConverter class.
*/
public <O,R> void addAttributeConverter(Class<? extends AttributeConverter<O,R>> converterClass) {
addAttributeConverter( new ClassBasedConverterDescriptor( converterClass, classmateContext ) );
}
代码示例来源:origin: org.hibernate.orm/hibernate-core
/**
* Adds the AttributeConverter Class to this Configuration.
*
* @param converterClass The AttributeConverter class.
* @param autoApply Should the AttributeConverter be auto applied to property types as specified
* by its "entity attribute" parameterized type?
*/
public <O,R> void addAttributeConverter(Class<? extends AttributeConverter<O,R>> converterClass, boolean autoApply) {
addAttributeConverter( new ClassBasedConverterDescriptor( converterClass, autoApply, classmateContext ) );
}
内容来源于网络,如有侵权,请联系作者删除!