[Hibernate-JIRA] Created: (HHH-6690) SettingsFactory hides SQLException
by Lionel van den Berg (JIRA)
SettingsFactory hides SQLException
----------------------------------
Key: HHH-6690
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6690
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.6.7
Environment: All
Reporter: Lionel van den Berg
When a SessionFactory is created using the Configuration.buildSessionFactory() method a failed connection attempt due to invalid user credentials, an invalid password or some other similar cause fails silently as the SQLException thrown by the ConnectionProvider is caught at line 104 of SettingsFactory, logged and no further information is provided to the calling class.
This makes it impossible for an application to determine what went wrong and to provide feedback in a user-driven environment.
--
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-6686) JPQL operator "is empty" failes for @ElementCollection
by Dirk weil (JIRA)
JPQL operator "is empty" failes for @ElementCollection
------------------------------------------------------
Key: HHH-6686
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6686
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager
Affects Versions: 4.0.0.CR3
Environment: hibernate-entitymanager:4.0.0.CR3, mysql-connector-java:5.0.5
Reporter: Dirk weil
Attachments: Employee.java, QueryTester.java
The JPQL "select e from Employee e where e.skills is not empty" failes with the exception
Exception in thread "main" java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected end of subtree [select e from de.gedoplan.buch.eedemos.entity.Employee e where e.skills is not empty ]
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1334)
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1280)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:283)
at de.gedoplan.buch.eedemos.entity.QueryTester.main(QueryTester.java:19)
Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected end of subtree [select e from de.gedoplan.buch.eedemos.entity.Employee e where e.skills is not empty ]
at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:53)
at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:46)
at org.hibernate.hql.internal.ast.ErrorCounter.throwQueryException(ErrorCounter.java:79)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.generate(QueryTranslatorImpl.java:238)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:203)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:120)
at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:214)
at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:192)
at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1538)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:280)
... 1 more
The attribute skills used in the where clause is a simple @ElementCollection List<String>.
Attached files are the entity class (Employee.java) and a short main programm for executing JPQL (QueryTester.java).
--
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: (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: (HHH-6685) AutoFlush crashes because of erroneous debug statement
by Alexandre Gattiker (JIRA)
AutoFlush crashes because of erroneous debug statement
------------------------------------------------------
Key: HHH-6685
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6685
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 4.0.0.CR3
Reporter: Alexandre Gattiker
java.util.UnknownFormatConversionException: Conversion = '-'
at java.util.Formatter.checkText(Formatter.java:2503)
at java.util.Formatter.parse(Formatter.java:2485)
at java.util.Formatter.format(Formatter.java:2414)
at java.util.Formatter.format(Formatter.java:2367)
at java.lang.String.format(String.java:2769)
at org.jboss.logging.Slf4jLocationAwareLogger.doLogf(Slf4jLocationAwareLogger.java:85)
at org.jboss.logging.Logger.debugf(Logger.java:554)
at org.hibernate.internal.CoreMessageLogger_$logger.debugf(CoreMessageLogger_$logger.java:3784)
at org.hibernate.internal.util.EntityPrinter.toString(EntityPrinter.java:118)
at org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:128)
at org.hibernate.event.internal.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:55)
at org.hibernate.internal.SessionImpl.autoFlushIfRequired(SessionImpl.java:1057)
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1109)
at org.hibernate.internal.QueryImpl.list(QueryImpl.java:100)
at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:280)
at org.hibernate.ejb.criteria.CriteriaQueryCompiler$3.getSingleResult(CriteriaQueryCompiler.java:264)
Cause:
org.hibernate.internal.util.EntityPrinter.toString(Iterator) calls LOG.debugf( toString( iterator.next() ) );
should be LOG.debug( toString( iterator.next() ) );
To reproduce, use an entity for which toString contains the substring "%-".
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 3 months