/** * Read mappings from a <tt>URL</tt> * * @param url The url for the mapping document to be read. * @return this (for method chaining purposes) * @throws MappingException Indicates problems reading the URL or processing * the mapping document. */ public Configuration addURL(URL url) throws MappingException { metadataSources.addURL( url ); return this; }
@Test @TestForIssue(jiraKey = "HHH-8462") public void testBasicOrmXmlConverterApplication() { final StandardServiceRegistry ssr = new StandardServiceRegistryBuilder().build(); try { MetadataImplementor metadata = (MetadataImplementor) new MetadataSources( ssr ) .addAnnotatedClass( Tester.class ) .addURL( ConfigHelper.findAsResource( "org/hibernate/test/converter/orm.xml" ) ) .getMetadataBuilder() .build(); PersistentClass tester = metadata.getEntityBinding( Tester.class.getName() ); Property nameProp = tester.getProperty( "name" ); SimpleValue nameValue = (SimpleValue) nameProp.getValue(); Type type = nameValue.getType(); assertNotNull( type ); if ( !AttributeConverterTypeAdapter.class.isInstance( type ) ) { fail( "AttributeConverter not applied" ); } AttributeConverterTypeAdapter basicType = assertTyping( AttributeConverterTypeAdapter.class, type ); assertSame( StringTypeDescriptor.INSTANCE, basicType.getJavaTypeDescriptor() ); assertEquals( Types.CLOB, basicType.getSqlTypeDescriptor().getSqlType() ); } finally { StandardServiceRegistryBuilder.destroy( ssr ); } }
/** * Read mappings from a <tt>URL</tt> * * @param url The url for the mapping document to be read. * @return this (for method chaining purposes) * @throws MappingException Indicates problems reading the URL or processing * the mapping document. */ public Configuration addURL(URL url) throws MappingException { metadataSources.addURL( url ); return this; }
URL url = resources[i].getURL(); LOG.info("Adding resource " + url); sources.addURL(url);