[Hibernate-JIRA] Created: (HHH-5829) Incorrect sequence handling when Derby Client Driver is used.
by Juraj Burian (JIRA)
Incorrect sequence handling when Derby Client Driver is used.
-------------------------------------------------------------
Key: HHH-5829
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5829
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.0
Environment: any os, Derby: ClientDriver
Reporter: Juraj Burian
Problem is in Derby Dialect version checking.
Pls. see: https://issues.apache.org/jira/browse/DERBY-4961
Briefly:
incorrect usage of class: org.apache.derby.tools.sysinfo for retrieving of version info.
In my opinion, the best way is to skip version check in method:
@Override
public String getSequenceNextValString(String sequenceName) {
if ( supportsSequences() ) {
return "values next value for " + sequenceName;
}
else {
throw new MappingException( "Derby does not support sequence prior to release 10.6.1.0" );
}
}
better solution may be hard, because live connection is necessary (see 1) bellow), or two calls for get...Version() method, (see 2):
(comment from DERBY-4961)
The supported ways to get the version of the client driver are:
1) Use the getDriverMajorVersion() and getDriverMinorVersion() methods in java.sql.DatabaseMetaData.
2) Call the variants of sysinfo.getMajorVersion() and sysinfo.getMinorVersion() that take a String argument. The argument should be the value found in the constant sysinfo.CLIENT.
--
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
14 years, 2 months
[Hibernate-JIRA] Created: (HV-384) Performence problem when using programatic constrain declaration
by Jan Cuzy (JIRA)
Performence problem when using programatic constrain declaration
----------------------------------------------------------------
Key: HV-384
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-384
Project: Hibernate Validator
Issue Type: Bug
Affects Versions: 4.1.0.Final
Environment: Java 1.6, OSGi Equinox
Reporter: Jan Cuzy
Assignee: Hardy Ferentschik
I'm using the programmatic API to declare the constrains on class.
{noformat} ConstraintMapping constraintMapping = ...
HibernateValidatorConfiguration config = ...
config.addMapping(constraintMapping);
ValidatorFactory factory = config.buildValidatorFactory();{noformat}
Right now I have 73 with 745 configured constrains on them (This is rather beginning of the project, in the future numbers will be higher). It takes approx. 6 seconds to create the validator factory. I was investigating a bit and found a method initProgrammaticConfiguration in ValidatorFactoryImpl class, which calls vary often the method getConstraintConfig() on the ConstraintMapping class.
This method creates always new
{noformat}<A extends Annotation> Map<Class<?>, List<ConstraintDefWrapper<?>>>{noformat}
based on values in its member variable
{noformat} private final Map<Class<?>, List<ConstraintDef<?>>> constraintConfig{noformat}
Is there any problem to cache the created map as a meber in the ConstraintMapping class?
I've done
{noformat}
public class ConstraintMapping {
private final Map<Class<?>, List<ConstraintDef<?>>> constraintConfig;
private Map<Class<?>, List<ConstraintDefWrapper<?>>> newDefinitions;
...
{noformat}
then
{noformat} public final <A extends Annotation> Map<Class<?>, List<ConstraintDefWrapper<?>>> getConstraintConfig() {
*if (newDefinitions == null) {*
*newDefinitions = new HashMap<Class<?>, List<ConstraintDefWrapper<?>>>();*
for (Map.Entry<Class<?>, List<ConstraintDef<?>>> entry : constraintConfig.entrySet()) {
List<ConstraintDefWrapper<?>> newList = new ArrayList<ConstraintDefWrapper<?>>();
for (ConstraintDef<?> definition : entry.getValue()) {
Class<?> beanClass = definition.beanType;
@SuppressWarnings("unchecked")
ConstraintDefWrapper<A> defAccessor = new ConstraintDefWrapper<A>(beanClass,
(Class<A>) definition.constraintType, definition.property, definition.elementType,
definition.parameters, this);
newList.add(defAccessor);
}
newDefinitions.put(entry.getKey(), newList);
}
*}*
return newDefinitions;
}{noformat}
and then maybe also
{noformat} protected final void addConstraintConfig(ConstraintDef<?> definition) {
Class<?> beanClass = definition.beanType;
configuredClasses.add(beanClass);
if (constraintConfig.containsKey(beanClass)) {
constraintConfig.get(beanClass).add(definition);
}
else {
List<ConstraintDef<?>> definitionList = new ArrayList<ConstraintDef<?>>();
definitionList.add(definition);
constraintConfig.put(beanClass, definitionList);
*newDefinitions = null;*
}
}
{noformat}
and the time which is needed to create the factory is 200ms.
--
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
14 years, 2 months
[Hibernate-JIRA] Created: (ANN-747) @CollectionOfElements does not cascade on delete
by Nicole Rauch (JIRA)
@CollectionOfElements does not cascade on delete
------------------------------------------------
Key: ANN-747
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-747
Project: Hibernate Annotations
Issue Type: Bug
Affects Versions: 3.3.1.GA
Environment: Hibernate 3.2.6 GA
Database: H2 1.0.72
Reporter: Nicole Rauch
Consider the following constellation:
@Embeddable
public class Foo {
// ...
}
@Entity
public class Bar {
@CollectionOfElements
private Set<Foo> myFoos;
// ...
}
When I persist a Bar object that contains some Foos, and when I later decide to delete the Bar object, I get a foreign key constraint violation error message because the Foo objects, which contain a reference to the Bar object that owns them, are not deleted automatically. I would expect the default behaviour to be "on delete cascade" because the Foo objects are embeddables, thus they cannot exist on their own without the Bar object that owns them. But there is no way to tell Hibernate to cascade:
- the @OnDelete annotation is only allowed for OneToMany relations
- the @Cascade annotation is being ignored
- there is no "cascade" property for the CollectionOfElements
So my question is: Why does the cascading not occur automatically, and how do I tell Hibernate to cascade anyways?
Thanks a lot in advance,
Nicole
--
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
14 years, 2 months
[Hibernate-JIRA] Created: (HHH-5828) Referenced column of an embedded component is not recognized by @JoinColumnOrFormula
by Kyrill Alyoshin (JIRA)
Referenced column of an embedded component is not recognized by @JoinColumnOrFormula
------------------------------------------------------------------------------------
Key: HHH-5828
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5828
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.0
Environment: Hibernate 3.6.0
Reporter: Kyrill Alyoshin
Whenever @JoinColumnOrFormula is referencing a column of an embedded component like this:
{code}
@JoinColumnsOrFormulas({
@JoinColumnOrFormula(formula = @JoinFormula(value = "to_char(pm_company_id)", referencedColumnName = "ext_vendor_source_id"))
})
{code}
where 'ext_vendor_source_id' is mapped to an @Embeddable component, Hibernate fails at startup with the following exception:
{code}
Caused by: org.hibernate.AnnotationException: referencedColumnNames(ext_vendor_source_id) of xxx.core.domain.entity.main.Vendor.pmCompany referencing xxx.core.domain.entity.main.RawVendorInfo not mapped to a single property
at org.hibernate.cfg.BinderHelper.createSyntheticPropertyReference(BinderHelper.java:204)
at org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:114)
at org.hibernate.cfg.Configuration.processEndOfQueue(Configuration.java:1550)
at org.hibernate.cfg.Configuration.processFkSecondPassInOrder(Configuration.java:1473)
{code}
--
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
14 years, 2 months
[Hibernate-JIRA] Created: (HHH-5827) Cascade persist does not observe correct order and fails
by Ralf Pöhlmann (JIRA)
Cascade persist does not observe correct order and fails
--------------------------------------------------------
Key: HHH-5827
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5827
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.6
Reporter: Ralf Pöhlmann
Priority: Blocker
Persisting an entity fails sometimes with CascadeType.PERSIST option. This is the case when the order of persisting entities is important. Example:
Container
|
-- Element -----------------|
| Association
-- Opposite Element --------|
Persisting Container should persists in the given order:
1. Element
2. Opposite Element
3. Association (depends on element an opposite)
Testing this scenario with Hibernate sometimes works and sometimes fails. Same code works fine with EclipseLink as JPA provider.
In order to reproduce the problem create three entities: Container, Element, Association.
Test Case:
final Container container = new Container();
final Element element = new Element();
container.addElement(element);
final Opposite opposite = new Element();
container.addElement(opposite);
final Association association = new Association(element, opposite);
em.persist(container);
@Entity
public class Container {
...
@OneToMany(mappedBy = "container", cascade = { CascadeType.PERSIST, CascadeType.REMOVE })
private Collection<Element> elements = new HashSet<Element>();
...
}
@Entity
public class Element {
...
@ManyToOne(optional = false)
@JoinColumn(name = "container_id", referencedColumnName = "id")
private Container container;
@OneToMany(mappedBy = "element", cascade = { CascadeType.PERSIST, CascadeType.REMOVE })
private Collection<Association> outgoing = new HashSet<Association>();
@OneToMany(mappedBy = "opposite", cascade = { CascadeType.REMOVE })
private Collection<Association> incoming = new HashSet<Association>();
...
}
@Entity
public class Association {
...
public Association(final Element element, final Element opposite) {
this.element = element;
this.opposite = opposite;
element.addOutgoingAssociation(this);
opposite.addIncomingAssociation(this);
}
@ManyToOne(optional = false)
@JoinColumn(name = "element_id", referencedColumnName = "id")
private Element element;
@ManyToOne(optional = false)
@JoinColumn(name = "opposite_id", referencedColumnName = "id", unique = false)
private Element opposite;
...
}
--
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
14 years, 2 months