[Hibernate-JIRA] Created: (HHH-6609) Provide a way to supply prebuild ConnectionProvider to Hibernate
by Christoph Läubrich (JIRA)
Provide a way to supply prebuild ConnectionProvider to Hibernate
----------------------------------------------------------------
Key: HHH-6609
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6609
Project: Hibernate Core
Issue Type: Improvement
Components: core
Affects Versions: 3.6.7
Reporter: Christoph Läubrich
Currently it is only possible to provide a ConnectionProvider via the property Environment.CONNECTION_PROVIDER which only accepts a class-name which later is instantiated via ConnectionProviderFactory:
private static ConnectionProvider initializeConnectionProviderFromConfig(String providerClass) {
ConnectionProvider connections;
try {
log.info( "Initializing connection provider: " + providerClass );
connections = (ConnectionProvider) ReflectHelper.classForName( providerClass ).newInstance();
}
catch ( Exception e ) {
log.error( "Could not instantiate connection provider", e );
throw new HibernateException( "Could not instantiate connection provider: " + providerClass );
}
return connections;
}
This aproch is okay for connectionprovider which are very generic and can build up completely by the configuration, but under some circumstances the creation and setup is out of scope of the Provider implementation class.
For this case it would be helpfull to have a configuration property like Environment.CONNECTION_PROVIDER_REFERENCE and a static public Method in the ConnectionProviderFactory like
ConnectionProviderFactory.addConnectionProviderReference(ConnectionProvider provider, String reference)
So it would be possible to make something like this:
ConnectionProvider provider = new MySpecialProvider(x, y, z);
provider.doSpecialSetup(d);
ConnectionProviderFactory.addConnectionProviderReference(provider, "MySpecialProvider");
.
.
.
Configuration configuration = new Configuration();
configuration.setProperty(Environment.CONNECTION_PROVIDER_REFERENCE, "MySpecialProvider");
SessionFactory factory = configuration.buildSessionFactory();
The only alternative to this in current days is to create a ConnectionProvider class which completely relies on static setup methods, making the code relativly complicated and error prone, as well as introducing class not found problems if the provider is not in the same class loader context as hibernate or the module which creates the configuration (for example in OSGi applications).
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 3 months
[Hibernate-JIRA] Created: (HHH-6713) Lazy by context
by Martin Krüger (JIRA)
Lazy by context
---------------
Key: HHH-6713
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6713
Project: Hibernate Core
Issue Type: New Feature
Components: caching (L2)
Reporter: Martin Krüger
Sometimes I want to load references lazy and sometimes not. For example, if I read some object for a table, i need less information, if I look at the details.
A workaround for this, is to implement lightweight entities, or fetch all referenced entities by calling a.getAllB().size() if attribute b were lazy.
Would it be possible to steer lazy during runtime, rather then design time?
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 3 months
[Hibernate-JIRA] Created: (HHH-6712) Bulk Insert/Delete
by Martin Krüger (JIRA)
Bulk Insert/Delete
------------------
Key: HHH-6712
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6712
Project: Hibernate Core
Issue Type: New Feature
Components: core
Affects Versions: 4.0.0.CR4
Reporter: Martin Krüger
Deletion with cascade is done object by object now. When entity A references entity B and one deletes several objects A, then b1 is deleted then a1, b2 then a2, and so on.
It would be more performant if the bulk operation first deletes all b's and then deletes all a's.
This could be done by collecting the id's of the entities and then delete all entries in one table.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 3 months
[Hibernate-JIRA] Created: (HHH-6708) Loading parent/child entities with foreign key in child table being its primary key results in StackOverflowError
by Florian Rampp (JIRA)
Loading parent/child entities with foreign key in child table being its primary key results in StackOverflowError
-----------------------------------------------------------------------------------------------------------------
Key: HHH-6708
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6708
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.6
Environment: HSQL 1.8.0.10 (also reproducible with Oracle 11g, with Oracle JDBC 11.2.0.1.0
Reporter: Florian Rampp
Attachments: bugreports-hibernate-cascadeAll-1.0-SNAPSHOT-src.zip
Consider the following parent/child relationship mapping:
{code:java}
@Entity
public class Parent {
@Id
Long id;
// @OneToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE, CascadeType.REFRESH,
// CascadeType.DETACH }, orphanRemoval = true, mappedBy = "parent")
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "parent")
Child child;
void setChild(Child child) {
this.child = child;
child.setParent(this);
}
}
@Entity
public class Child implements Serializable {
@Id
@OneToOne(optional = false)
private Parent parent;
public void setParent(Parent parent) {
this.parent = parent;
}
}
{code}
When storing a parent with a child and loading it again, the load results in a StackOverflowError. When I replace the cascade type {{ALL}} with a list of all cascade types {{\{CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE, CascadeType.REFRESH, CascadeType.DETACH\}}}, the error does not occur any more.
I attached a test case.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 3 months