---
title: "hibernate涂鸦(4)——type"
author: "ratlsun"
date: "2010-11-20T17:16:15Z"
tags: []
categories: ["企业架构"]
slug: "hibernate-4-type"
draft: false
lastmod: "2010-11-20T17:16:15Z"
id: 818076
url: "https://ratlsun.iteye.com/blog/818076"
---

org.hibernate.type.TypeResolver

  -- basicTypeRegistry: 在无参构造函数中被new出来，并在带参构造函数中被赋值

  -- typeFactory: 在无参构造函数中被new出来，并在带参构造函数中被赋值

  -- public Type heuristicType(String) throws MappingException: 调用② heuristicType(typeName, null)

  -- public Type heuristicType(String, Properties) throws MappingException:

1. 调用basic(typeName) 直接得到BasicType的对象，如果存在BacisType对象（在basicTypeRegistry 初始化时就注册好了的类型）就直接return
2. 通过typeName参数得出Class对象，如果Class对象存在，调用typeFactory .byClass(Class对象, Properties参数 ) 得到Hibernate的对象类型（包括Type,CompositeUserType,UserType,Lifecycle,Validatable,Serializable）后return

 

 

org.hibernate.type.BasicTypeRegistry: **@TODO**

 

org.hibernate.type.TypeFactory: **@TODO**