当前位置: 首页>>代码示例>>Java>>正文


Java Hibernate5Module类代码示例

本文整理汇总了Java中com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module的典型用法代码示例。如果您正苦于以下问题:Java Hibernate5Module类的具体用法?Java Hibernate5Module怎么用?Java Hibernate5Module使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Hibernate5Module类属于com.fasterxml.jackson.datatype.hibernate5包,在下文中一共展示了Hibernate5Module类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convertParsedEventToOccurrence

import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; //导入依赖的package包/类
private Occurrence convertParsedEventToOccurrence(final ScoredEntry<String> parsedEvent) {
    final ObjectMapper objectMapper = new ObjectMapper();
    objectMapper.registerModule(new Hibernate5Module());
    objectMapper.configure(MapperFeature.DEFAULT_VIEW_INCLUSION, true);

    try {
        final ParsedEventData parsedEventData = objectMapper.readValue(parsedEvent.getValue(), ParsedEventData.class);
        return occurrenceService.parseParsedEventData(parsedEventData);
    } catch (IOException e) {
        logger.info("[EventController] [convertEventCollectionToListOfOccurrences] Failure To Read JSON From Cache", e);
    }
    return null;
}
 
开发者ID:mhaddon,项目名称:Sound.je,代码行数:14,代码来源:EventServiceImpl.java

示例2: toJSON

import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; //导入依赖的package包/类
/**
 * Convert this object to json
 *
 * @return the json
 */
public String toJSON() {
    String returnVar = "";
    final ObjectMapper objectMapper = new ObjectMapper();
    objectMapper.registerModule(new Hibernate5Module());
    objectMapper.configure(MapperFeature.DEFAULT_VIEW_INCLUSION, true);

    try {
        returnVar = objectMapper.writeValueAsString(this);
    } catch (JsonProcessingException ex) {
        logger.info("[DataObject] [toJson] Convert Object To JSON Failure", ex);
    }

    return returnVar;
}
 
开发者ID:mhaddon,项目名称:Sound.je,代码行数:20,代码来源:DataObject.java

示例3: configureObjectMapper

import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; //导入依赖的package包/类
/**
 * Utilisé pour pouvoir mapper correctement les objets Lazy loaded par hibernate
 * @return
 */
@SuppressWarnings("unchecked")
@Bean
public Jackson2ObjectMapperBuilder configureObjectMapper() {
    return new Jackson2ObjectMapperBuilder()
        .modulesToInstall(Hibernate5Module.class);
}
 
开发者ID:mjfcolas,项目名称:infotaf,代码行数:11,代码来源:AppConfig.java

示例4: main

import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    ConfigurableApplicationContext context = SpringApplication.run(SampleDataJpaApplication.class, args);

    Iterable<ObjectMapper> objectMappers = context.getBeansOfType(ObjectMapper.class)
            .values();

    objectMappers.forEach(mapper -> mapper.registerModule(new Hibernate5Module()));

    Squiggly.init(objectMappers, new RequestSquigglyContextProvider() {
        @Override
        public void serializeAsIncludedField(Object pojo, JsonGenerator jgen, SerializerProvider provider, PropertyWriter writer) throws Exception {
            if (isFilteringEnabled()) {
                Object value = writer.getMember().getValue(pojo);

                if (value instanceof PersistentCollection) {
                    ((PersistentCollection) value).forceInitialization();
                }
            }

            super.serializeAsIncludedField(pojo, jgen, provider, writer);
        }
    });


    ObjectMapper objectMapper = Iterables.getFirst(objectMappers, null);

    // Enable Squiggly for Jackson message converter
    if (objectMapper != null) {
        for (MappingJackson2HttpMessageConverter converter : context.getBeansOfType(MappingJackson2HttpMessageConverter.class).values()) {
            converter.setObjectMapper(objectMapper);
        }
    }
}
 
开发者ID:bohnman,项目名称:squiggly-filter-jackson,代码行数:34,代码来源:SampleDataJpaApplication.java

示例5: mappingJackson2HttpMessageConverter

import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; //导入依赖的package包/类
@Bean
public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter() {
	final ObjectMapper objectMapper = new ObjectMapper();
	objectMapper.registerModule(new Hibernate5Module());
	objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

	MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter();
	jsonConverter.setObjectMapper(objectMapper);
	return jsonConverter;
}
 
开发者ID:gustajz,项目名称:parking-api,代码行数:11,代码来源:JpaConfig.java

示例6: jacksonMessageConverter

import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; //导入依赖的package包/类
private MappingJackson2HttpMessageConverter jacksonMessageConverter() {
    final MappingJackson2HttpMessageConverter messageConverter = new MappingJackson2HttpMessageConverter();
    final ObjectMapper mapper = new ObjectMapper();

    //Registering Hibernate5Module to support lazy objects
    mapper.registerModule(new Hibernate5Module());
    messageConverter.setObjectMapper(mapper);
    return messageConverter;

}
 
开发者ID:music-for-all,项目名称:music-for-all-application,代码行数:11,代码来源:WebAppConfig.java

