[Hibernate-JIRA] Created: (HSHARDS-57) For a better "virtual shards" support!
by Colbert Philippe (JIRA)
For a better "virtual shards" support!
--------------------------------------
Key: HSHARDS-57
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSHARDS-57
Project: Hibernate Shards
Issue Type: Improvement
Affects Versions: 3.0.0.Beta2
Environment: Windows XP
Reporter: Colbert Philippe
Assignee: Max Ross
The current implementation of virtual shards leaves a lot to be desired when used in big corporate applications.
A better way to model shards, is to identify a virtual shard by a pairing of "some name" + "an index" (example: Clients, 11). The name plays a role similar to namespaces. The index is always zero based and valid only within the namespace. There can be many shard namespaces with unique names. A configuration file (possibly XML) will map each virtual shard to a single physical shard. It's a simple mapping strategy. The mapping can allow overlaps of virtual shards into a single physical shard. This type of naming can make things more clear and easier to manage on the long-run.
The big advantage to virtual shards over physical shards is that virtual shards can be easily persisted to file or database and retrieved again and still remain valid. Any change to the shard structure is fully controlled by the shard configuration file, without modifications to the persisted representation of the shard. This way the code can evolve separately from the physical shard architecture.
With this kind of virtual shard, top-of-tree classes will map to a single shard namespace. The object will reside in any of the virtual shard indexes associated with the shard namespace. The resolution strategy becomes very simple because the set of shard indexes will be returned.
--
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
12 years, 4 months
[Hibernate-JIRA] Created: (HHH-3464) SimpleExpression.ignoreCase uses SQL server lowercase function for left part and JAVA lowercase function for right part of expression
by Vitaliy Tymchyshyn (JIRA)
SimpleExpression.ignoreCase uses SQL server lowercase function for left part and JAVA lowercase function for right part of expression
-------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-3464
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3464
Project: Hibernate3
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.2.6
Environment: tried with PostgreSQL
Reporter: Vitaliy Tymchyshyn
Priority: Minor
When using SimpleExpression.ignoreCase (e.g. Restrictions.eq().ignoreCase, hibernate makes 'lower(field)=?' SQL expression, passing lowercased strings to '?' parameter. This may produce unpredictable results depending on Database server lower implementation and current JAVA locale (see JDK javadoc).
For example, I've tried with '\u0130' character as in JDK JavaDoc.
Postgresql produces:
unhappy=> select lower('İ');
lower
-------
i̇
(1 row)
unhappy=> select char_length(lower('İ'));
char_length
-------------
2
(1 row)
While Java with default locale produces single-character 'i̇'. Of course the restriction will not work - it can not find 'İ' in database.
I'd recommend to use 'lower(field)=lower(?)' to use same lower casing function for both parts of expression.
--
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
12 years, 4 months
[Hibernate-JIRA] Created: (HHH-2808) CLONE -Impossible to define caching for a subclass's collection in hibernate.cgf.xml
by Sebastien Blind (JIRA)
CLONE -Impossible to define caching for a subclass's collection in hibernate.cgf.xml
-------------------------------------------------------------------------------------
Key: HHH-2808
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2808
Project: Hibernate3
Issue Type: Bug
Components: caching (L2)
Affects Versions: 3.2.5
Environment: Hibernate 3.2.5
Sybase
Reporter: Sebastien Blind
Basically, hibernate allows to define <cache usage="transactional"/> inside the subclass mapping, i.e.
<subclass name="SubClass" extends="BaseClass" discriminator-value="xxx">
<bag name="subClassLinks" lazy="false" inverse="true" batch-size="100">
<cache usage="transactional" region="xxx"/>
<key column="xxx" not-null="true"/>
<one-to-many class="xxx"/>
</bag>
<join table="xxx">
</join>
</subclass>
but it's not allowed to do the same using <collection-cache collection="subClass.myCollection" region="xxx" usage="transactional"/>.
It throws:
Exception in thread "main" org.hibernate.MappingException: Cannot cache an unknown collection: subClass.myCollection
at org.hibernate.cfg.Configuration.setCollectionCacheConcurrencyStrategy(Configuration.java:1984)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1568)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1534)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1508)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1428)
--
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
12 years, 4 months
[Hibernate-JIRA] Created: (HHH-2851) ParameterTranslationsImpl fails to correctly determine parameter type
by Alex Savitsky (JIRA)
ParameterTranslationsImpl fails to correctly determine parameter type
---------------------------------------------------------------------
Key: HHH-2851
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2851
Project: Hibernate3
Issue Type: Bug
Components: query-hql
Affects Versions: 3.2.5
Reporter: Alex Savitsky
Priority: Minor
For the conditions in the form "(:param IS NULL OR alias.someField = :param)", the HQL parses would not correctly determine the type of param, unless the conditions are swapped like "(alias.someField = :param OR :param IS NULL)". The reason is that NamedParamTempHolder classes are created for all parameter entries, in the order they appear in the query. The first occurrence (:param IS NULL) would have its expectedType set to null, and the second occurrence would use the param holder created by the first occurrence, without checking whether it can improve it in any way (which it can - the expectedType for second occurrence is correctly determined to be Long).
Proposed fix would be to check for this particular condition, enhancing paramHolder if possible, with new information:
old code:
if ( paramHolder == null ) {
paramHolder = new NamedParamTempHolder();
paramHolder.name = namedSpec.getName();
paramHolder.type = namedSpec.getExpectedType();
namedParameterMap.put( namedSpec.getName(), paramHolder );
}
new code:
if ( paramHolder == null ) {
paramHolder = new NamedParamTempHolder();
paramHolder.name = namedSpec.getName();
paramHolder.type = namedSpec.getExpectedType();
namedParameterMap.put( namedSpec.getName(), paramHolder );
+ } else if (paramHolder.getExpectedType() == null && namedSpec.getExpectedType() != null) {
+ paramHolder.type = namedSpec.getExpectedType();
}
--
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
12 years, 5 months
[Hibernate-JIRA] Created: (HBX-1123) Reveng foreign-key map to non-primary key column produces incorrect mapping file
by Michael Sabin (JIRA)
Reveng foreign-key map to non-primary key column produces incorrect mapping file
--------------------------------------------------------------------------------
Key: HBX-1123
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1123
Project: Hibernate Tools
Issue Type: Bug
Affects Versions: 3.2.4 Beta1
Environment: Eclipse Platform
Version: 3.4.2
Build id: M20090211-1700
Hibernate Tools 3.2.4.GA-R200903141626-H5
Windows XP Pro SP3
JRE 6
Tested on Oracle 10g and Apache Derby
Reporter: Michael Sabin
Priority: Minor
Attachments: CodeGenCfg1.png, CodeGenCfg2.png
Creating a mapping from a column in one table to a non-primary key column in another table produces incorrect mapping file missing a property-ref to the non-primary key.
How to reproduce using Apache Derby:
Create a database and connect to the database.
jdbc:derby://localhost:1527/myDB;create=true;user=me;password=mine
Create these tables in the myDB database, in the ME schema.
create table vehicles (
make_id integer,
model_id integer,
name varchar(50),
PRIMARY KEY (make_id, model_id)
);
create table owners (
owner_id integer PRIMARY KEY,
favorite_make_id integer,
name varchar(20)
);
-- optional content
insert into vehicles values (1, 10, 'Chevrolet Corvette');
insert into vehicles values (2, 11, 'Ford Focus');
insert into vehicles values (3, 12, 'Honda Accord');
insert into vehicles values (4, 13, 'Toyota Camry');
insert into owners values (50, 3, 'Jim');
insert into owners values (51, 1, 'Alex');
insert into owners values (52, 4, 'Sue');
insert into owners values (53, 1, 'Casey');
Create this Hibernate Configuration file.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">org.apache.derby.jdbc.EmbeddedDriver</property>
<property name="hibernate.connection.url">jdbc:derby://localhost:1527/myDB</property>
<property name="hibernate.connection.username">me</property>
<property name="hibernate.connection.password">mine</property>
<property name="hibernate.dialect">org.hibernate.dialect.DerbyDialect</property>
<property name="hibernate.current_session_context_class">thread</property>
<property name="hibernate.default_schema">ME</property>
<property name="hibernate.show_sql">true</property>
</session-factory>
</hibernate-configuration>
Setup a Hibernate Console Configuration with the configuration above and connection to the Derby database.
Create this Hibernate reverse engineering configuration
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >
<hibernate-reverse-engineering>
<table-filter match-name="OWNERS"/>
<table-filter match-name="VEHICLES"/>
<table name="VEHICLES">
<foreign-key foreign-table="OWNERS">
<column-ref local-column="MAKE_ID" foreign-column="FAVORITE_MAKE_ID" />
</foreign-key>
</table>
</hibernate-reverse-engineering>
Setup a Hibernate Code Generation configuration like in the attached images.
Running the Code Generation configuration will produce this Vehicles.hbm.xml mapping file.
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="reveng.Vehicles" table="VEHICLES">
<composite-id name="id" class="reveng.VehiclesId">
<key-property name="makeId" type="int">
<column name="MAKE_ID" />
</key-property>
<key-property name="modelId" type="int">
<column name="MODEL_ID" />
</key-property>
</composite-id>
<many-to-one name="owners" class="reveng.Owners" update="false" insert="false" fetch="select">
<column name="MAKE_ID" not-null="true" />
</many-to-one>
<property name="name" type="string">
<column name="NAME" length="50" />
</property>
</class>
</hibernate-mapping>
The many-to-one tag should have this additional attribute: property-ref="favoriteMakeId"
--
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
12 years, 5 months
[Hibernate-JIRA] Created: (ANN-625) @OrderBy usage on a joined classes (when using join table) produces incorred SQL syntax.
by Dima Gutzeit (JIRA)
@OrderBy usage on a joined classes (when using join table) produces incorred SQL syntax.
----------------------------------------------------------------------------------------
Key: ANN-625
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-625
Project: Hibernate Annotations
Issue Type: Bug
Affects Versions: 3.3.0.ga
Reporter: Dima Gutzeit
Please consider the following mapping :
@ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE}, fetch = FetchType.LAZY)
@IndexColumn(name = "ListIndex")
@JoinTable(name = "odp_rulemanipulatorjoin", joinColumns = @JoinColumn(name = "RoutingRuleId"), inverseJoinColumns = @JoinColumn(name = "ManipulatorComponentId"))
@OrderBy(value = "priority asc")
public List<RoutingManipulationComponent> getManipulators() {
if (manipulators == null) {
manipulators = new ArrayList<RoutingManipulationComponent>();
}
return manipulators;
}
***********************************
@Entity(name = "RoutingManipulationComponent")
@DiscriminatorValue("RoutingManipulationComponent")
public abstract class RoutingManipulationComponent extends RoutingComponent implements Initializable {
/**
* Applies the manipulation to the given context.
*
* @param context the routing context to manipulate
* @return true if any manipulation was applied, false if no manipulation
* occurred
*/
public abstract boolean apply(RoutingContext context);
}
******************************************
@Entity(name = "RoutingComponent")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "RoutingComponentType", discriminatorType = DiscriminatorType.STRING)
@DiscriminatorValue("RoutingComponent")
@Table(name = "odp_routingcomponent")
public abstract class RoutingComponent extends DialPlanProvisionalEntity {
@Deprecated
public RoutingComponent() {
// blank
}
/**
* @param name
* @param description
*/
public RoutingComponent(String name, String description) {
super(name, description);
}
}
*******************************
@MappedSuperclass
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public abstract class DialPlanProvisionalEntity extends ProvisionalEntity
implements Initializable {
private Long entityId;
private boolean visible = true;
private int priority;
/**
* Not for direct instantiation - this constructor also serves as public
* constructor for hibernate, jax-ws etc. <br>
*/
@Deprecated
public DialPlanProvisionalEntity() {
this("(no name set)", "(no description set)");
}
/**
* @param name
* @param description
*/
public DialPlanProvisionalEntity(String name, String description) {
creationDate = GregorianCalendar.getInstance(); // now
}
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Override
public Long getId() {
return entityId;
}
@Override
public void setId(Long ruleCollectionId) {
this.entityId = ruleCollectionId;
}
/**
* @return Returns the priority.
*/
public int getPriority() {
return priority;
}
/**
* @param priority The priority to set.
*/
public void setPriority(int priority) {
this.priority = priority;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) {
return false;
}
final ProvisionalEntity other = (ProvisionalEntity) o;
return MiscUtils.equalOrBothNull(this.getName(), other.getName());
}
@Override
public int hashCode() {
String name = this.getName();
return getClass().getName().hashCode() + 13 * name.hashCode();
}
}
The above mapping should use the "priority" field to the ordering.
SQL that is produced is :
select criteria0_.RoutingRuleId as RoutingR1_1_, criteria0_.CriteriaComponentId as Criteria2_1_,
criteria0_.ListIndex as ListIndex1_,
routingcri1_.id as id73_0_,
routingcri1_.creationDate as creation3_73_0_,
routingcri1_.description as descript4_73_0_,
routingcri1_.lastModificationDate as lastModi5_73_0_,
routingcri1_.name as name73_0_,
routingcri1_.predefined as predefined73_0_,
routingcri1_.status as status73_0_,
routingcri1_.priority as priority73_0_,
routingcri1_.visible as visible73_0_,
routingcri1_.matcher_id as matcher25_73_0_,
routingcri1_.criterion_id as criterion27_73_0_,
routingcri1_.location_id aslocation26_73_0_,
routingcri1_.RoutingComponentType as RoutingC1_73_0_
from odp_rulecriteriajoin criteria0_
left outer join odp_routingcomponent as routingcri1_ on criteria0_.CriteriaComponentId=routingcri1_.id
where criteria0_.RoutingRuleId=1 order by odp_routingcomponent .priority asc
It is wrong since not the table alias is used in the order by clause, but the real table name.
Mysql fails with exception that odp_rulecriteriajoin.priority is unknown table.
Changing the query to include "order by criteria0_.priority asc" returns the correct result.
--
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
12 years, 5 months
[Hibernate-JIRA] Created: (HHH-2158) incorrect hql query on one-to-one with property-ref
by Sebastien Cesbron (JIRA)
incorrect hql query on one-to-one with property-ref
----------------------------------------------------
Key: HHH-2158
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2158
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.0.ga
Environment: hibernate 3.2.0.ga with firebird 1.5.3 and jaybird 1.5.5 driver on windows XP
Reporter: Sebastien Cesbron
Attachments: testhib.zip
I have a one-to-one relationship with property-ref between Master and Slave2.
I want to find all Master instances that have a null Slave2 instance associated.
To do so my query is
select master from Master master where master.slave2 is null
The sql generated is
select master0_.oid as oid0_, master0_.libelle as libelle0_ from Master master0_ where master0_.oid is null
which seems incorrect. It checks here Master instances with null id (config files are listed below).
If I do my query like this
select master from Master master where master.slave2.oid is null
the generated sql is ok :
select master0_.oid as oid0_, master0_.libelle as libelle0_ from Master master0_, Slave2 slave2x1_ where master0_.oid=slave2x1_.myMaster and (slave2x1_.oid is null)
I have attached a small eclipse project that reproduces the problem
This problem may-be related to the one I have submitted as issue HHH-1849
--
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
12 years, 5 months
[Hibernate-JIRA] Created: (HBX-948) org.hibernate.connection.DriverManagerConnectionProvider - problem closing pooled connection
by Sathish P (JIRA)
org.hibernate.connection.DriverManagerConnectionProvider - problem closing pooled connection
--------------------------------------------------------------------------------------------
Key: HBX-948
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-948
Project: Hibernate Tools
Issue Type: Bug
Components: consoleconfiguration
Affects Versions: 3.1.beta5
Environment: Eclipse
Reporter: Sathish P
WARN Finalizer org.hibernate.connection.DriverManagerConnectionProvider - problem closing pooled connection
java.sql.SQLException: Io exception: Socket closed
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255)
at oracle.jdbc.driver.T4CConnection.logoff(T4CConnection.java:481)
at oracle.jdbc.driver.PhysicalConnection.close(PhysicalConnection.java:1203)
at org.hibernate.connection.DriverManagerConnectionProvider.close(DriverManagerConnectionProvider.java:152)
at org.hibernate.connection.DriverManagerConnectionProvider.finalize(DriverManagerConnectionProvider.java:142)
at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
at java.lang.ref.Finalizer.runFinalizer(Unknown Source)
at java.lang.ref.Finalizer.access$100(Unknown Source)
at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 5 months
[Hibernate-JIRA] Created: (HHH-2666) subselect fetching ignores max results
by James Roper (JIRA)
subselect fetching ignores max results
--------------------------------------
Key: HHH-2666
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2666
Project: Hibernate3
Issue Type: Improvement
Components: query-hql, query-sql
Affects Versions: 3.2.1
Environment: Hibernate 3.2.1
HSQLDB 8.0
Reporter: James Roper
Priority: Minor
When maxResults is set for a query, the hibernate subselect fetching strategy ignores it. For example, I have a class entry, that has a list of comments, which are configured to use the subselect fetching strategy. You can see that in the original query, only the top ? results are fetched:
select
top ? entry0_.id as id0_,
entry0_.title as title0_,
entry0_.entry as entry0_,
entry0_.time as time0_,
entry0_.category_id as category5_0_
from
Entry entry0_
order by
entry0_.time desc
But then when it does the sub select query to lazily load the comments, this is the query it runs:
select
comments0_.entry_id as entry5_1_,
comments0_.id as id1_,
comments0_.id as id1_0_,
comments0_.time as time1_0_,
comments0_.comment as comment1_0_,
comments0_.author as author1_0_
from
Comment comments0_
where
comments0_.entry_id in (
select
entry0_.id
from
Entry entry0_
)
order by
comments0_.time desc
So, it loads every single comment in the database, even though only the comments for the top ? entries are needed. Of course, if there was no order by clause on the first query, the sub select may not return the same results, so it should probably only do this when there is an order by clause in the first query, and it should make sure it includes the order by clause in the sub select.
--
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
12 years, 5 months