[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-6938) Clarify the use of getHibernateConfiguration and Configuration handling with JPA bootstrap

Steve Ebersole (JIRA) noreply at atlassian.com
Thu Jan 5 09:22:14 EST 2012


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-6938?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44953#comment-44953 ] 

Steve Ebersole commented on HHH-6938:
-------------------------------------

Not really following the purpose of this ticket.  Is there some coding actually to be done?

If you are just looking for an explanation, see below.  However, JIRA is not the place to ask user questions.  Do that on the forums or on irc.  I answered this time because it is your first offense :)

The reason we say read-only is a matter of timing.  Once the underlying {{SessionFactory}} is built, changes made to that {{Configuration}} have no effect.  Also, in general we do not suggest applications using this {{org.hibernate.ejb.Ejb3Configuration}} class at all.  JPA defines a bootstrapping mechanism for both JSE and JEE uses.  We are planning a better approach to allow configuration stuff like you mentioned to happen in conjunction with those standard bootstrapping methods.  But thats still being planned.  A likely approach is through {{org.hibernate.integrator.spi.Integrator}}.  Again, you have a vested interest here, so maybe join the planning discussions for that.

> Clarify the use of getHibernateConfiguration and Configuration handling with JPA bootstrap
> ------------------------------------------------------------------------------------------
>
>                 Key: HHH-6938
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6938
>             Project: Hibernate Core
>          Issue Type: Task
>    Affects Versions: 3.6.5
>            Reporter: Stephane Nicoll
>
> Hi,
> I am willing to register custom types automatically when our application starts. We are using JPA2 and the EntityManager.
> To do so I can use a method on the Configuration object (registerTypeOverride). When configuring the JPA container, the PersistenceProvider can be extended. That's what I am doing but I came to this code (Ejb3Configuration on 3.6.5)
> {code:java}
>        /**
> 	 * This API is intended to give a read-only configuration.
> 	 * It is sueful when working with SchemaExport or any Configuration based
> 	 * tool.
> 	 * DO NOT update configuration through it.
> 	 */
> 	public AnnotationConfiguration getHibernateConfiguration() {
> 		//TODO make it really read only (maybe through proxying)
> 		return cfg;
> 	}
> {code}
> I believe there is a TODO here that may lead to a change that would disallow me to use the configuration object to register new types on startup. If this TODO gets ever resolved (why?), what could I do to register new types? 
> Thanks

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list