示例7: JacksonInitializer

import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; //导入依赖的package包/类
public JacksonInitializer() {
    mapper = new ObjectMapper()
            .registerModule(new JSR310Module())
            .registerModule(new Hibernate5Module())
            .configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
            .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
}
 
开发者ID:puzzle,项目名称:jee-user-auth,代码行数:8,代码来源:JacksonInitializer.java

示例8: JacksonConfiguration

import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; //导入依赖的package包/类
/**
 * Default constructor, which creates the ObjectMapper and add the custom modules.
 */
public JacksonConfiguration() {
    Hibernate5Module hibernate5Module = new Hibernate5Module();
    hibernate5Module.configure(Hibernate5Module.Feature.USE_TRANSIENT_ANNOTATION, false);

    mapper = new ObjectMapper();
    mapper.registerModule(hibernate5Module);
}
 
开发者ID:LearnLib,项目名称:alex,代码行数:11,代码来源:JacksonConfiguration.java

示例9: initialize

import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; //导入依赖的package包/类
@Override
public final void initialize(Bootstrap<?> bootstrap) {
    Hibernate5Module module = createHibernate5Module();
    configure(module);
    bootstrap.getObjectMapper().registerModule(module);
    initialized = true;
}
 
开发者ID:scottescue,项目名称:dropwizard-entitymanager,代码行数:8,代码来源:EntityManagerBundle.java

示例10: createHibernate5Module

import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; //导入依赖的package包/类
private Hibernate5Module createHibernate5Module() {
    Hibernate5Module module = new Hibernate5Module();
    if (serializeLazyLoadedEntitiesEnabled) {
        module.enable(Hibernate5Module.Feature.FORCE_LAZY_LOADING);
    }
    return module;
}
 
开发者ID:scottescue,项目名称:dropwizard-entitymanager,代码行数:8,代码来源:EntityManagerBundle.java

示例11: addsHibernateSupportToJackson

import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; //导入依赖的package包/类
@Test
public void addsHibernateSupportToJackson() throws Exception {
    final ObjectMapper objectMapperFactory = mock(ObjectMapper.class);

    final Bootstrap<?> bootstrap = mock(Bootstrap.class);
    when(bootstrap.getObjectMapper()).thenReturn(objectMapperFactory);

    bundle.initialize(bootstrap);

    final ArgumentCaptor<Module> captor = ArgumentCaptor.forClass(Module.class);
    verify(objectMapperFactory).registerModule(captor.capture());

    assertThat(captor.getValue()).isInstanceOf(Hibernate5Module.class);
}
 
开发者ID:scottescue,项目名称:dropwizard-entitymanager,代码行数:15,代码来源:EntityManagerBundleTest.java

示例12: createHibernate5Module

import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; //导入依赖的package包/类
/**
 * read more https://github.com/dropwizard/dropwizard/issues/932
 *
 * @return Hibernate4Module
 */

@Override
protected Hibernate5Module createHibernate5Module() {
    Hibernate5Module module = new Hibernate5Module();
    module.disable(Hibernate5Module.Feature.USE_TRANSIENT_ANNOTATION);
    return module;
}
 
开发者ID:robeio,项目名称:robe,代码行数:13,代码来源:RobeHibernateBundle.java

示例13: getHibernate5Module

import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; //导入依赖的package包/类
@Test
@Order(order = 6)
public void getHibernate5Module() {
    Hibernate5Module hibernate5Module = RobeHibernateBundle.getInstance().createHibernate5Module();
    Assert.assertNotNull(hibernate5Module);
    Assert.assertFalse(hibernate5Module.isEnabled(Hibernate5Module.Feature.USE_TRANSIENT_ANNOTATION));
}
 
开发者ID:robeio,项目名称:robe,代码行数:8,代码来源:RobeHibernateBundleTest.java

示例14: createHibernate5Module

import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; //导入依赖的package包/类
@Override
protected Hibernate5Module createHibernate5Module() {
    Hibernate5Module module = super.createHibernate5Module();
    // allow @Transient JPA annotation process by Jackson
    module.disable(Hibernate5Module.Feature.FORCE_LAZY_LOADING);
    module.disable(Hibernate5Module.Feature.USE_TRANSIENT_ANNOTATION);
    return module;
}
 
开发者ID:paukiatwee,项目名称:budgetapp,代码行数:9,代码来源:BudgetApplication.java

示例15: initialize

import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; //导入依赖的package包/类
@Override
public void initialize(Bootstrap<PirateConfiguration> bootstrap) {
    bootstrap.addBundle(hibernateBundle);

    final XmlBundle xmlBundle = new XmlBundle();
    xmlBundle.getXmlMapper()
            .enable(INDENT_OUTPUT)
            .setSerializationInclusion(NON_NULL)
            .registerModule(new Hibernate5Module());
    bootstrap.addBundle(xmlBundle);
}
 
开发者ID:yunspace,项目名称:dropwizard-xml,代码行数:12,代码来源:PirateApplication.java


注:本文中的com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。