[Hibernate-JIRA] Created: (HHH-3657) Custom types with auto-generated keys
by David Nadaski (JIRA)
Custom types with auto-generated keys
-------------------------------------
Key: HHH-3657
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3657
Project: Hibernate Core
Issue Type: New Feature
Components: core
Affects Versions: 3.3.1
Reporter: David Nadaski
Attachments: IdentifierGeneratorFactory.java
Hibernate should provide for custom types to be usable with auto-generated ids.
Attached is a patch, untested but supposedly working (it works for our site flawlessly), and here's a short description, copied from 2 email that I've sent to the dev list and forum:
So in response to my previous mail, I've applied a short fix for IdentifierGeneratorFactory to enable custom types to be used for auto-generated keys.
Here's IdentifierGeneratorFactory's modified public static Serializable get(....) method, which was extended based on the 3.3.1.GA release:
public static Serializable get(ResultSet rs, Type type) throws SQLException, IdentifierGenerationException {
Class clazz = type.getReturnedClass();
if ( clazz == Long.class ) {
return new Long( rs.getLong( 1 ) );
}
else if ( clazz == Integer.class ) {
return new Integer( rs.getInt( 1 ) );
}
else if ( clazz == Short.class ) {
return new Short( rs.getShort( 1 ) );
}
else if ( clazz == String.class ) {
return rs.getString( 1 );
}
else {
// try to instantiate the custom type through reflection
try {
Constructor<?>[] constructors = type.getReturnedClass().getConstructors();
for (Constructor<?> constructor : constructors)
{
Class<?>[] parameterTypes = constructor.getParameterTypes();
if (parameterTypes.length == 1)
if (Long.class.equals(parameterTypes[0]))
return (Serializable) constructor.newInstance(rs.getLong(1));
else if (Integer.class.equals(parameterTypes[0]))
return (Serializable) constructor.newInstance(rs.getInt(1));
else if (Short.class.equals(parameterTypes[0]))
return (Serializable) constructor.newInstance(rs.getShort(1));
else if (String.class.equals(parameterTypes[0]))
return (Serializable) constructor.newInstance(rs.getString(1));
}
} catch (Throwable t) {
throw new IdentifierGenerationException( "Error instantiating custom type: " + type + " with value class: " + type.getReturnedClass(), t );
}
throw new IdentifierGenerationException( "Supplied custom type doesn't have a 1-argument constructor which could take either long, integer, short or string: " + type.getReturnedClass().getName() );
}
}
So this would allow you to use any class for an auto-generated ID, for example:
public class UniqueInteger implements Serializable {
private Integer internal;
public UniqueInteger()
{
}
public UniqueInteger(Integer internal)
{
this.internal = internal;
}
}
The only requirement is that it should have a 1-argument constructor that can take either long, integer, short or string.
Which I think makes sense.
Please submit your feedback and thoughts on this!
--Dávid
--------------------------------------------------------------------------------
From: Nádaski Dávid [mailto:david@aquilanet.hu]
Sent: Wednesday, December 10, 2008 7:23 AM
To: 'hibernate-dev(a)lists.jboss.org'
Subject: Using custom types for auto-generated id columns
Hi,
I was trying to use a custom type for which there was a valid Type implementation, and have run into the following error:
28240 [http-8080-1] ERROR org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session
org.hibernate.id.IdentifierGenerationException: this id generator generates long, integer, short or string
at org.hibernate.id.IdentifierGeneratorFactory.get(IdentifierGeneratorFactory.java:116)
etc.
I'm using MySQL.
Looking at the source, it seems like Hibernate doesn't support anything other than a "long, integer, short or string".
In the parameters of IdentifierGeneratorFactory.get(....), there's one called "Type type". This gets mapped correctly to my custom, but since that's none of those "primitive" types, I get the error - but since the Type information is available, it could easily be used to map say a String using Type.nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner), since we have both the ResultSet and the Type parameter available in IdentifierGeneratorFactory.get(ResultSet rs, Type type). So then, the proper custom type could be returned if it indeed supports this kind of mapping (which is by definition it's job).
So I propose a patch should be made to IdentifierGeneratorFactory that would enable the use of custom types for identity-generated columns.
It's possible that I'm missing something, in that case please point out my error.
Upon request, I think I can supply the appropriate patch, although it seems easy to code.
Thanks,
David
That's the emails, you'll find the patch attached.
--
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
17 years, 7 months
[Hibernate-JIRA] Created: (HHH-3654) A bug on set with composite element deletes the elements first instead of updating
by leela (JIRA)
A bug on set with composite element deletes the elements first instead of updating
----------------------------------------------------------------------------------
Key: HHH-3654
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3654
Project: Hibernate Core
Issue Type: Bug
Reporter: leela
<set name="pictureCollection"
lazy="true"
access="field"
cascade="save-update"
outer-join="false"
table="tablec">
<key column="aid" />
<composite-element class="tablec">
<many-to-one name="b" column="bid" lazy="proxy" access="field" not-null="true" />
<property name="x" type="int" access="field"/>
<property name="seqno" type="int" access="field"/>
</composite-element>
</set>
I am trying to delete the first entry and then update the seqno accordingly for the remaining entries.
when the commit is done, hibernate performs delete operation followed by insert for the remaining entries in the collection, instead of updating the dirty objects.
delete from tablec where aid=? and bid=?
insert into tablec (aid, bid, x, seqno) values (?, ?, ?, ?)
Is not this a bug? If we have 1000 objects in the collection, would not this cause a big performace impact?
Please help me on this.
--
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
17 years, 7 months
[Hibernate-JIRA] Created: (HHH-3653) Allow lazy loading for one-to-one association when constrained="false"
by Eric Sirianni (JIRA)
Allow lazy loading for one-to-one association when constrained="false"
----------------------------------------------------------------------
Key: HHH-3653
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3653
Project: Hibernate Core
Issue Type: Improvement
Components: core
Affects Versions: 3.3.1
Reporter: Eric Sirianni
Hibernate currently has a documented restriction on one-to-one associations that prohibits lazy loading when constrained="false"
lazy (optional - defaults to proxy): By default, single point associations are proxied. lazy="no-proxy" specifies that the property should be fetched lazily when the instance variable is first accessed (requires build-time bytecode instrumentation). lazy="false" specifies that the association will always be eagerly fetched. Note that if constrained="false", proxying is impossible and Hibernate will eager fetch the association!
The rationale for this seems to be that
- If constrained="false", then hibernate has to execute a SELECT on the associated table in order to set the parent's reference to NULL vs. a child proxy
- Since hibernate has to do this SELECT anyway, then why not just load the actual child record instead of the proxy
This is summarized in http://www.hibernate.org/162.html:
"But a SELECT to check presence is just inefficient because the same SELECT may not just check presence, but load entire object. So lazy loading goes away."
The notes on that page do a good job explaining the flaw in this rationale:
---
This is hugely wrong. Imagine a table with a FK and a 20M blob of data
in each row. Lazy loading the blob when displaying a list of rows for
example is useful, even if you have to select the PK column to find out
the rows exist. Lazy loading has more uses than avoiding the SQL
execution. In this case avoiding the memory overhead of creating
perhaps hundreds of M of data in memory when it's not needed.
---
I have a one-to-one where the foreign table is very large and
holds a bunch of infrequently used information. Most parent records do
not need a detail record as they do not have any of the information it
stores. Parent records are cached and heavily used. It would be a waste
to fill up memory or table space with mostly unused detail records.
---
My project is in the exact same situation. We have one-to-one records where the child objects have a significant amount of details (CLOBs) that take up a lot of space in memory. We would like these to be lazy loaded.
Please consider this feature request. I don't think the implementation would be very difficult. It would be straight forward to add a join on the id column of the
foreign table. That would permit Hibernate to discover whether an optional one-to-one object was present and have enough info to create the proxy vs. the NULL reference.
--
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
17 years, 7 months
[Hibernate-JIRA] Created: (HHH-3651) HQL delete with subquery generates invalid (ambiguous) SQL
by Robin Houston (JIRA)
HQL delete with subquery generates invalid (ambiguous) SQL
----------------------------------------------------------
Key: HHH-3651
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3651
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.3.1
Environment: Hibernate 3.3.1GA, PostgreSQL database
Reporter: Robin Houston
Attachments: Edge.java, Node.java, schema.sql
A simple test case demonstrating this bug is attached. The HQL query
delete Node n where n in (
select grandchild
from Edge grandparent_child
, Edge child_grandchild
left join child_grandchild.target as grandchild
where grandparent_child.target = child_grandchild.source
and grandparent_child.source.name = :nodeName
)
generates the following SQL (formatted for readability):
delete from node where id in (
select id
from edge edge1_
, edge edge2_
left outer join node node3_ on edge2_.target_id = node3_.id
, node node4_
where edge1_.source_id=node4_.id
and edge1_.target_id = edge2_.source_id
and node4_.name = ?
)
Note that the 'select id' is ambiguous; it could refer either to node3_.id or node4_.id. (It should be node3_, of course.) This ambiguity causes the PostgreSQL parser to throw an exception.
I realise that the problem could be avoided in this particular example by removing the join and directly selecting child_grandchild.target. However, this is just a simple test case derived from a much more complicated example where such a workaround doesn't seem to be possible. (We are currently circumventing the problem by using an SQL delete statement.)
I attach the mapped classes and the schema definition for this test case.
Robin
--
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
17 years, 7 months
[Hibernate-JIRA] Created: (EJB-406) Unclosed sessions/transaction
by Juraci Paixao Krohling (JIRA)
Unclosed sessions/transaction
-----------------------------
Key: EJB-406
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-406
Project: Hibernate Entity Manager
Issue Type: Bug
Components: EntityManager
Environment: Tested in DB2 v8, probably affects most RDBMS's as well
Reporter: Juraci Paixao Krohling
Assignee: Juraci Paixao Krohling
Attachments: TestCase.java.diff
Some tests opens transactions and do not properly close them, causing some RDBMS's to hang indefinitely, waiting for the transaction to be closed before dropping the entities used in the test.
To encourage the closing of these open transaction, the following patch makes the test to fail if the transaction is not finished. Also, the test rolls back the transaction, to release the transaction in the database, enabling it to drop all entities used by the test.
Also, a warning was also added to the parent test case for the project, informing when a test case is not closing the EM.
--
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
17 years, 7 months
[Hibernate-JIRA] Commented: (HHH-912) Use of DetachedCriteria
by Steve Van Reeth (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-912?page=co... ]
Steve Van Reeth commented on HHH-912:
-------------------------------------
I have the same problem: for performance purpose, I have to do this:
SELECT this_.ID AS id33_0_, this_.in_record_id AS in2_33_0_,
this_.created_ts AS created3_33_0_, this_.ext_app_id AS ext4_33_0_,
this_.file_id AS file8_33_0_, this_.line_number AS line5_33_0_,
this_.linked_ts AS linked6_33_0_, this_.status_id AS status7_33_0_
FROM myschema.ext_in_record this_
WHERE this_.ID IN (SELECT ID
FROM (SELECT ID
FROM myschema.ext_in_record
WHERE status_id = 0
ORDER BY ID)
WHERE ROWNUM < = 500);
It's impossible to do with Criteria in Hibernate 3.2.6.
> Use of DetachedCriteria
> -----------------------
>
> Key: HHH-912
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-912
> Project: Hibernate Core
> Issue Type: Improvement
> Components: core
> Affects Versions: 3.0.5
> Environment: All
> Reporter: Frank Verbruggen
> Priority: Minor
>
> The class org.hibernate.criterion.DetachedCriteria should represent a criteria object on which all the operations available to a Criteria object that do NOT require a Session object are available.
> Two such operations are setFirstResult() and setMaxResults().
> These are unfortunately enough not available.
> There probably are more methods missing that need to be added but these two in particular are important to me.
> See http://opensource2.atlassian.com/projects/spring/browse/SPR-1254.
> Can they be added in the next release ?
> Kind regards
> Frank Verbruggen
--
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
17 years, 7 months
[Hibernate-JIRA] Created: (HHH-3197) subquery is not valid SQL when select type is same as parent sql select type
by Nicolai Marck Ødum (JIRA)
subquery is not valid SQL when select type is same as parent sql select type
----------------------------------------------------------------------------
Key: HHH-3197
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3197
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.6
Environment: Java 1.5.0_14
JBoss 4.2.2.GA (Hibernate 3.2.1) - I have also tried with Hibernate 3.2.6.ga, hibernate-annotations-3.3.1.GA and hibernate-entitymanager-3.3.2.GA with same result.
PostgreSQL 8.3.0
WindowsXP
Reporter: Nicolai Marck Ødum
The following ejb3 QL:
"Delete FROM Notification noti WHERE noti NOT IN (SELECT subNoti.notifications FROM SubscriberNotification subNoti)"
Result in the following sql
"delete from Notification where id not in (select . from SubscriberNotification subscriber1_, SubscriberNotification_Notification notificati2_, Notification notificati3_ where subscriber1_.id=notificati2_.SubscriberNotification_id and notificati2_.notifications_id=notificati3_.id)"
notice the "select . from" in the subquery
if I alter the sql to be
"delete from Notification where id not in (select notificati3_.id from SubscriberNotification subscriber1_, SubscriberNotification_Notification notificati2_, Notification notificati3_ where subscriber1_.id=notificati2_.SubscriberNotification_id and notificati2_.notifications_id=notificati3_.id)"
I have not been able to create a workaround.
--
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
17 years, 7 months
[Hibernate-JIRA] Created: (HHH-3645) Bug with list when rearranging - treat it as urgent
by leela (JIRA)
Bug with list when rearranging - treat it as urgent
---------------------------------------------------
Key: HHH-3645
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3645
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Reporter: leela
Class A has a child list specifying an association to another class B.
Table A
AId
Table B
BId
Table C(Association Table with 3 columns)
AId(Id of Table A)
BId(Id of Table B)
SeqNo
OtherColumn1
OtherColumn2
When I rearrange the child list, obviously the index will be changing.
Initially the table C was mapped like this before rearranging.
A1 B1 0 XX YY
A1 B2 1 YY ZZ
A1 B3 2 ZZ XX
After rearranging the java list contains :
A1 B2 0 XX YY
A1 B1 1 XX YY
A2 B3 2 ZZ XX
But when this list is getting persisted, hibernate is trying to do an update by seq no
update tablec set table Bid = B2 where Aid = A1 and SeqNo = 0
It fails to persit because since we had set a unique composite index on AId and BId.
That means hibernate was trying to persist like this, that caused the failures.
A1 B2 0
A1 B2 1
A1 B3 2
Here is my hibernate mapping in classA mapping file.
<list name="assocList"
lazy="true"
access="field"
cascade="save-update"
outer-join="false"
table="tablec">
<key column="aid" not-null="true" unique="false"/>
<list-index column="seqno"/>
<composite-element class="ClassC">
<many-to-one name="ClassB" column="bid" lazy="proxy"/>
<property ..../>
<property ..../>
</composite-element>
</list>
Should not hibernate supposed to delete and reinsert the child elements? Then what is the solution for this? Is not this a bug?
--
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
17 years, 7 months
[Hibernate-JIRA] Created: (HHH-3638) Ability to use Criteria with Queries
by Adriano dos Santos Fernandes (JIRA)
Ability to use Criteria with Queries
------------------------------------
Key: HHH-3638
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3638
Project: Hibernate Core
Issue Type: New Feature
Components: core, query-criteria, query-hql, query-sql
Reporter: Adriano dos Santos Fernandes
I done it, for my needs, using internal classes. It would be very great to have this nativelly on Hibernate.
Query createQueryByExample(Query query, Entidade entity)
{
SessionImpl session = (SessionImpl) entityManager.getDelegate();
Class<?> entityClass = entity.getClass();
CriteriaImpl criteria = (CriteriaImpl) session.createCriteria(entityClass);
CriteriaQueryTranslator criteriaQuery = new CriteriaQueryTranslator(
session.getFactory(), criteria, entityClass.getName(), "z");
Example example = Example.create(entity)
.enableLike(MatchMode.START)
.excludeZeroes();
criteria.add(example);
String newSql = "select * from (" +
((HibernateQuery) query).getHibernateQuery().getQueryString() +
") z";
Object[] params = criteriaQuery.getQueryParameters().getPositionalParameterValues();
if (params.length > 0)
{
String newWhere = example.toSqlString(criteria, criteriaQuery);
newSql += "\nwhere " + newWhere;
query = entityManager.createNativeQuery(newSql, entityClass);
int n = 0;
for (Object param : params)
query.setParameter(++n, param);
}
return query;
}
--
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
17 years, 7 months
[Hibernate-JIRA] Commented: (HHH-1015) Incorrect SQL generated when one-to-many foreign key is in a discriminated subclass table
by Krasimir Chobantonov (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1015?page=c... ]
Krasimir Chobantonov commented on HHH-1015:
-------------------------------------------
Provided patch does not fix HQL to SQL translation issue. I will take a look what else needs to be changed - the bottom line is that if you navigate to the object using the model API then everything seems to work with the patch but when you want to execute an HQL then it is failing and again is looking for the column in the base table
> Incorrect SQL generated when one-to-many foreign key is in a discriminated subclass table
> -----------------------------------------------------------------------------------------
>
> Key: HHH-1015
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1015
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1 beta 2
> Environment: Hibernate versions 3.1 beta 3 and 3.0.5
> Reporter: Steven Grimm
> Priority: Minor
> Attachments: hhh-1015.patch
>
>
> I have the following mappings describing a hierarchy of events and a class that the events refer to:
> <hibernate-mapping package="com.xyz">
> <class name="Event" table="event" discriminator-value="-1">
> <id name="Id" type="long" column="event_id"/>
> <discriminator column="event_type_id" type="integer" />
> <subclass name="EventPayer" discriminator-value="-3">
> <join table="event_payer">
> <key column="event_id" />
> <many-to-one name="payer" column="payer_id" class="Payer" />
> </join>
> <subclass name="EventPayerCreated" discriminator-value="1" />
> </subclass>
> </class>
> <class name="Payer" table="payer">
> <id name="payerId" column="payer_id" type="java.lang.Long"/>
> <set name="eventPayers" inverse="true" cascade="save-update">
> <key column="payer_id"/>
> <one-to-many class="EventPayer"/>
> </set>
> </class>
> </hibernate-mapping>
> When I fetch the Payer.eventPayers collection, Hibernate generates this SQL:
> select eventpayer0_.payer_id as payer7_1_,
> eventpayer0_.event_id as event1_1_,
> eventpayer0_.event_id as event1_5_0_,
> eventpayer0_1_.payer_id as payer2_6_0_,
> eventpayer0_.event_type_id as event2_5_0_
> from event eventpayer0_
> inner join event_payer eventpayer0_1_
> on eventpayer0_.event_id=eventpayer0_1_.event_id
> where eventpayer0_.payer_id=?
> The problem is that there is no event.payer_id column; payer_id is in the child table, not the parent. It appears that specifying a discriminated subclass in <one-to-many> is the same as specifying the superclass, or that Hibernate is ignoring the subclass's <join> element. As far as I can tell, this leaves no way to resolve bidirectional associations where one end of the association is in a discriminated subclass, which seems like a perfectly reasonable thing to want to do.
> I also tried changing <key column="payer_id"/> to <key property-ref="payer"/> in the Payer class's <set> element, but got similar behavior in the form of a "property not found" error: Hibernate is either looking in the superclass's properties rather than the subclass's or is ignoring the list of properties in the <join> element.
--
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
17 years, 7 months
[Hibernate-JIRA] Created: (HHH-3635) Hibernate Configuration.
by S Romender Singh (JIRA)
Hibernate Configuration.
------------------------
Key: HHH-3635
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3635
Project: Hibernate Core
Issue Type: Bug
Components: build
Affects Versions: 3.2.5
Environment: WAS 6.1 with multile Class loaders.
Reporter: S Romender Singh
For fast loading the Configuration.java is serialized in form of binary file.
Since the Configuration.java doesn't have serial version UID failing while de-serializing and this failure is also occur randomly.
java.io.InvalidClassException: org.dom4j.tree.AbstractNode; local class incompatible: stream classdesc serialVersionUID = 4188621179618565246, local class serialVersionUID = 4436254242831845461
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:519)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
at java.util.ArrayList.readObject(ArrayList.java:591)
--
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
17 years, 7 months
[Hibernate-JIRA] Updated: (HHH-37) Nested instantiation using "select new"
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-37?page=com... ]
Steve Ebersole updated HHH-37:
------------------------------
Comment: was deleted
> Nested instantiation using "select new"
> ---------------------------------------
>
> Key: HHH-37
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-37
> Project: Hibernate Core
> Issue Type: New Feature
> Components: core
> Affects Versions: 3.0 alpha
> Environment: Hibernate 3.0 alpha
> Reporter: Regis Pires Magalhaes
> Assignee: Steve Ebersole
> Attachments: h3.0.1_grammar.patch, h3.0.1_src.patch, h3.0.1_src_b.patch, IteratorImpl.java, Loader.java, NestedHolderClass.java, QueryTranslatorImpl.java, ScrollableResultsImpl.java, SelectParser.java
>
>
> Our suggestion is to get lightweight objects from Hibernate using nested new's in HQL "select new" feature.
> Currently, the following HQL statement works fine:
> select new Store(store.id, store.description) from Store store
> However we can not do a nested instantiation like:
> select new Store(store.id, store.description, new Section(store.section.id, store.section.name)) from Store store
> We have done some custom changes in our Hibernate 3.0 alpha source code in order to support it.
> The changed classes were:
> org.hibernate.impl.IteratorImpl
> org.hibernate.loader.Loader
> org.hibernate.hql.QueryTranslatorImpl
> org.hibernate.impl.ScrollableResultsImpl
> org.hibernate.hql.SelectParser
> The new class is:
> org.hibernate.util.NestedHolderClass;
> We would like to know if Hibernate Team has some interest to analyse this contribution and maybe add this feature to future versions of Hibernate.
--
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
17 years, 7 months
[Hibernate-JIRA] Created: (ANN-636) Add the annotations to map the User Collection Type
by jason (JIRA)
Add the annotations to map the User Collection Type
---------------------------------------------------
Key: ANN-636
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-636
Project: Hibernate Annotations
Issue Type: New Feature
Components: binder
Environment: n/a
Reporter: jason
I am searching a way from the Hibernate Annotation to map the user defined collection, and find out the following :
Can anybody let me know what the status for this? or how i can map the user collection type by hibernate annotation, thanks
Add an annotation to specify the UserCollectionType for a OneToMany or ManyToMany.
The annotation is named CollectionTypeInfo, perhaps better named UserCollectionType, but I didn't know the standards for naming classes.
The change to AnnotationBinder is minor and is delineated by '//dwsjoquist//' comment lines.
Usage:
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumn(name = "id")
@CollectionTypeInfo(name = "examples.MyUserCollectionType")
public List<ExampleAttribute> getExampleAttributes() {
--
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
17 years, 7 months
[Hibernate-JIRA] Commented: (ANN-141) Add annotation support for UserCollectionType
by tao wen (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-141?page=co... ]
tao wen commented on ANN-141:
-----------------------------
I think I have found a solution without changing the hibernate code. Currently, to let the AnnotationConfiguration be able to handle UserCollectionType, there are to two issues. First, Ejb3ReflectionManager think the member is not a collection, so you will first get a "Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @CollectionOfElements" exception. This could be work around by change the reflection manager in AnnotationManager. Second issue is the typeName(which is the class name of your UserCollectionType class) property of Set mapping is null (of coz it is null, because there is no place to set it), so hibernate will use default SetType to handle it, which will cause runtime "setter unknown" exception. This could be workaround by post-process the configuration produced by AnnotationConfiguration.configure(), set the typeName for all the set mapping you think need to use your UserCollectionType.
Finally, it is a hack, not a solution.
> Add annotation support for UserCollectionType
> ---------------------------------------------
>
> Key: ANN-141
> URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-141
> Project: Hibernate Annotations
> Issue Type: Patch
> Components: binder
> Affects Versions: 3.1beta6
> Environment: All versions, database agnostic
> Reporter: Douglas Sjoquist
> Priority: Minor
> Attachments: UserCollectionTypeAnnotation.zip
>
> Original Estimate: 30 minutes
> Remaining Estimate: 30 minutes
>
> Add an annotation to specify the UserCollectionType for a OneToMany or ManyToMany.
> The annotation is named CollectionTypeInfo, perhaps better named UserCollectionType, but I didn't know the standards for naming classes.
> The change to AnnotationBinder is minor and is delineated by '//dwsjoquist//' comment lines.
> Usage:
> @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
> @JoinColumn(name = "id")
> @CollectionTypeInfo(name = "examples.MyUserCollectionType")
> public List<ExampleAttribute> getExampleAttributes() {
--
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
17 years, 7 months
[Hibernate-JIRA] Commented: (HHH-37) Nested instantiation using "select new"
by Terry Bhatti (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-37?page=com... ]
Terry Bhatti commented on HHH-37:
---------------------------------
This is sitting open since 2004, wish it had been done since.
> Nested instantiation using "select new"
> ---------------------------------------
>
> Key: HHH-37
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-37
> Project: Hibernate Core
> Issue Type: New Feature
> Components: core
> Affects Versions: 3.0 alpha
> Environment: Hibernate 3.0 alpha
> Reporter: Regis Pires Magalhaes
> Assignee: Steve Ebersole
> Attachments: h3.0.1_grammar.patch, h3.0.1_src.patch, h3.0.1_src_b.patch, IteratorImpl.java, Loader.java, NestedHolderClass.java, QueryTranslatorImpl.java, ScrollableResultsImpl.java, SelectParser.java
>
>
> Our suggestion is to get lightweight objects from Hibernate using nested new's in HQL "select new" feature.
> Currently, the following HQL statement works fine:
> select new Store(store.id, store.description) from Store store
> However we can not do a nested instantiation like:
> select new Store(store.id, store.description, new Section(store.section.id, store.section.name)) from Store store
> We have done some custom changes in our Hibernate 3.0 alpha source code in order to support it.
> The changed classes were:
> org.hibernate.impl.IteratorImpl
> org.hibernate.loader.Loader
> org.hibernate.hql.QueryTranslatorImpl
> org.hibernate.impl.ScrollableResultsImpl
> org.hibernate.hql.SelectParser
> The new class is:
> org.hibernate.util.NestedHolderClass;
> We would like to know if Hibernate Team has some interest to analyse this contribution and maybe add this feature to future versions of Hibernate.
--
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
17 years, 7 months
[Hibernate-JIRA] Created: (HHH-3365) SchemaUpdate still fails if conflicting table is visible in another user's tablespace
by John Wood (JIRA)
SchemaUpdate still fails if conflicting table is visible in another user's tablespace
-------------------------------------------------------------------------------------
Key: HHH-3365
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3365
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.3.0.CR1, 3.2.6, 3.1
Reporter: John Wood
Priority: Minor
This issue is a duplicate of HHH-2208. Despite what that other issue states, this doesn't seem to be fixed.
This issue still seems to a problem for us when using the SchemaUpdate tool to auto-update our tables (in Oracle).
We've tried this using the following hibernate versions: 3.1, 3.2.6ga, 3.3.0.CR1
In every case the bug still happens: the schema update tool tries to update a table called "JOB", finds a table in someone else's schema (which happens to have been made public), and then gets confused. It will either try to update the other user's JOB table, or (in our case), fails because it (quite rightly) doesn't have permissions to change the other user's table.
Here is how to reproduce:
1) Create your main DB user as normal (user1)
2) Create another user on the Oracle same database (user2)
3) On user2 create a new table which conflicts with a table in your generated DB ("job").
4) Make this new table visible to user1. One way of doing this is to give "insert" privildeges to "public":
grant insert on user2.job to public
5) Run the schema update tool for user1. This will fail: it tries to update the table in user2's schema (tablespace), and doesn't have permissions.
Note that this issue only occurs when the conflicting table is visible to user1: if the table was hidden (i.e. user1 had no visibility of the conflicting table), we would be OK.
It seems to me that either A) there is some confusion about when this issue was fixed, or B) this is a different issue to HHH-2208
--
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
17 years, 7 months
[Hibernate-JIRA] Created: (HHH-3631) HQL grammar does not actually support the CASE statement
by Andra Nedelcovici (JIRA)
HQL grammar does not actually support the CASE statement
--------------------------------------------------------
Key: HHH-3631
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3631
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.3.1
Environment: Hibernate 3.3.1 ga, Postgresql
Reporter: Andra Nedelcovici
Using a simple form of the CASE statement in HQL like the following
from EnumerationValue where enumeration = 'XXX' and (case :param
when 1 then value > 5
when 2 then value < 100
else true
end) order by id
yields
org.hibernate.hql.ast.QuerySyntaxException: unexpected AST node: case near line 1, column 54 [...]
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54)
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:47)
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:82)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:258)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:183)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:134)
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:94)
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:1650) ...
I also tried this (silly, isn't it?):
from EnumerationValue where enumeration = 'XXX' and (1=1 and case 3
when 1 then false
when 2 then true
else true
end) order by id
in order to check for HQL grammar limitations, but the result is just the same.
I should also mention that I ran successfully the above queries in a PostgreSQL console (with the normal adjustments).
--
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
17 years, 7 months
[Hibernate-JIRA] Commented: (HHH-1400) Using formula-based property causes invalid SQL code for children "subselect" query
by Florian Rock (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1400?page=c... ]
Florian Rock commented on HHH-1400:
-----------------------------------
pls try my little ugly "fix"... it worked for me =)
> Using formula-based property causes invalid SQL code for children "subselect" query
> -----------------------------------------------------------------------------------
>
> Key: HHH-1400
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1400
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1 rc3
> Environment: Hibernate 3.0.5, Hibernate 3.1rc3
> Oracle 8i
> Reporter: Chris Rogers
> Attachments: SubselectFetch.java, subselectformula.zip, SubselectFormulaBug.zip
>
>
> I have simple one-to-many relationship, mapped as set:
> <class name="Parent">
> <set name="children" lazy="false" fetch="subselect">
> <key column="PARENT_OID"/>
> <one-to-many class="Child"/>
> </set>
> </class>
> this works fine, constructing subselect SQL which looks like (e.g. for HQL query "from Parent"):
> select <child fields> from <child table> where child.PARENT_OID in (select this_.OID from PARENT this_)
> (simplified)
> However, when adding a formula-based property into Parent:
> <property name="myFormulaField" formula="(complex_select )"/>
> Now SQL becomes:
> select <child fields> from <child table> where PARENT_OID in (complex_select) as formula0_1_, <some parent fields> from PARENT this_)
> This SQL fails because of incorrect grammar (it also seems that backet is missing).
> This is something weird, because subselect fetching only needs Parent's identity column, not any other properties. And I don't think it should be affected by Parent's formula-based properties.
> I can provide more details if necessary, I stripped out all extra mapping/SQL stuff because it seems to be irrelevant here.
> This bug appeared in 3.0.5 later I've downloaded 3.1rc3 and it also fails.
--
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
17 years, 7 months
[Hibernate-JIRA] Created: (ANN-789) ParameterizedType.setParameterValues method is getting null
by Maxim Petrashev (JIRA)
ParameterizedType.setParameterValues method is getting null
-----------------------------------------------------------
Key: ANN-789
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-789
Project: Hibernate Annotations
Issue Type: Bug
Affects Versions: 3.4.0.GA
Reporter: Maxim Petrashev
Entity class has enum property that is annotated by custom user type. This UserType implementation class implements also ParameterizedType interface.
SimpleValueBinder evaluates parameters for enum perfectly in block:
if ( BinderHelper.ANNOTATION_STRING_DEFAULT.equals( type ) ) {
if ( returnedClassOrElement.isEnum() ) {
that starts on line 160 but when setType calls setExplicitType method on line 191 last one clear typeParameters:
line 202: typeParameters.clear();
and fillSimpleValue method path nothing to simpleValue. Last one (in this case) pass null to ParameterizedType.setParameterValues method. I believe it should pass properties that were initialized in
if ( BinderHelper.ANNOTATION_STRING_DEFAULT.equals( type ) ) {
if ( returnedClassOrElement.isEnum() ) {
block (as EnumType is receiving)
--
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
17 years, 7 months
[Hibernate-JIRA] Commented: (HHH-1400) Using formula-based property causes invalid SQL code for children "subselect" query
by kishorekpotta (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1400?page=c... ]
kishorekpotta commented on HHH-1400:
------------------------------------
select territoryp0_.TERR_PRICE_CAT_ID as TERR12_1_, territoryp0_.TERRITORY_ID as TERRITORY1_1_, from ETRANS.DMD_TERR_PRICE_CATEGORY_DIM territoryp0_ where territoryp0_.TERR_PRICE_CAT_ID in (select this_.TERR_PRICE_CAT_ID from dmd.dmd_territory_cluster dtc where dtc.PARENT_TERRITORY_ID = territory2_.TERRITORY_ID and dtc.CHILD_TERRITORY_ID = 1) as formula11_0_ from ETRANS.DMD_TERRITORY_PRICE_CATEGORY this_ left outer join DMD.DMD_Territory territory2_ on this_.TERRITORY_ID=territory2_.TERRITORY_ID where this_.PRICE_CATEGORY_ID=? and this_.TERRITORY_ID<>? )
23:39:01,807 WARN [JDBCExceptionReporter] SQL Error: 933, SQLState: 42000
23:39:01,807 ERROR [JDBCExceptionReporter] ORA-00933: SQL command not properly ended
Below is my forumla query.
formula=(select distinct 'Y' from dmd.dmd_territory_cluster dtc
where dtc.PARENT_TERRITORY_ID = TERRITORY_ID
and dtc.CHILD_TERRITORY_ID = 1)"
> Using formula-based property causes invalid SQL code for children "subselect" query
> -----------------------------------------------------------------------------------
>
> Key: HHH-1400
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1400
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1 rc3
> Environment: Hibernate 3.0.5, Hibernate 3.1rc3
> Oracle 8i
> Reporter: Chris Rogers
> Attachments: SubselectFetch.java, subselectformula.zip, SubselectFormulaBug.zip
>
>
> I have simple one-to-many relationship, mapped as set:
> <class name="Parent">
> <set name="children" lazy="false" fetch="subselect">
> <key column="PARENT_OID"/>
> <one-to-many class="Child"/>
> </set>
> </class>
> this works fine, constructing subselect SQL which looks like (e.g. for HQL query "from Parent"):
> select <child fields> from <child table> where child.PARENT_OID in (select this_.OID from PARENT this_)
> (simplified)
> However, when adding a formula-based property into Parent:
> <property name="myFormulaField" formula="(complex_select )"/>
> Now SQL becomes:
> select <child fields> from <child table> where PARENT_OID in (complex_select) as formula0_1_, <some parent fields> from PARENT this_)
> This SQL fails because of incorrect grammar (it also seems that backet is missing).
> This is something weird, because subselect fetching only needs Parent's identity column, not any other properties. And I don't think it should be affected by Parent's formula-based properties.
> I can provide more details if necessary, I stripped out all extra mapping/SQL stuff because it seems to be irrelevant here.
> This bug appeared in 3.0.5 later I've downloaded 3.1rc3 and it also fails.
--
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
17 years, 7 months
[Hibernate-JIRA] Commented: (HHH-1400) Using formula-based property causes invalid SQL code for children "subselect" query
by kishorekpotta (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1400?page=c... ]
kishorekpotta commented on HHH-1400:
------------------------------------
was this issue resolved? I am still facing this issue. when used formaula property along with fetch="subslect", I am getting invalid query error.
> Using formula-based property causes invalid SQL code for children "subselect" query
> -----------------------------------------------------------------------------------
>
> Key: HHH-1400
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1400
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1 rc3
> Environment: Hibernate 3.0.5, Hibernate 3.1rc3
> Oracle 8i
> Reporter: Chris Rogers
> Attachments: SubselectFetch.java, subselectformula.zip, SubselectFormulaBug.zip
>
>
> I have simple one-to-many relationship, mapped as set:
> <class name="Parent">
> <set name="children" lazy="false" fetch="subselect">
> <key column="PARENT_OID"/>
> <one-to-many class="Child"/>
> </set>
> </class>
> this works fine, constructing subselect SQL which looks like (e.g. for HQL query "from Parent"):
> select <child fields> from <child table> where child.PARENT_OID in (select this_.OID from PARENT this_)
> (simplified)
> However, when adding a formula-based property into Parent:
> <property name="myFormulaField" formula="(complex_select )"/>
> Now SQL becomes:
> select <child fields> from <child table> where PARENT_OID in (complex_select) as formula0_1_, <some parent fields> from PARENT this_)
> This SQL fails because of incorrect grammar (it also seems that backet is missing).
> This is something weird, because subselect fetching only needs Parent's identity column, not any other properties. And I don't think it should be affected by Parent's formula-based properties.
> I can provide more details if necessary, I stripped out all extra mapping/SQL stuff because it seems to be irrelevant here.
> This bug appeared in 3.0.5 later I've downloaded 3.1rc3 and it also fails.
--
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
17 years, 7 months
[Hibernate-JIRA] Resolved: (HBX-524) Reverse of one-to-one relationships
by Max Rydahl Andersen (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-524?page=co... ]
Max Rydahl Andersen resolved HBX-524.
-------------------------------------
Resolution: Fixed
fixed for now.
JPA generation generates hibernate specific annotation for the key generator though.
Would be nice if that could be a supported JPA ?
> Reverse of one-to-one relationships
> -----------------------------------
>
> Key: HBX-524
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-524
> Project: Hibernate Tools
> Issue Type: Bug
> Components: reverse-engineer
> Affects Versions: 3.1beta2
> Environment: HIbernate 3.1, Oracle 9i
> Reporter: Andrea Cattani
> Assignee: Anthony Patricio
> Fix For: 3.2.4.CR1
>
> Attachments: HBX-524.patch, HBX-524v2.patch, jpa-generation-patch.patch, one-to-one-marcio.patch, patch.txt
>
>
> Hi,
> I've posted this issue to the forum and got this response from Max, Hibernate Team:
> "the reveng tools does not detect this as a one-to-one. it probably could, so add a request/patch to jira."
> The problem I've faced is the following:
> I have two tables, let's say
> - table A with column ID (PK) and other fields
> - table B with column ID (PK) and other fields
> table B has a foreign key constraint against table A, from column ID to column ID (one-to-one)
> When I reverese the tables with the HibernateTools I have such a resultant mapping for table B:
> <class name="B" table="B" schema="SCHEMA">
> <id name="id" type="string">
> <column name="ID" length="12" />
> <generator class="assigned" />
> </id>
> <[b]many-to-one name[/b]="a" class="A" update="false" insert="false" fetch="select">
> <column name="ID" length="12" not-null="true" unique="true" />
> </many-to-one>
> ....
> And this one for table A:
> <class name="A" table="A" schema="SCHEMA">
> <id name="id" type="string">
> <column name="ID" length="12" />
> <generator class="assigned"/>
> </id>
> <set name="b" inverse="true">
> <key>
> <column name="ID" length="12" not-null="true" unique="true" />
> </key>
> <[b]one-to-many[/b] class="B" />
> </set>
> </class>
> while I was expecting something like:
> [i]<one-to-one name="a" class="A" constrained="true"/>[/i]
> in table B, and the same (or nothing) in table A
> Thank you
> Andi
--
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
17 years, 7 months
[Hibernate-JIRA] Created: (EJB-365) Can't execute query
by Radosław Smogura (JIRA)
Can't execute query
-------------------
Key: EJB-365
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-365
Project: Hibernate Entity Manager
Issue Type: Bug
Affects Versions: 3.3.2.GA
Environment: Hibernate 3.2.6
PostrgreSQL 8.0.13
Glassfish
Reporter: Radosław Smogura
Priority: Critical
Execution followed named query with followed entity
@Entity
@NamedQuery(name="Foo.test",
query="SELECT f FROM Foo f WHERE ((:bool IS NULL) OR (f.bool = :bool)) ")
public class Foo implements Serializable{
@Id
int id;
boolean bool;
public boolean isBool() {
return bool;
}
public void setBool(boolean bool) {
this.bool = bool;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}
and parameter bool = null
causes PostgreSQL error ERROR: operator does not exist: boolean = bytea
--
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
17 years, 7 months
[Hibernate-JIRA] Commented: (HHH-1930) QuerySyntaxException "with-clause expressions did not reference from-clause element to which the with-clause was associated"
by Mike Ressler (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1930?page=c... ]
Mike Ressler commented on HHH-1930:
-----------------------------------
Spoke too soon. The generated SQL doesn't include the with clause at all, all my data was messed up:
HQL:
select person, count(data.referenceMe) from model.DataAboutPerson as data right join data.whoImAllAbout as person with (data.referenceMe like 'me%')
SQL:
select person1_.person as col_0_0_, count(dataaboutp0_.referenceme) as col_1_0_, person1_.person as person1_, person1_.name as name1_ from dataaboutperson dataaboutp0_ right outer join people person1_ on dataaboutp0_.person=person1_.person
The ON keyword exists, but the "like 'me%'" information is lost. Looks like I'll need to dig deeper into the SQL generation code to find where the info is lost. The log4j debug logs don't seem to be leading me in any particular direction.
Anyone watching this bug that can point me in the right direction in the SQL generation code? Or anyone that might know the underlying reason why this isn't supported already?
> QuerySyntaxException "with-clause expressions did not reference from-clause element to which the with-clause was associated"
> ----------------------------------------------------------------------------------------------------------------------------
>
> Key: HHH-1930
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1930
> Project: Hibernate Core
> Issue Type: Bug
> Components: query-hql
> Affects Versions: 3.1.3, 3.2.0 cr1, 3.2.0.cr2, 3.2.0.cr3
> Reporter: Manfred Geiler
> Attachments: HibernateTestCase.zip
>
>
> In Version 3.1.2 the following "EventManager" HQL query worked fine:
> select p from Person p join p.emailAddresses as email with email = 'xyz'
> and produced an SQL query like this:
> select person0_.PERSON_ID as PERSON1_2_, person0_.age as age2_, person0_.firstname as firstname2_, person0_.lastname as lastname2_
> from PERSON person0_
> inner join PERSON_EMAIL_ADDR emailaddre1_
> on person0_.PERSON_ID=emailaddre1_.PERSON_ID and (emailaddre1_.EMAIL_ADDR='xyz')
> From Version 3.1.3 on this HQL throws the following QuerySyntaxException:
> "with-clause expressions did not reference from-clause element to which the with-clause was associated"
--
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
17 years, 7 months
[Hibernate-JIRA] Commented: (HHH-1930) QuerySyntaxException "with-clause expressions did not reference from-clause element to which the with-clause was associated"
by Antonio Juarez (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1930?page=c... ]
Antonio Juarez commented on HHH-1930:
-------------------------------------
I don't think we can just comment the lines out - there should be some kind of restriction on this WITH part of the query. It doesn't need to reference the right-hand side, but I believe it should reference either the right-hand or the left-hand side of the query, and that does call for some validation. Maybe the if() condition could be replaced by something like:
if ( referencedFromElement != fromElement && referencedFromElement!=leftHandSideFromElement) {
throw new InvalidWithClausException(......);
}
IMO
> QuerySyntaxException "with-clause expressions did not reference from-clause element to which the with-clause was associated"
> ----------------------------------------------------------------------------------------------------------------------------
>
> Key: HHH-1930
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1930
> Project: Hibernate Core
> Issue Type: Bug
> Components: query-hql
> Affects Versions: 3.1.3, 3.2.0 cr1, 3.2.0.cr2, 3.2.0.cr3
> Reporter: Manfred Geiler
> Attachments: HibernateTestCase.zip
>
>
> In Version 3.1.2 the following "EventManager" HQL query worked fine:
> select p from Person p join p.emailAddresses as email with email = 'xyz'
> and produced an SQL query like this:
> select person0_.PERSON_ID as PERSON1_2_, person0_.age as age2_, person0_.firstname as firstname2_, person0_.lastname as lastname2_
> from PERSON person0_
> inner join PERSON_EMAIL_ADDR emailaddre1_
> on person0_.PERSON_ID=emailaddre1_.PERSON_ID and (emailaddre1_.EMAIL_ADDR='xyz')
> From Version 3.1.3 on this HQL throws the following QuerySyntaxException:
> "with-clause expressions did not reference from-clause element to which the with-clause was associated"
--
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
17 years, 7 months
[Hibernate-JIRA] Commented: (HHH-1930) QuerySyntaxException "with-clause expressions did not reference from-clause element to which the with-clause was associated"
by Mike Ressler (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1930?page=c... ]
Mike Ressler commented on HHH-1930:
-----------------------------------
Commented out HqlSqlWalker.handleWithFragment lines 362-364 in the trunk version this evening and the TestCase passes. Since the version in trunk will change, the three lines I commented out were:
if ( referencedFromElement != fromElement ) {
throw new InvalidWithClauseException( "with-clause expressions did not reference from-clause element to which the with-clause was associated" );
}
If this is an acceptable fix for this bug, I'll create a patch file to apply to trunk. Let me know if you'd like me to do anything else to verify this fix.
Other Notes:
It seems like the with clause should be able to refer to either part of the referenced "from" element. I should be able to limit the sql results based on attributes of either part of a join statement, not just the right hand side of the join. So this begs the question, why is this check necessary?
I'm sure I'm missing something here, any comments would be appreciated.
> QuerySyntaxException "with-clause expressions did not reference from-clause element to which the with-clause was associated"
> ----------------------------------------------------------------------------------------------------------------------------
>
> Key: HHH-1930
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1930
> Project: Hibernate Core
> Issue Type: Bug
> Components: query-hql
> Affects Versions: 3.1.3, 3.2.0 cr1, 3.2.0.cr2, 3.2.0.cr3
> Reporter: Manfred Geiler
> Attachments: HibernateTestCase.zip
>
>
> In Version 3.1.2 the following "EventManager" HQL query worked fine:
> select p from Person p join p.emailAddresses as email with email = 'xyz'
> and produced an SQL query like this:
> select person0_.PERSON_ID as PERSON1_2_, person0_.age as age2_, person0_.firstname as firstname2_, person0_.lastname as lastname2_
> from PERSON person0_
> inner join PERSON_EMAIL_ADDR emailaddre1_
> on person0_.PERSON_ID=emailaddre1_.PERSON_ID and (emailaddre1_.EMAIL_ADDR='xyz')
> From Version 3.1.3 on this HQL throws the following QuerySyntaxException:
> "with-clause expressions did not reference from-clause element to which the with-clause was associated"
--
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
17 years, 7 months
[Hibernate-JIRA] Created: (HHH-3630) When querying for component, Map collections inside components not loaded
by Gino Miceli (JIRA)
When querying for component, Map collections inside components not loaded
--------------------------------------------------------------------------
Key: HHH-3630
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3630
Project: Hibernate Core
Issue Type: Bug
Environment: 3.2.6-GA, Oracle and HSQLDB, JDK 1.5
Reporter: Gino Miceli
Attachments: hibernate-test.zip
Given the following mapping:
<code>
<class name="Car" table="CAR">
<id name="id" column="ID" type="long">
<generator class="native"/>
</id>
<property name="make" column="MAKE"/>
<property name="model" column="MODEL"/>
<component name="engine" class="Engine">
<property name="make" column="ENGINE_MAKE"/>
<property name="model" column="ENGINE_MODEL"/>
<map name="mountParts" table="ENGINE_MOUNT">
<key column="CAR_ID"/>
<map-key column="PART_NAME" type="string" />
<element column="PART" type="string" />
</map>
</component>
</class>
</code>
We are able to get the entire Car object in HQL like so:
<code>
select car from Car car where car.id=1
</code>
This generates the following SQL:
<code>
select
mountparts0_.CAR_ID as CAR1_0_,
mountparts0_.PART as PART0_,
mountparts0_.PART_NAME as PART3_0_
from
ENGINE_MOUNT mountparts0_
where
mountparts0_.CAR_ID=?
</code>
In this case, the map contained in the 'engine' component is loaded correctly. If we query the component property directly, however:
<code>
select car.engine from Car car where car.id=1
</code>
Instances of Engine are returned, however the contained map is null. Looking at the SQL, it appears not attempt is made to load the inner map property:
<code>
select
car0_.ENGINE_MAKE as col_0_0_,
car0_.ENGINE_MODEL as col_0_1_
from
CAR car0_
where
car0_.ID=1
</code>
Anyone?!
--
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
17 years, 7 months