[Hibernate-JIRA] Created: (HCANN-22) Problem with @ElementCollection or @CollectionTable in core/annotations 3.5.1 creating bogus unique key
by Lynn Keeling (JIRA)
Problem with @ElementCollection or @CollectionTable in core/annotations 3.5.1 creating bogus unique key
-------------------------------------------------------------------------------------------------------
Key: HCANN-22
URL: http://opensource.atlassian.com/projects/hibernate/browse/HCANN-22
Project: Hibernate Commons Annotations
Issue Type: Bug
Environment: Hibernate Core/Annotions 3.5.1-Final
MySQL 5.1
Reporter: Lynn Keeling
I've encountered a problem that may be a hibernate collection bug. Using the code listed below, I'm creating a collection table that has two columns: TERRITORY_ID and characters_CHARACTER_ID. When hibernate creates the table, it creates the following indexes:
1. An compound unique index on TERRITORY_ID and characters_CHARACTER_ID, which is expected.
2. A non-unique on both TERRITORY_ID and characters_CHARACTER_ID, which is expected.
3. A unique index on characters_CHARACTER_ID, WHICH IS THE PROBLEM I"M REPORTING..
Why is the unique index on characters_CHARACTER_ID being created? If I manually drop the index, my code works fine. Otherwise, I get a unique constraint violation when I try to insert more than one of the same character id into the table. Not the desired behavior.
public class Territory implements Serializable {
private static final long serialVersionUID = -8906914598601073008L;
@Id
@Column(name = "TERRITORY_ID", length = 50)
private String territoryId;
@ElementCollection(fetch = FetchType.LAZY)
@CollectionTable(name="TERRITORY_CHARACTER", joinColumns=@JoinColumn(name="TERRITORY_ID"))
@Column(name="CHARACTER_ID")
private Set<Character> characters;
...
}
public class Character implements Serializable {
private static final long serialVersionUID = 845127746329423630L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "CHARACTER_ID")
private Long characterId;
...
}
--
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, 5 months
[Hibernate-JIRA] Created: (HHH-5172) Invalid alias when referencing two different tables in formula tags
by Stephen Visser (JIRA)
Invalid alias when referencing two different tables in formula tags
-------------------------------------------------------------------
Key: HHH-5172
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5172
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.0-Final
Environment: mappings
Reporter: Stephen Visser
I have a complicated Hibernate entity which is defined as the join between two tables. It looks like the following:
{quote}
<hibernate-mapping>
<class name="User" table="PERSONS">
<id name="personID" column="PERSON_ID"/>
<property name="lmsUserName" column="WEB_USERNAME" />
<property name="userName" insert="false" update="false" unique="true">
<formula>
coalesce(lower(WEB_USERNAME), lower(USERNAME))
</formula>
</property>
<join table="APPLICATION_USERS" optional="true">
<key column="PERSON_ID"/>
<property name="sasUserName" column="USERNAME"/>
</join>
</class>
</hibernate-mapping>
{quote}
We can find by criteria as shown below:
{quote}
final Criteria hibernateCriteria = session.createCriteria(User.class).add(Restrictions.eq("userName", "EXAMPLE_USERNAME"));
final User retrievedObject = (User) hibernateCriteria.uniqueResult();
{quote}
This results in the following SQL query being generated:
{quote}
select userimpl0_.PERSON_ID as PERSON1_2_0_, userimpl0_.WEB_USERNAME as WEB5_2_0_, userimpl0_2_.USERNAME as USERNAME4_0_, coalesce(lower(userimpl0_.WEB_USERNAME), lower(userimpl0_.USERNAME)) as formula0_0_,
from PERSONS userimpl0_ left outer join APPLICATION_USERS userimpl0_2_ on userimpl0_.PERSON_ID=userimpl0_2_.PERSON_ID
where coalesce(lower(userimpl0_.WEB_USERNAME), lower(userimpl0_.USERNAME)) = 'EXAMPLE_USERNAME'
{quote}
Due to the nature of our legacy data system, we are trying to find the userName in one of two columns in the DB. A user may have one or both of the user names specified. We want to query by userName in order to avoid making multiple queries. To do this, we make use of the coalesce function as shown above.
The query created by retrieving by userName prepends both WEB_USERNAME and USERNAME in the coalesce function with a single alias. In fact, I need WEB_USERNAME to be prepended with the alias of the PERSONS table (this is done correctly) and USERNAME to be prepended by the alias for the APPLICATION_USERS table (this is where the problem lies).
Ideally, I think it's reasonable to have one of two options:
1) Be able to 'escape' the automatic prepend of table aliases. This would work fine for me as I have no duplicate columns in this example. But I don't think that it is a very universal solution...
2) Be able to reference the alias for a given table using a well-defined syntax (i.e. {PERSONS}.USERNAME )
I've written a little bit here: https://forum.hibernate.org/viewtopic.php?t=1004224
--
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, 5 months
[Hibernate-JIRA] Created: (HSEARCH-485) mvn site is currently not working (in ./hibernate-search)
by Emmanuel Bernard (JIRA)
mvn site is currently not working (in ./hibernate-search)
---------------------------------------------------------
Key: HSEARCH-485
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-485
Project: Hibernate Search
Issue Type: Bug
Components: build
Affects Versions: 3.2.0.Beta1
Reporter: Emmanuel Bernard
Assignee: Hardy Ferentschik
Fix For: 3.2.0
Emmanuel-MBP-15:hibernate-search manu$ mvn site
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Hibernate Search
[INFO] task-segment: [site]
[INFO] ------------------------------------------------------------------------
[INFO] [site:site {execution: default-site}]
[INFO] Generating "Project Team" report.
[INFO] Generating "Issue Tracking" report.
[INFO] Generating "Dependency Management" report.
[INFO] Generating "Continuous Integration" report.
[INFO] Generating "Project Plugins" report.
[INFO] Generating "Dependencies" report.
[WARNING] The repository url 'http://people.apache.org/repo/m2-snapshot-repository' is invalid - Repository 'apache.snapshots' will be blacklisted.
[WARNING] The repository url 'http://people.apache.org/repo/m2-incubating-repository/' is invalid - Repository 'apache-incubator' will be blacklisted.
[INFO] Generating "Plugin Management" report.
[INFO] Generating "Mailing Lists" report.
[INFO] Generating "Source Repository" report.
[INFO] Generating "Project Summary" report.
[INFO] Generating "About" report.
[INFO] Generating "Project License" report.
[INFO] [jdocbook:translate {execution: make-doc}]
can't find
The next section demonstrates how to programmatically define analyzers.
in
he next section demonstrates how to programmatically define analyzers.</para>
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Unexpected problem
Embedded error: uanble to execute po2xml : Process exited with an error: 1(Exit value: 1)
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 minutes 7 seconds
[INFO] Finished at: Fri Apr 02 11:47:35 CEST 2010
[INFO] Final Memory: 59M/151M
[INFO] ------------------------------------------------------------------------
--
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, 5 months
[Hibernate-JIRA] Created: (HHH-2584) PersistentMap.remove() incorrect on uninitialized, non-extra-lazy map
by Daniel Wellman (JIRA)
PersistentMap.remove() incorrect on uninitialized, non-extra-lazy map
---------------------------------------------------------------------
Key: HHH-2584
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2584
Project: Hibernate3
Issue Type: Patch
Components: core
Affects Versions: 3.2.3, 3.2.2, 3.2.1
Environment: Hibernate 3.2.3 ga, MySQL 5.0.24a, for Win32
Reporter: Daniel Wellman
Attachments: persistentmap_remove.patch
This problem is nearly identical to HHH-2476: PersistentMap.put() incorrect on uninitialized, non-extra-lazy map. remove() has the same problem. See also issue HHH-2142.
The write up for HHH-2476 was so concise that I will transform it here, substituting remove() for put().
---
Essentially, an uninitialized PersistentMap loses the first remove() into it if defined as non-extra-lazy.
The underlying cause is the code in PersistentMap#remove() which attempts to readElementByIndex(). In the case of non-extra-lazy, readElementByIndex() returns the UNKNOWN marker object which is supposed to be used to signal that the delegate map is now initialized and to remove the element directly from the map. Long story short, PersistentMap#remove() does not properly check the return value from readElementByIndex() and react accordingly.
--
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, 5 months