[Hibernate-JIRA] Created: (JPA-11) @Lob annotation applies to both key and value of Map
by Panayiotis Karabassis (JIRA)
@Lob annotation applies to both key and value of Map
----------------------------------------------------
Key: JPA-11
URL: http://opensource.atlassian.com/projects/hibernate/browse/JPA-11
Project: Java Persistence API
Issue Type: Bug
Environment: Hibermate 3.6.0.Final
MySQL
Reporter: Panayiotis Karabassis
When using the @Lob annotation on a java.util.Map I find that both the value and key of the Map are mapped to a BLOB. This is in violation of the JPA 2.0 specification which states:
{quote}The Lob annotation may be used in conjunction with the Basic annotation or with the ElementCollection[100] annotation when the element collection value is of basic type.
...
[100] If the element collection is a Map, this applies to the map value.{quote}
To reproduce:
{quote}@Entity
public class Entry
{
@Id @GeneratedValue
private long identifier;
@ElementCollection
@Column(nullable = false)
private Map<String, String> titles;
@ElementCollection
@Column(nullable = false)
@Lob
private Map<String, String> contents;
// Getters and setters, other fields and methods
}{quote}
This produces the following error during schema creation:
{quote}Unsuccessful: create table myblog.Entry_contents (Entry_identifier bigint not null, contents longtext not null, contents_KEY longtext, primary key (Entry_identifier, contents_KEY)) type=InnoDB
BLOB/TEXT column 'contents_KEY' used in key specification without a key length{quote}
Workarounds include defining column type with @MapKeyColumn(columnDefinition = "...") or using @Embeddable as a wrapper for values. (thanks to axtavt and Sean Patrick Floyd)
--
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, 1 month
[Hibernate-JIRA] Created: (HHH-5870) Cache invalidation bug: createSQLQuery(String sql) creates SQLQueryImpl with null querySpaces, making UpdateTimestampsCache:isUpToDate always return true
by nodje (JIRA)
Cache invalidation bug: createSQLQuery(String sql) creates SQLQueryImpl with null querySpaces, making UpdateTimestampsCache:isUpToDate always return true
---------------------------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-5870
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5870
Project: Hibernate Core
Issue Type: Bug
Components: caching (L2)
Affects Versions: 3.6.0
Environment: OS X 10.6.6 - Java 1.6.0_22
Reporter: nodje
Priority: Blocker
While investigating a regression seemingly caused by cache problem on an application, I stumbled upon
UpdateTimestampsCache:89 method public synchronized boolean isUpToDate(Set spaces, Long timestamp) throws HibernateException
always returning true when parameter spaces Set empty.
This is the cause of my regression: QueryCache gets hit even though returned entities have been updated after the query fired first time.
While trying to understand what caused Set spaces to be empty - which to me is the cause of the error - I realized it is just created like that in SQLQueryImpl:138.
SQLQueryImpl(String sql, SessionImplementor session, ParameterMetadata parameterMetadata) {
super( sql, null, session, parameterMetadata );
queryReturns = new ArrayList<NativeSQLQueryReturn>();
querySpaces = null;
callable = false;
}
While there's probably a way to specify querySpaces (I can only trace it to using addSynchronizedQuerySpace in SQLQuery - which is not referenced in the doc), I believe everybody expect a default behavior, i-e a default querySpace to work with, so that isUpToDate check can work properly.
--
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, 1 month
[Hibernate-JIRA] Created: (HHH-5810) Database MYSQL supports recursive but populate doesn't work
by Raul Romanillos Llorente (JIRA)
Database MYSQL supports recursive but populate doesn't work
-----------------------------------------------------------
Key: HHH-5810
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5810
Project: Hibernate Core
Issue Type: Task
Components: query-sql
Affects Versions: 3.3.0.GA
Environment: Hibernate 3.3.0 GA, MySQL 5.1.41
Reporter: Raul Romanillos Llorente
After running on the screen we see that the field_3 field_1 fields have the same value.
Hibernate has the same value assigned to the fields valueField_1, valueField_2 and valueField_3 and the database are different values.
Hibernate did not return good results with createSQLQuery (query).
...
String query = "SELECT i.id_route, i.route_name, ii.route_name, iii.route_name,";
query += " FROM routes i";
query += " LEFT JOIN routes ii ON i.id_route_parent=i.id_route";
query += " LEFT JOIN routes iii ON ii.id_route_parent=iii.id_route
tx = session.getTransaction();
tx.begin();
result = session.createSQLQuery(query).list();
tx.commit();";
String valueField_0, valueField_1, valueField_2, valueField_3;
if (result!=null) {
for (Object obj: result) {
Object [] cols= (Object []) irObj;
valueField_0=(cols[0]!=null?cols[0].toString():"");
valueField_1=(cols[1]!=null?cols[1].toString():"");
valueField_2=(cols[2]!=null?cols[2].toString():"");
valueField_3=(cols[3]!=null?cols[3].toString():"");
System.out.println("field_1:"+valueField_1+"\nfield_2:"+valueField_2+"\nfield_3:"+valueField_3);
}
}
--
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, 1 month
[Hibernate-JIRA] Created: (HHH-5878) Add ability to mark keywords as protected dynamically to prevent table aliasing when using @Formula
by Ian Simpson (JIRA)
Add ability to mark keywords as protected dynamically to prevent table aliasing when using @Formula
---------------------------------------------------------------------------------------------------
Key: HHH-5878
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5878
Project: Hibernate Core
Issue Type: New Feature
Components: annotations, core
Affects Versions: 3.2.5
Environment: 3.2.5.ga/Oracle 11g database
Reporter: Ian Simpson
Using the following in a @Formula does not work due to keywords being aliased to the entity the formula is part of:
{code}
@Formula("(select count(1) from sometable st " +
"where st.othertable_id in ( " +
"select distinct id from othertable ot " +
"start with ot.id = id " +
"connect by nocycle prior ot.id = ot.parent_id " +
"))"
)
{code}
The end result is:
{code}
(SELECT COUNT(1)
FROM sometable st
AND st.othertable_id IN
( SELECT DISTINCT otherta0_.id
FROM othertable ot otherta0_.start otherta0_.with cc.id = otherta0_.id otherta0_.connect BY otherta0_.nocycle otherta0_.prior cc.id = cc.parent_id
)
)
{code}
What (I think) might be preferable is being able to indicate that certain parts are keywords and that they shouldn't be aliased. The inverse is already doable by adding backticks to a field/table/whatever that does match a protected keyword. For example:
{code}
@Formula("(select count(1) from sometable st " +
"where st.othertable_id in ( " +
"select distinct id from othertable ot " +
"!!start !!with ot.id = id " +
"!!connect by nocycle !!prior ot.id = ot.parent_id " +
"))"
)
{code}
... or something of that nature which Hibernate can seek out a know to process differently. I have no idea if "!!" would be usable, but I think you get what I'm saying.
--
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, 1 month
[Hibernate-JIRA] Created: (HHH-5875) @OnDelete available also on @ManyToMany relationships
by Zdenek Hrib (JIRA)
@OnDelete available also on @ManyToMany relationships
-----------------------------------------------------
Key: HHH-5875
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5875
Project: Hibernate Core
Issue Type: Improvement
Components: annotations
Affects Versions: 3.6.0
Reporter: Zdenek Hrib
When using @ManyToMany annotation and it creates a mapping table (eg. ACCOUNTS, PERSONS, ACOUNTS_PERSONS) it is not possible to mark the field with @OnDelete(action=OnDeleteAction.CASCADE).
Therefore both foreign key contraints on the mapping table are created as "ON UPDATE NO ACTION ON DELETE NO ACTION". It would be great to use the @OnDelete(action=OnDeleteAction.CASCADE) to change it to "ON UPDATE NO ACTION ON DELETE CASCADE".
If I comment out the following lines line in org\hibernate\mapping\Collection.java then one of the two FK contraints could be created as "ON UPDATE NO ACTION ON DELETE CASCADE" by using @OnDelete(action=OnDeleteAction.CASCADE), but still I cannot change it on the second FK constraint.
public void validate(Mapping mapping) throws MappingException {
// if ( getKey().isCascadeDeleteEnabled() && ( !isInverse() || !(isOneToMany()) ) ) {
// throw new MappingException(
// "only inverse one-to-many associations may use on-delete=\"cascade\": "
// + getRole() );
// }
I had attached the example source.
--
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, 1 month