[Hibernate-JIRA] Created: (HV-345) Run automated diff between project model constraints and database model constraints
by Roman Arkadijovych Muntyanu (JIRA)
Run automated diff between project model constraints and database model constraints
-----------------------------------------------------------------------------------
Key: HV-345
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-345
Project: Hibernate Validator
Issue Type: New Feature
Components: engine
Affects Versions: 4.2.0
Reporter: Roman Arkadijovych Muntyanu
Assignee: Hardy Ferentschik
[This feature request has been added to this project due to relation to Java-level constraint validation. Please feel free moving it to appropriate project]
Since constraints validation is added at Java model level, it would be interesting to write a tool, that would do the following during application start-up:
* poll the database for schema;
* poll hibernate for XML/JPA Mappings;
* compare two of the above to constraints defined through validation framework and generate warnings in the logs.
For the initial version this could be simple checks like size of field defined in DB and in the model, field mandatority etc.
This would help a lot in keeping consistency between database and business constraints model.
--
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, 3 months
[Hibernate-JIRA] Created: (HHH-5832) JPA Query and IdClass Causing NullPointerException
by Erich Heard (JIRA)
JPA Query and IdClass Causing NullPointerException
--------------------------------------------------
Key: HHH-5832
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5832
Project: Hibernate Core
Issue Type: Bug
Components: metamodel
Affects Versions: 3.5.1
Environment: Hibernate version 3.5.1 and Oracle 10g.
Reporter: Erich Heard
We had an issue when building queries dynamically with JPA objects when we accessed an @Id property of an entity class that used @IdClass. Under these conditions, Path.get( ) would return null. Here is a short illustration:
The entity was specified like:
@Entity
// snipped more annotations
@IdClass( RetailerId.class )
public class Retailer {
@Id
private String retailerId;
public String getRetailerId( ) { return this.retailerId; }
public void setRetailerId( String value ) { this.retailerId = value; }
@Id
private String divisionCode;
public String getDivisionCode( ) { return this.divisionCode; }
public void setDivisionCode( String value ) { this.divisionCode = value; }
// snipped other attributes
}
And the ID class was specified like:
@Embeddable
public class RetailerId implements Serializable {
private static final long serialVersionUID = -2639451633891197777L;
@Column( name = "RETLR_ID", nullable = false, length = 7 )
private String retailerId;
public String getRetailerId( ) { return this.retailerId; }
public void setRetailerId( String value ) { this.retailerId = value; }
@Column( name = "DIV_CDE", nullable = false, length = 2 )
private String divisionCode;
public String getDivisionCode( ) { return this.divisionCode; }
public void setDivisionCode( String value ) { this.divisionCode = value; }
// snipped implementations of Serializable methods
}
The code that caused the error condition:
CriteriaQuery<RetailerConfigurationPreference> query = cb.createQuery(RetailerConfigurationPreference.class);
Root<RetailerConfigurationPreference> root = query.from(RetailerConfigurationPreference.class);
Predicate predicate = root.get("retailer").get("retailerId").in(retailerIds);
In this case, the 'get("retailerId")' would return null. To get around this issue, I altered the class org.hibernate.ejb.metamodel.AbstractIdentifiableType and overrode its super method getAttribute() to check the ID class for the attribute before deferring to its superclass.
@Override
public Attribute<? super X, ?> getAttribute(String name) {
if( this.idClassAttributes != null ) {
Attribute<? super X, ?> attribute = null;
Iterator<SingularAttribute<? super X, ?>> i = this.idClassAttributes.iterator( );
while( i.hasNext( ) ) {
attribute = i.next( );
if( attribute.getName( ).equals( name ) ) return attribute;
}
}
return super.getAttribute( name );
}
I didn't test this with EmbeddedId - that may work as is or it may need a case of its own. This is the first time I've submitted anything here, so I apologize if it is not to form.
--
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, 3 months
[Hibernate-JIRA] Created: (BVAL-224) Provide a way for accessing default implementations for XML configured bootstrap artifacts
by Gunnar Morling (JIRA)
Provide a way for accessing default implementations for XML configured bootstrap artifacts
------------------------------------------------------------------------------------------
Key: BVAL-224
URL: http://opensource.atlassian.com/projects/hibernate/browse/BVAL-224
Project: Bean Validation
Issue Type: New Feature
Components: spec-general
Reporter: Gunnar Morling
Using {{validation.xml}} one can specify custom implementations for constraint validator factory, message interpolator etc. Right now there is no way to delegate from within these custom implementations to the default ones. This would be possible when using the configuration API:
{code}
HibernateValidatorConfiguration configuration = Validation.byProvider(HibernateValidator.class).configure();
ConstraintValidatorFactory defaultFactory = configuration.getDefaultConstraintValidatorFactory();
ConstraintValidatorFactory customFactory = new CustomConstraintValidatorFactory(defaultFactory);
configuration.constraintValidatorFactory(customFactory);
{code}
One idea to allow for such a delegation is to support constructors taking the default implementation as parameter:
{code}
CustomConstraintValidatorFactory implements ConstraintValidatorFactory {
ConstraintValidatorFactory delegate;
CustomConstraintValidatorFactory(ConstraintValidatorFactory defaultFactory) {
this.delegate = defaultFactory;
}
}
{code}
For XML-configured artifacts the runtime could invoke this delegate constructor if existent, otherwise the default constructor could be invoked.
--
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, 3 months
[Hibernate-JIRA] Created: (EJB-276) Support for CLOB not working for DB2 when table per concrete class is being used
by breako (JIRA)
Support for CLOB not working for DB2 when table per concrete class is being used
--------------------------------------------------------------------------------
Key: EJB-276
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-276
Project: Hibernate Entity Manager
Type: Bug
Versions: 3.2.1
Reporter: breako
Hi,
This came up in the forums:
http://forum.hibernate.org/viewtopic.php?p=2344008#2344008
Sample code: Two Pojos
@Entity
public class Person {
private int i;
@Identity
public int getI() {
return i;
}
public void setI(int i){
this.i = i;
}
}
@Entity
public class Employee extends Person{
@Basic(fetch=FetchType.LAZY)
@Lob
public String getClobAttr() {
return clobAttr;
}
public void setClobAttr(String clobAttr) {
this.clobAttr = clobAttr;
}
}
Simple test:
public static void main (String args[]) {
Query queryImpl = em.createQuery(" from Person");
List list = queryImpl.getResultList();
}
This will generate SQL
select person0_.clobAttr as clobAttr1 from (select nullif(0,0) as clobAttr from TPerson union all select clobAttr from TEmployee) person0_
which chucks the exception:
DB2 SQL error: SQLCODE: -415, SQLSTATE: 42825, SQLERRMC: null
I think the SQL hibernate should generate should be:
select person0_.clobAttr as clobAttr1 from (select cast(null as CLOB) as clobAttr from TPerson union all select clobAttr from TEmployee) person0_
--
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, 3 months