[Hibernate-JIRA] Created: (HSHARDS-57) For a better "virtual shards" support!
by Colbert Philippe (JIRA)
For a better "virtual shards" support!
--------------------------------------
Key: HSHARDS-57
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSHARDS-57
Project: Hibernate Shards
Issue Type: Improvement
Affects Versions: 3.0.0.Beta2
Environment: Windows XP
Reporter: Colbert Philippe
Assignee: Max Ross
The current implementation of virtual shards leaves a lot to be desired when used in big corporate applications.
A better way to model shards, is to identify a virtual shard by a pairing of "some name" + "an index" (example: Clients, 11). The name plays a role similar to namespaces. The index is always zero based and valid only within the namespace. There can be many shard namespaces with unique names. A configuration file (possibly XML) will map each virtual shard to a single physical shard. It's a simple mapping strategy. The mapping can allow overlaps of virtual shards into a single physical shard. This type of naming can make things more clear and easier to manage on the long-run.
The big advantage to virtual shards over physical shards is that virtual shards can be easily persisted to file or database and retrieved again and still remain valid. Any change to the shard structure is fully controlled by the shard configuration file, without modifications to the persisted representation of the shard. This way the code can evolve separately from the physical shard architecture.
With this kind of virtual shard, top-of-tree classes will map to a single shard namespace. The object will reside in any of the virtual shard indexes associated with the shard namespace. The resolution strategy becomes very simple because the set of shard indexes will be returned.
--
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
12 years, 5 months
[Hibernate-JIRA] Created: (HHH-3464) SimpleExpression.ignoreCase uses SQL server lowercase function for left part and JAVA lowercase function for right part of expression
by Vitaliy Tymchyshyn (JIRA)
SimpleExpression.ignoreCase uses SQL server lowercase function for left part and JAVA lowercase function for right part of expression
-------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-3464
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3464
Project: Hibernate3
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.2.6
Environment: tried with PostgreSQL
Reporter: Vitaliy Tymchyshyn
Priority: Minor
When using SimpleExpression.ignoreCase (e.g. Restrictions.eq().ignoreCase, hibernate makes 'lower(field)=?' SQL expression, passing lowercased strings to '?' parameter. This may produce unpredictable results depending on Database server lower implementation and current JAVA locale (see JDK javadoc).
For example, I've tried with '\u0130' character as in JDK JavaDoc.
Postgresql produces:
unhappy=> select lower('İ');
lower
-------
i̇
(1 row)
unhappy=> select char_length(lower('İ'));
char_length
-------------
2
(1 row)
While Java with default locale produces single-character 'i̇'. Of course the restriction will not work - it can not find 'İ' in database.
I'd recommend to use 'lower(field)=lower(?)' to use same lower casing function for both parts of expression.
--
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
12 years, 5 months
[Hibernate-JIRA] Created: (JPA-15) Criteria API based on MapKeyColumn is not working
by Edwin Dalorzo (JIRA)
Criteria API based on MapKeyColumn is not working
-------------------------------------------------
Key: JPA-15
URL: http://opensource.atlassian.com/projects/hibernate/browse/JPA-15
Project: Java Persistence API
Issue Type: Bug
Environment: Hibernate 3.6.1
MySQL 5.0
Reporter: Edwin Dalorzo
Attachments: log.txt, src.zip
I defined an Employee entity having a map of phone numbers, where the key is the type of phone (home, office, mobile) and the value is the phone number as a String.
@ElementCollection(fetch=FetchType.LAZY)
@CollectionTable(name="emp_phone")
@MapKeyColumn(name="phone_type")
@Column(name="phone_num")
private Map<String, String> phoneNumbers;
Then I tried to write a Criteria API query using a map join, like this:
CriteriaBuilder builder = entityManager.getCriteriaBuilder();
CriteriaQuery<Employee> criteria = builder.createQuery(Employee.class);
Root<Employee> employeeRoot = criteria.from(Employee.class);
criteria.select(employeeRoot);
MapJoin<Employee, String, String> phoneRoot = employeeRoot.joinMap("phoneNumbers");
criteria.where(builder.equal(phoneRoot.key(), "HOME"));
System.out.println(entityManager.createQuery(criteria).getResultList());
You get an NullPointerException
java.lang.NullPointerException
at org.hibernate.ejb.criteria.path.AbstractPathImpl.prepareAlias(AbstractPathImpl.java:246)
at org.hibernate.ejb.criteria.path.AbstractPathImpl.render(AbstractPathImpl.java:253)
at org.hibernate.ejb.criteria.predicate.ComparisonPredicate.render(ComparisonPredicate.java:173)
at org.hibernate.ejb.criteria.QueryStructure.render(QueryStructure.java:258)
at org.hibernate.ejb.criteria.CriteriaQueryImpl.render(CriteriaQueryImpl.java:340)
at org.hibernate.ejb.criteria.CriteriaQueryCompiler.compile(CriteriaQueryCompiler.java:223)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:441)
at com.dalorzo.Main.main(Main.java:57)
Exception in thread "main" java.lang.RuntimeException: java.lang.NullPointerException
at com.dalorzo.Main.main(Main.java:64)
Caused by: java.lang.NullPointerException
at org.hibernate.ejb.criteria.path.AbstractPathImpl.prepareAlias(AbstractPathImpl.java:246)
at org.hibernate.ejb.criteria.path.AbstractPathImpl.render(AbstractPathImpl.java:253)
at org.hibernate.ejb.criteria.predicate.ComparisonPredicate.render(ComparisonPredicate.java:173)
at org.hibernate.ejb.criteria.QueryStructure.render(QueryStructure.java:258)
at org.hibernate.ejb.criteria.CriteriaQueryImpl.render(CriteriaQueryImpl.java:340)
at org.hibernate.ejb.criteria.CriteriaQueryCompiler.compile(CriteriaQueryCompiler.java:223)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:441)
at com.dalorzo.Main.main(Main.java:57)
If you change the query to filter on value instead of key, it works just fine
criteria.where(builder.equal(phoneRoot.value(), "88750372"));
I have attached a log with exceptions as well as the Employee entity and the Main class containing a main method.
Also, the code in question runs perfectly fine in EclipseLink.
--
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
12 years, 5 months
[Hibernate-JIRA] Created: (HHH-6608) @JoinColumns doesn't work inside an @Embedded member
by Joeri Hendrickx (JIRA)
@JoinColumns doesn't work inside an @Embedded member
----------------------------------------------------
Key: HHH-6608
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6608
Project: Hibernate Core
Issue Type: Bug
Components: annotations, metamodel
Affects Versions: 4.0.0.CR1, 3.5.6
Environment: Version 3.5.6 and up, no DB
Reporter: Joeri Hendrickx
Attachments: hibernate-embedded-joincolumns.zip
If you use multiple joincolumns on a @ManyToOne or @OneToOne field in an @Embedded class, hibernate will fail when building its metamodel with the following exception:
Exception in thread "main" org.hibernate.MappingException: property [_model_MainEntity_embeddedEntity.referencedEntity] not found on entity [model.ReferencedEntity]
at org.hibernate.mapping.PersistentClass.getRecursiveProperty(PersistentClass.java:379)
at org.hibernate.cfg.annotations.TableBinder.bindFk(TableBinder.java:406)
at org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:111)
at org.hibernate.cfg.AnnotationConfiguration.processEndOfQueue(AnnotationConfiguration.java:541)
at org.hibernate.cfg.AnnotationConfiguration.processFkSecondPassInOrder(AnnotationConfiguration.java:523)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:380)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1377)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954)
at model.Test.main(Test.java:12)
Caused by: org.hibernate.MappingException: property [_model_MainEntity_embeddedEntity.referencedEntity] not found on entity [model.ReferencedEntity]
at org.hibernate.mapping.PersistentClass.getRecursiveProperty(PersistentClass.java:425)
at org.hibernate.mapping.PersistentClass.getRecursiveProperty(PersistentClass.java:376)
... 8 more
A test case is included. Just run model. Test with the hibernate libraries in the classpath.
I get the impression this is because of the dot in the generated property name. Hibernate generates a synthetic property, named after the FQN of the owning entity (with dots replaces by underscores) appended by and underscore and the name of the property. But properties inside of embedded objects are represented with a dot; when Hibernate later tries to retrieve the same property, it incorrectly interprets this dot as a delimiter, and will look for `_model_MainEntity_embeddedEntity` (in the example above) instead; which it will not find.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 5 months
[Hibernate-JIRA] Created: (HHH-2808) CLONE -Impossible to define caching for a subclass's collection in hibernate.cgf.xml
by Sebastien Blind (JIRA)
CLONE -Impossible to define caching for a subclass's collection in hibernate.cgf.xml
-------------------------------------------------------------------------------------
Key: HHH-2808
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2808
Project: Hibernate3
Issue Type: Bug
Components: caching (L2)
Affects Versions: 3.2.5
Environment: Hibernate 3.2.5
Sybase
Reporter: Sebastien Blind
Basically, hibernate allows to define <cache usage="transactional"/> inside the subclass mapping, i.e.
<subclass name="SubClass" extends="BaseClass" discriminator-value="xxx">
<bag name="subClassLinks" lazy="false" inverse="true" batch-size="100">
<cache usage="transactional" region="xxx"/>
<key column="xxx" not-null="true"/>
<one-to-many class="xxx"/>
</bag>
<join table="xxx">
</join>
</subclass>
but it's not allowed to do the same using <collection-cache collection="subClass.myCollection" region="xxx" usage="transactional"/>.
It throws:
Exception in thread "main" org.hibernate.MappingException: Cannot cache an unknown collection: subClass.myCollection
at org.hibernate.cfg.Configuration.setCollectionCacheConcurrencyStrategy(Configuration.java:1984)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1568)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1534)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1508)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1428)
--
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
12 years, 5 months
[Hibernate-JIRA] Created: (HHH-6661) Parent-child self-referencing relationship via link table causes QuerySyntaxException:(table) is not mapped when retrieving previous revisions
by Gerard Krupa (JIRA)
Parent-child self-referencing relationship via link table causes QuerySyntaxException:(table) is not mapped when retrieving previous revisions
----------------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-6661
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6661
Project: Hibernate Core
Issue Type: Bug
Components: envers
Affects Versions: 3.6.7
Environment: Hibernate 3.6.7.Final, Oracle 11g DB (also reproduced with Derby 10.8.1.2), Spring 3.0.3
Reporter: Gerard Krupa
Attachments: gjkrupa_envers_problem.zip
We have a parent-child relationship set up for an entity using a plain link table. This is annotated with @JoinTable and @AuditJoinTable so there is no entity for the link table itself. The definition looks something like this...
@Entity
@Table(name = "BKG_BKCM_BKG_CMPT")
@Audited
public class BookingComponent implements Serializable {
@ManyToOne(fetch = FetchType.LAZY, optional = true)
@AuditJoinTable(name = "BKG_BKCMR_REL_AUD", inverseJoinColumns = { @JoinColumn(name = "BKCM_ID_PARENT", nullable = true, updatable = false) })
@JoinTable(name = "BKG_BKCMR_REL", joinColumns = { @JoinColumn(name = "BKCM_ID_CHILD", nullable = true, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "BKCM_ID_PARENT", nullable = true, updatable = false) })
private BookingComponent parent;
@OneToMany(mappedBy = "parent")
private List<BookingComponent> children;
}
We've found two issues. Firstly, when we try to retrieve a previous revision of these entities (they in turn are held in a collection in a container entity) using List<>.size() Envers seems to be constructing a JPQL query using the link table's table name which isn't valid JPQL resulting in the following exception:
org.hibernate.hql.ast.QuerySyntaxException: BKG_BKCMR_REL_AUD is not mapped [select new list(ee, e) from BKG_BKCMR_REL_AUD ee, *package-name-omitted*.BookingComponent_AUD e where ee.originalId.BookingComponent_id = e.originalId.id and ee.originalId.children_id = :children_id and e.originalId.rev_id.id <= :revision and ee.originalId.rev_id.id <= :revision and ee.rev_type != :delrevisiontype and e.rev_type != :delrevisiontype and (e.REV_ID_END.id > :revision or e.REV_ID_END is null) and (ee.REV_ID_END.id > :revision or ee.REV_ID_END is null)]
at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:180)
at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:111)
at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:93)
at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:327)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3441)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3325)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:733)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:584)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:301)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:244)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:254)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1770)
at org.hibernate.envers.entities.mapper.relation.query.TwoEntityQueryGenerator.getQuery(TwoEntityQueryGenerator.java:128)
at org.hibernate.envers.entities.mapper.relation.lazy.initializor.AbstractCollectionInitializor.initialize(AbstractCollectionInitializor.java:62)
at org.hibernate.envers.entities.mapper.relation.lazy.proxy.CollectionProxy.checkInit(CollectionProxy.java:50)
at org.hibernate.envers.entities.mapper.relation.lazy.proxy.CollectionProxy.size(CollectionProxy.java:55)
We've also noticed that the audit entries for the link table have a null REV_ID_END despite there being multiple revisions.
See attached gjkrupa_envers_problem.zip for a test case that demonstrates this issue.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 5 months