[Hibernate-JIRA] Created: (HHH-3216) Incorrect parse result in ParameterParser
by alexandia (JIRA)
Incorrect parse result in ParameterParser
-----------------------------------------
Key: HHH-3216
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3216
Project: Hibernate3
Issue Type: Bug
Components: query-hql
Affects Versions: 3.2.6
Environment: Hibernate 3.1.0, 3.2.6
Any type of database
Reporter: alexandia
A very simple hql will cause the ParameterMetadata.getOrdinalParameterDescriptor() method throw this Exception:
"Remember that ordinal parameters are 1-based!"
HQL:
from User u where u.userName = ? and u.userType = 'call'
The reason is found out to be this: ParameterParser.java
public static void parse(String sqlString, Recognizer recognizer) throws QueryException {
boolean hasMainOutputParameter = sqlString.indexOf( "call" ) > 0 &&
sqlString.indexOf( "?" ) < sqlString.indexOf( "call" ) &&
sqlString.indexOf( "=" ) < sqlString.indexOf( "call" );
The hql above match these conditions, so the hasMainOutputParameter is set to true.
Thus the first normal ordinal parameter is bypassed, exception is thrown.
Suggestion: Strenthen the checking of the hasMainOutputParameter.
--
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
16 years, 4 months
[Hibernate-JIRA] Commented: (ANN-141) Add annotation support for UserCollectionType
by Endre Jeges (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-141?page=co... ]
Endre Jeges commented on ANN-141:
---------------------------------
I was thinking about the last post in this issue.
I have just bumped in the same issue that I could not create an easy to use solution to persist a bitemporal collection (something like this: http://martinfowler.com/ap2/temporalProperty.html). It is a returning problem in my domain, that is why I needed a uniform solution for it.
If I would be forced to define the base collection type of my custom collection I would be in trouble since none of the standard collections (set, list, map, bag) would be appropriate. The bitemporal collection has record and actual time interval as "indices", but it is surely not an other implementation of any standard collection.
Therefore I would give a vote to the solution that Douglas.
> 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
16 years, 4 months
[Hibernate-JIRA] Created: (ANN-774) Querying a @OneToOne to an entity that inherit a @MappedSuperclass, the @DiscriminatorValue isn't used
by Diego Plentz (JIRA)
Querying a @OneToOne to an entity that inherit a @MappedSuperclass, the @DiscriminatorValue isn't used
------------------------------------------------------------------------------------------------------
Key: ANN-774
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-774
Project: Hibernate Annotations
Issue Type: Bug
Components: binder
Affects Versions: 3.4.0.GA
Reporter: Diego Plentz
Priority: Critical
If you have a class with a @OneToOne relation to an entity that inherit a @MappedSuperclass, and you do a query like the following, the @DiscriminatorValue isn't used if it's mapped eagerly.
Criteria c = getSession().createCriteria(Foo.class)
.createAlias("relatedOneToOne", "relatedOneToOne");
-----
@Entity
public class Foo {
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "cdfoo")
private RelatedOneToOne relatedOneToOne;
...
}
-----
@Entity
@Table(name = "bar")
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(
name="cddiscriminator",
discriminatorType=DiscriminatorType.INTEGER)
public class Father {
..
}
-----
@Entity
@DiscriminatorValue("3")
public class RelatedOneToOne extends Father {
...
}
If you let the association to load "lazyly", it works and the DiscriminatorValue is used in the generated sql.
--
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
16 years, 4 months
[Hibernate-JIRA] Created: (HHH-3482) UnsupportedOperationException with StatelessSession
by Adrien (JIRA)
UnsupportedOperationException with StatelessSession
---------------------------------------------------
Key: HHH-3482
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3482
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.0.GA
Environment: Linux, Hsql
Reporter: Adrien
Attachments: timestampStateless.zip
When using a StatelessSession and saving a ManyToOne, we have an UnsupportedOperationException because of a call to getTimestamp() on the StatelessSession. May be the AbstractEntityPersister.isTransient() should always return null when dealing with a StatelessSession, since everything is transient in this case.
StatelessSession s = getSessions().openStatelessSession();
s.beginTransaction();
Person p = new Person( new Long(1), "steve", 123 );
s.insert(p);
Order o = new Order( new Long(1), p );
s.insert(o); // --> UnsupportedOperationException
java.lang.UnsupportedOperationException
at org.hibernate.impl.StatelessSessionImpl.getTimestamp(StatelessSessionImpl.java:435)
at org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:3422)
at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:204)
at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:241)
at org.hibernate.type.EntityType.getIdentifier(EntityType.java:430)
at org.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:102)
at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2045)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2291)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2708)
at org.hibernate.impl.StatelessSessionImpl.insert(StatelessSessionImpl.java:117)
at org.hibernate.impl.StatelessSessionImpl.insert(StatelessSessionImpl.java:99)
at org.hibernate.test.timestampStateless.TimeStampProbTest.testTimeStampTest(TimeStampProbTest.java:28)
You may see the joined test case.
I found a old post on the forum with the same problem :
http://forum.hibernate.org/viewtopic.php?p=2304937&sid=03c689ec5b12eebd8b...
I hope this will help.
--
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
16 years, 4 months
[Hibernate-JIRA] Commented: (HHH-1675) identity generators withy Postgres 8
by Jerry Shea (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1675?page=c... ]
Jerry Shea commented on HHH-1675:
---------------------------------
Postgres has a nice feature to get the generated identity number in the same SQL as the insert clause: INSERT xxxx RETURNING id_column; See http://www.postgresql.org/docs/faqs.FAQ.html#item4.11.1
I've had a look at the PostgresSQLDialect but I can't work out how to generate this SQL from the appendIdentitySelectToInsert(String insertSQL) method - can anyone give me any guidance as to how I can determine the name of the identity column? Thx
> identity generators withy Postgres 8
> ------------------------------------
>
> Key: HHH-1675
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1675
> Project: Hibernate Core
> Issue Type: Improvement
> Components: core, documentation
> Affects Versions: 3.1
> Environment: Hibernate 3 and Postgres 8, linux
> Reporter: Robin Demetriades
> Original Estimate: 0 minutes
> Remaining Estimate: 0 minutes
>
> I have recently noticed that specifying a generator class = "identity" actually works
> in Postgres as well when the Primary key is of type SERIAL. This however is not reflected in the
> documentation and indeed may just be a happy coincidence rather than by design.
> My improvement request is that this feature be maintained, and even if possible the use of
> the Postgres DEFAULT keyword used as a generator class in the hibernate-mapping XML.
> This undocumented feature has the advantage of skipping an extra database call (as opposed to when generator="sequence") and allowing me to have a unique sequence per table if I so wish so I would be sorry to see it lost as the codebase progresses.
> Rgds,
> Robin Demetriades
--
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
16 years, 4 months
[Hibernate-JIRA] Updated: (HBX-524) Reverse of one-to-one relationships
by Anthony Patricio (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-524?page=co... ]
Anthony Patricio updated HBX-524:
---------------------------------
Attachment: HBX-524v2.patch
DTD updated,
unit tests updates
names in OverrideRepository more precise.
> 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
> Attachments: HBX-524.patch, HBX-524v2.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
16 years, 4 months
[Hibernate-JIRA] Created: (HHH-2984) Hibernate generates invalid query when using order by through a one-to-one relation, error is "for SELECT DISTINCT, ORDER BY expressions must appear in select list"
by Dobes Vandermeer (JIRA)
Hibernate generates invalid query when using order by through a one-to-one relation, error is "for SELECT DISTINCT, ORDER BY expressions must appear in select list"
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-2984
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2984
Project: Hibernate3
Issue Type: Improvement
Affects Versions: 3.2.5
Environment: PostgresQL 8.2 and glassfish running in Windows XP Professional
Reporter: Dobes Vandermeer
For this query:
select distinct object(b) from Business b where exists (select bur from BusinessUserRole bur where bur.user = :user and bur.business = b) order by b.contactInformation.name ASC
The following SQL is generated:
Hibernate: select distinct business0_.id as id114_, business0_.contactInformation_id as contactI3_114_, business0_.currency_id as currency2_114_ from Business business0_, ContactInformation contactinf2_ where business0_.contactInformation_id=contactinf2_.id and (exists (select businessus1_.id from BusinessUserRole businessus1_ where businessus1_.user_id=? and businessus1_.business_id=business0_.id)) order by contactinf2_.name ASC limit ?
This causes PostgreSQL to issue the error :
for SELECT DISTINCT, ORDER BY expressions must appear in select list
I can see quite clearly that it is correct that contactinf2_.name does not appear in the select list.
I suppose if the query were not using distinct, this issue would not occur. As a workaround, I can sort the results manually.
--
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
16 years, 4 months
[Hibernate-JIRA] Created: (HSEARCH-237) IdHashShardingStrategy fails after 1.7M id is generated
by Rafal Glowacz (JIRA)
IdHashShardingStrategy fails after 1.7M id is generated
-------------------------------------------------------
Key: HSEARCH-237
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-237
Project: Hibernate Search
Issue Type: Bug
Affects Versions: 3.0.0.GA
Reporter: Rafal Glowacz
public class IdShardingStrategyTest extends TestCase
{
private IdHashShardingStrategy _defaultIdStrategy;
private IdShardingStrategy _idStrategy;
protected void setUp() throws Exception {
_idStrategy = new IdShardingStrategy();
_idStrategy.initialize(null, createDirectoryProviders());
_defaultIdStrategy = new IdHashShardingStrategy();
_defaultIdStrategy.initialize(null, createDirectoryProviders());
}
private DirectoryProvider[] createDirectoryProviders() {
return new DirectoryProvider[]{new MockDirectoryProvider(),
new MockDirectoryProvider(),
new MockDirectoryProvider()};
}
public void testIdSharding() {
long id = 1;
long limit = 1000 * 1000000 * 1000000L;
try {
while (id < limit) {
generateForAddition(_idStrategy, id);
generateForDeletion(_idStrategy, id);
id += 129653153;
}
} catch (Exception e) {
fail("Couldn't get directory for id " + id);
}
}
public void testIdHashSharding() {
long id = 1;
long limit = 1000 * 1000000 * 1000000L;
try {
while (id < limit) {
generateForAddition(_defaultIdStrategy, id);
generateForDeletion(_defaultIdStrategy, id);
id += 129653153;
}
fail("Should fail with ArrayIndexOutOfBoundsException for long id");
} catch (Exception e) {
}
}
private MockDirectoryProvider generateForAddition(IndexShardingStrategy strategy, long id) {
return (MockDirectoryProvider) strategy.getDirectoryProviderForAddition(null, id, id + "", null);
}
private DirectoryProvider[] generateForDeletion(IndexShardingStrategy strategy, long id) {
return strategy.getDirectoryProvidersForDeletion(null, id, id + "");
}
}
Workaround:
Returned value is minus for id's bigger then 1.7M so for time being I added check like: return value < 0 ? -1 * value : value; Works fine for me.
--
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
16 years, 4 months