[Hibernate-JIRA] Created: (HHH-2578) redesign SessionFactory building
by Steve Ebersole (JIRA)
redesign SessionFactory building
--------------------------------
Key: HHH-2578
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2578
Project: Hibernate3
Issue Type: Improvement
Components: core
Reporter: Steve Ebersole
Assignee: Steve Ebersole
Priority: Critical
Fix For: cfg-rework
Currently a SessionFactory is built by throwing a bunch of stuff into a Configuration object, stirring it, letting it come to a boil, and then pulling out the SessionFactory. In seriousness, there are a few problems with the way we currently operate within a Configuration and how we use it to build a SessionFactory:
The general issue that there is no "lifecycle" to when various pieces of information will be available. This is an important omission in a number of ways:
1) consider schema generation. currently we cannot even know the dialect when a lot of db object names are being determined. this would be nice because it would allow us to transparently handle table/column names which are also keywords/reserved-words in the dialect, for example.
2) static-ness of types and the type-mappings. Because we currently have nothing to which to scope them. Ideally a type instance would be aware of the SessionFactory to which it is bound. Instead, what we have now is to change API methods quite a lot of the time to add in the SessionFactory as a passed parameter whenever it is discovered that it is needed.
3) also, most (all?) of the "static" configuration parameters in Hibernate are currently required to be so because of their use from within these static types; thus scoping types would allow us to also scope those config parameters (things like bytecode-provider, use of binary streams, etc).
Ideally what I see happening is a scheme where users build a org.hibernate.cfg.Settings (or something similiar) instance themselves. Additionally they would apply metadata to a registry of some sort (lets call it MetadataRegistry for now). Then in order to build a SessionFactory, they would supply these two pieces of information (via ctor? via builder?). The important aspect though is that the information in MetadataRegistry would not be dealt with until that point in time, which would allow us to guarentee that resolving schema object names, types, etc would have access to the runtime Settings (and specifically the dialect)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 7 months
[Hibernate-JIRA] Created: (HHH-6180) @OrderColumn works but <order-column> does not (if used inside an <element-collection>)
by Markus Müller (JIRA)
@OrderColumn works but <order-column> does not (if used inside an <element-collection>)
------------------------------------------------------------------------------------------
Key: HHH-6180
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6180
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.6.0
Environment: We have tested this problem with the following ivy.xml configuration: <dependency org="org.hibernate" name="hibernate-entitymanager" rev="3.6.0.Final"/>
We have tested with an H2 Database: <dependency org="com.h2database" name="h2" rev="1.2.143" />
Reporter: Markus Müller
Priority: Minor
We use the following entity-mapping
{code:xml}
<entity name="EX_Person" class="mapping.embedded.xml.EX_Person" access="FIELD">
<attributes>
<id name="id"> <generated-value strategy="TABLE"/> </id>
<element-collection name="hobbies" >
<order-column name="hobbies_ORDER"/>
</element-collection>
</attributes>
</entity>
{code}
with this implementing class:
{code:title=EX_Person.java|borderStyle=solid}
package mapping.embedded.xml;
import java.util.LinkedList;
import java.util.List;
import javax.persistence.OrderColumn;
public class EX_Person {
public EX_Person() { this(0); }
public EX_Person(int persNo) {
this.persNo = persNo;
hobbies = new LinkedList<String>();
hobbies.add("swimming");
hobbies.add("fishing");
}
long id;
int persNo;
// @OrderColumn
List<String> hobbies;
}
{code}
Our problem is that the order column "hobbies_ORDER" of table "EX_Person_hobbies" is not created on startup.
We use hibernate.hbm2ddl.auto=create to create all tables at startup.
As soon as we uncomment the annotation @OrderColumn all is working fine,
the table "EX_Person_hobbies" gets the column "hobbies_ORDER" to store the index of the hobbies in the list.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 7 months