[Hibernate-JIRA] Commented: (HHH-879) Enable joining the same association twice with Criteria
by Tsuyoshi Goto (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-879?page=co... ]
Tsuyoshi Goto commented on HHH-879:
-----------------------------------
Hello Ali,
I am trying to apply your suggestion but I can not see how this exception thrown form CriteriaQueryTranslator#createAssociationPathCriteriaMap is avoided.
Do you mean I should somehow extends CriteriaQueryTranslator and not to call createAssociationPathCriteriaMap from the constructor also? (Because I don't see JoinWalker.isDuplicateAssociation method is called in the trace bellow)
I am taking about org.hibernate.QueryException: duplicate association path: impactImperatives
at org.hibernate.loader.criteria.CriteriaQueryTranslator.createAssociationPathCriteriaMap(CriteriaQueryTranslator.java:141)
at org.hibernate.loader.criteria.CriteriaQueryTranslator.<init>(CriteriaQueryTranslator.java:80)
at org.hibernate.loader.criteria.CriteriaLoader.<init>(CriteriaLoader.java:58)
(using Hibernate3.1.3)
Or are you guys taking about a different thing?
BTW, I could make an external Util method that can retrieve the Subcriteria for the same path for the duplicated path and it was working fine. But this time I faced the situation that requires the duplicated path Subcriteria with a different 'alias'.
Best Regards,
Tsuyoshi
> Enable joining the same association twice with Criteria
> -------------------------------------------------------
>
> Key: HHH-879
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-879
> Project: Hibernate3
> Issue Type: Improvement
> Components: core
> Reporter: Vladimir Bayanov
>
> Make double joining the same association with Criteria.createCriteria possible. See: http://forum.hibernate.org/viewtopic.php?t=931249
--
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, 6 months
[Hibernate-JIRA] Commented: (HBX-276) Generating data for small and large scale testing
by Diego Pires Plentz (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-276?page=co... ]
Diego Pires Plentz commented on HBX-276:
----------------------------------------
Christian, it looks like a HBX-215 dup ;-)
> Generating data for small and large scale testing
> -------------------------------------------------
>
> Key: HBX-276
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-276
> Project: Hibernate Tools
> Issue Type: Improvement
> Components: datagen
> Reporter: Christian Bauer
>
> This is a placeholder item for the data generator kick off. It contains all information available at start.
> Intro
> Overall goal is to provide a library that allows to programmatically (!):
> - mass generation of sample objects filled with sample data
> - objects can be
> o JavaBeans style POJOs
> o Table rows
> - Generated objects are linked together as needed (associations, foreign keys)
> - Generation of sample data can be configured, controlled or customized (custom implementations)
> Modules
> The library is split into two separate Modules
> - Data generation (values)
> - Object/object graph creation (graphs)
> Data generation is completely independent of the object/object graph creation.
> Data Generation
> - Definition of "random" to be used during generation
> o Guaranteed random
> o Pseudo-random with random seed
> o Pseudo-random with provided seed (programmatically reproducible)
> o Advanced: statistical randomness: gauss, peaks ...
> - General settings applied to all value generators
> o Duplicates allowed (max number of duplicates)
> o NULL values allowed (min/max absolute number, percentage)
> - Generation of string based values
> o Random filled strings
> - Min length
> - Max length
> - Upper/lower case configuration (1st upper/lower, rest via the defined character set...)
> - Character set to be used (lots of predefined...)
> - Empty Strings allowed (in addition to min length property)
> o Human readable sentences (e.g. "greeked" text, like lore ipsum...)
> - Min length/Min num of words
> - Max length/Max num of words
> - Word repository to use (built-in or custom)
> o Names
> - Min length/Min num of words
> - Max length/Max num of words
> - Name type (first name, last name, computer usernames)
> o File names
> - Max length
> - Name
> - Extension (fixed, set of predefined, custom list)
> o String concatenations (combination of string generators and fixed text)
> - Generation of numeric values
> o Precision of the results
> o High value (including/excluding this value)
> o Low value (including/excluding this value)
> o Multiple hi/lo ranges
> o Zeros allowed
> o Sequences (g(n+1) OP g(n)+x; OP element of{<,>} and x any value)
> - Generation of date and time value
> o Min date value (absolute, for day, month and/or year)
> o Max date value (absolute, for day, month and/or year)
> o Min time value (absolute, for hour, minute and/or second)
> o Max time value (absolute, for hour, minute and/or second)
> o Allowed day of week
> o Excluded days (predefined set of typical excludes, like Christmas (fix) dynamic (eastern))
> - Binary
> o Min number of bytes
> o Max number of bytes
> o Binary type (set of predefined: gif, jpeg, etc.)
> o Custom set of physical binary files to be used
> - Special Types
> o Boolean
> o Currency values
> o UUIDs (probably realizable with string generator)
> o Lists/sets/bags of generated values
> - Combination of generators
> - Collection type to be used
> Output formatter
> For each generated type there can be various output formatters that convert the type into the needed format.
> - Various numeric formats (BigDecimal, int, long, float, double, etc.)
> - Various date formats
> - Streams
> Output postModifier
> For each generator there can be a custom handler that can execute some custom operations on the generated output, before processing the output formatter.
> Dependent Generation
> Some generators might need the value of other properties of an object to generate a meaningful output. So there is a way to provide a corresponding context for these generators. Context could be:
> - previously generated value(s) of this generator (value repeater, no duplicates in the last n runs, city/zip/country code generation)
> - other generated values (or in general: other properties) for the object they are filled in (note that generators do not know the meaning of an object, since their context is "value generation")
--
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, 6 months
[Hibernate-JIRA] Created: (HHH-2901) Repeating method declaration in interface hierarchy causes faulty method lookup in proxies
by Wouter Lievens (JIRA)
Repeating method declaration in interface hierarchy causes faulty method lookup in proxies
------------------------------------------------------------------------------------------
Key: HHH-2901
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2901
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.5
Environment: Hibernate 3.2.5
DBMS: MySQL (probably irrelevant)
Reporter: Wouter Lievens
Consider the following two interfaces
interface A
{
public abstract void b();
}
interface B extends A
{
public abstract void b();
}
Note that B repeats the definition of "b", which is perfectly legal java code.
Now consider these two classes:
abstract class AImpl implements A
{
}
public class BImpl extends AImpl implements B
{
public final void b()
{
// implementation is irrelevant
}
}
Now consider that mappings have been created where interfaces A and B are given as the "proxy" type for mapped entity types AImpl and BImpl, respectively, and that the BImpl mapping "extends" the AImpl mapping.
Now, when an object is loaded by refering to the base type (AImpl), then invocations of the method "b" will raise the following exception:
java.lang.IllegalArgumentException: object is not an instance of declaring class
A short time spent debugging suggested to me that the method that the proxy (a proxy for A, not B!) selected to delegate the call to the "wrong" method somehow, causing this error. The problem can be remedied by removing the declaration for "b" in the B interface.
So, there is a workaround: don't repeat declarations. But still I would prefer to see this issue solved.
--
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, 6 months
[Hibernate-JIRA] Created: (HBX-733) Updated DAO code generation as discussed over the email
by Alex Kalinovsky (JIRA)
Updated DAO code generation as discussed over the email
-------------------------------------------------------
Key: HBX-733
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-733
Project: Hibernate Tools
Type: Patch
Components: hbm2java, ant
Versions: 3.1alpha5
Environment: I have tested the patch on the latest version of Hibernate Tools I got from SVN 2 weeks ago.
Reporter: Alex Kalinovsky
Attachments: dao_generation.patch
This should be a complete implementation of DAO generation according to the design we have discussed over the email. I've tested this on our project so the DAOs should be good to go, but of course a more diverse testing would be needed before releasing it to public. I'm open for recommendations and suggestions, so I see this as the first draft. Below is a list of files and comments. Contact me at kalinovsky(a)yahoo.com.
src/java/org/hibernate/tool/hbm2x
DAONewExporter.java This class is coded mainly to accept additional parameters such as dao package name and provide flexible
file naming that is used by Ant task. It would not be needed if I integrate my changes into GenericExporter.
src/templates/dao
crudDao.ftl template for regeneratable CRUD interface
crudDaoImpl.ftl template for regeneratable CRUD DAO implementation
dao.ftl template for customizable DAO interface that extends CRUD interface
daoImpl.ftl template for customizable DAO implementation that extends CRUD implementation
src/templates/dao/base
dao.ftl base interface for all DAOs
queryDao.ftl base interface for all read-only entities
crudDao.ftl base interface for all editable entities
src/templates/dao/base/hibernate
abstractDao.ftl base implementation of DAO using Hibernate
abstractQueryDao.ftl base implementation of DAO for read-only entities using Hibernate
abstractCrudDao.ftl base implementation of DAO for editable entities using Hibernate
src/testsupport
codegen.properties Test configuration to see DAO generation in action
codegen-build.xml Test build file that generates DAOs for Author and Article and compiles generated code
--
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, 6 months
[Hibernate-JIRA] Created: (HHH-2833) NullPointerException in insert-select query
by John Mazzitelli (JIRA)
NullPointerException in insert-select query
-------------------------------------------
Key: HHH-2833
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2833
Project: Hibernate3
Issue Type: Bug
Components: query-hql
Affects Versions: 3.2.3
Reporter: John Mazzitelli
I'm getting the following NPE when I convert a valid SELECT query into an INSERT SELECT query.
Here's the stack:
==================================================
Caused by: java.lang.NullPointerException
at org.hibernate.hql.ast.HqlSqlWalker.createFromJoinElement(HqlSqlWalker.java:310)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.joinElement(HqlSqlBaseWalker.java:3275)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3067)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2945)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:544)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.insertStatement(HqlSqlBaseWalker.java:482)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:253)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:92)
at org.jboss.ejb3.entity.TransactionScopedEntityManager.createQuery(TransactionScopedEntityManager.java:127)
at org.jboss.on.domain.util.PersistenceUtility.createInsertSelectQuery(PersistenceUtility.java:225)
at org.jboss.on.server.measurement.MeasurementBaselineManagerBean.calculateAutoBaselines(MeasurementBaselineManagerBean.java:80)
... 60 more
==================================================
I first start out with this valid SELECT query (I can run this in the Hibernate Tools in Eclipse - it works and returns valid data as expected):
----------
SELECT
min(d.min) AS baselineMin,
max(d.max) AS baselineMax,
avg(d.value) AS baselineMean,
CURRENT_TIMESTAMP AS computeTime,
d.id.scheduleId AS scheduleId
FROM
MeasurementDataNumeric1H d
JOIN
d.schedule s
LEFT JOIN
s.baseline b
WHERE
b.id IS NULL
AND d.id.timestamp BETWEEN :startTime AND :endTime
GROUP BY
d.id.scheduleId
HAVING
d.id.scheduleId IN (
SELECT
d1.id.scheduleId
FROM
MeasurementDataNumeric1H d1
WHERE
d1.id.timestamp <= :startTime
)
----------
Here is what the Hibernate Tools Dynamic SQL Preview view shows me is the actual, generated SQL:
----------
select
min(measuremen0_.minvalue) as col_0_0_,
max(measuremen0_.maxvalue) as col_1_0_,
avg(measuremen0_.value) as col_2_0_,
CURRENT_TIMESTAMP as col_3_0_,
measuremen0_.SCHEDULE_ID as col_4_0_
from
public.ON_MEASUREMENT_DATA_NUM_1H measuremen0_
inner join
public.ON_MEASUREMENT_SCHEDULE measuremen1_
on measuremen0_.SCHEDULE_ID=measuremen1_.id
left outer join
public.ON_MEASUREMENT_BASELINE measuremen2_
on measuremen1_.id=measuremen2_.SCHEDULE_ID
where
(
measuremen2_.id is null
)
and (
measuremen0_.TIME_STAMP between ? and ?
)
group by
measuremen0_.SCHEDULE_ID
having
measuremen0_.SCHEDULE_ID in (
select
measuremen3_.SCHEDULE_ID
from
public.ON_MEASUREMENT_DATA_NUM_1H measuremen3_
where
measuremen3_.TIME_STAMP<=?
)
----------
Now that I can see this works, I simply add this line to the beginning of that SELECT query:
----------
INSERT INTO MeasurementBaseline (baselineMin,baselineMax,baselineMean,computeTime,scheduleId)
----------
Here is what the Hibernate Tools Dynamic SQL Preview view shows me is the actual, generated SQL:
----------
insert
into
public.ON_MEASUREMENT_BASELINE
( id, BL_MIN, BL_MAX, BL_MEAN, BL_COMPUTE_TIME, SCHEDULE_ID )
select
nextval ('public.ON_MEASUREMENT_BASELINE_ID_SEQ'),
min(measuremen0_.minvalue) as col_0_0_,
max(measuremen0_.maxvalue) as col_1_0_,
avg(measuremen0_.value) as col_2_0_,
CURRENT_TIMESTAMP as col_3_0_,
measuremen0_.SCHEDULE_ID as col_4_0_
from
public.ON_MEASUREMENT_DATA_NUM_1H measuremen0_
inner join
public.ON_MEASUREMENT_SCHEDULE measuremen1_
on measuremen0_.SCHEDULE_ID=measuremen1_.id
left outer join
public.ON_MEASUREMENT_BASELINE measuremen2_
on measuremen1_.id=measuremen2_.SCHEDULE_ID
where
(
measuremen2_.id is null
)
and (
measuremen0_.TIME_STAMP between ? and ?
)
group by
measuremen0_.SCHEDULE_ID
having
measuremen0_.SCHEDULE_ID in (
select
measuremen3_.SCHEDULE_ID
from
public.ON_MEASUREMENT_DATA_NUM_1H measuremen3_
where
measuremen3_.TIME_STAMP<=?
)
----------
If I were to pass in the HQL (the INSERT INTO...SELECT) via:
entityManager.createQuery("INSERT INTO...SELECT...and the rest...")
I get the NPE.
--
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, 6 months