Hani, here are the patches. Re: Where to upload patches?

Konstantin Priblouda <[email protected]>
Newsgroups gmane.comp.java.open-symphony.devel
Message-ID <[email protected]>
--- Hani Suleiman <[email protected]> wrote:
> You should be able to add attachments to jira issues
> ( just double  
> checked, and all users have add attachment
> permission). If you still  
> have problems with that then email the list (if
> they're not too big)  
> and someone (likely, me!) will review/commit them.

You asked for them ( they are for PS-39 )

I could not diff hbm file ( QoS for non commiters 
is not existent ) - so you get fill version

PropertyaSetItem is diffed. 

Main idea is to use hibernate query object instead of
rigging up string and then parsing it to query. 

And also to use scalar query instead of walking
througn collection. 

Works faster for me...

Apropos, you generate ejkb stuff with xdoclet - 
why not hibernate mapping? I could contribute it
easily. 

regards,


=====
----[ Konstantin Pribluda ( ko5tik ) ]----------------
Zu Verstärkung meines Teams suche ich ab Sofort einen
Softwareentwickler[In] für die Festanstellung. 
Arbeitsort: Mainz 
Skills:  Programieren, Kentnisse in OpenSource-Bereich
----[ http://www.pribluda.de ]------------------------

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
PropertySetItem.hbm.xml (text/xml, 1.9 KB)
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
    <class name="com.opensymphony.module.propertyset.hibernate.PropertySetItem" table="OS_PROPERTYSET">
        <composite-id>
            <key-property name="entityName" column="entity_name" length="125" />
            <key-property name="entityId" column="entity_id" />
            <key-property name="key" column="entity_key" />

        </composite-id>

        <property name="type" column="key_type" />
        <property name="booleanVal" column="boolean_val" />
        <property name="doubleVal" column="double_val" />
        <property name="stringVal" column="string_val" />
        <property name="longVal" column="long_val" />
        <property name="intVal" column="int_val" />
        <property name="dateVal" type="date" column="date_val" />
    </class>
	<query name="all_keys"><![CDATA[
		select item.key from item in class com.opensymphony.module.propertyset.hibernate.PropertySetItem
		where item.entityName = :entityName and item.entityId = :entityId
	]]></query>
	<query name="all_keys_with_type"><![CDATA[
		select item.key from item in class com.opensymphony.module.propertyset.hibernate.PropertySetItem
		where item.entityName = :entityName and item.entityId = :entityId and item.type = :type
	]]></query>
	<query name="all_keys_like"><![CDATA[
		select item.key from item in class com.opensymphony.module.propertyset.hibernate.PropertySetItem
		where item.entityName = :entityName and item.entityId = :entityId and item.key LIKE :like
	]]></query>
	<query name="all_keys_with_type_like"><![CDATA[
		select item.key from item in class com.opensymphony.module.propertyset.hibernate.PropertySetItem
		where item.entityName = :entityName and item.entityId = :entityId 
		and item.type = :type and item.key LIKE :like
	]]></query>

</hibernate-mapping>
hps.patch (application/octet-stream, 2.3 KB)
Index: src/java/com/opensymphony/module/propertyset/hibernate/HibernatePropertySet.java
===================================================================
RCS file: /cvsroot/opensymphony/propertyset/src/java/com/opensymphony/module/propertyset/hibernate/HibernatePropertySet.java,v
retrieving revision 1.10
diff -r1.10 HibernatePropertySet.java
11a12
> import net.sf.hibernate.Query;
60,68c61,62
<         String query = "FROM o IN " + PropertySetItem.class + " WHERE o.entityName = ? AND o.entityId = ?";
< 
<         if (prefix != null) {
<             query += (" AND o.key LIKE '" + prefix + "%'");
<         }
< 
<         if (type > 0) {
<             query += (" AND o.type = " + type);
<         }
---
>         Query query = null;
>         List list = null;
71,72d64
<             Object[] params = new Object[] {entityName, entityId};
<             Type[] types = new Type[] {Hibernate.STRING, Hibernate.LONG};
75,78c67,78
<             List list = session.find(query, params, types);
< 
<             if (list == null) {
<                 return Collections.EMPTY_LIST;
---
>             if ((prefix != null) && (type > 0)) {
>                 query = session.getNamedQuery("all_keys_with_type_like");
>                 query.setString("like", prefix + '%');
>                 query.setInteger("type", type);
>             } else if (prefix != null) {
>                 query = session.getNamedQuery("all_keys_like");
>                 query.setString("like", prefix + '%');
>             } else if (type > 0) {
>                 query = session.getNamedQuery("all_keys_with_type");
>                 query.setInteger("type", type);
>             } else {
>                 query = session.getNamedQuery("all_keys");
81,86c81,82
<             ArrayList keys = new ArrayList(list.size());
< 
<             for (Iterator iterator = list.iterator(); iterator.hasNext();) {
<                 PropertySetItem item = (PropertySetItem) iterator.next();
<                 keys.add(item.getKey());
<             }
---
>             query.setString("entityName", entityName);
>             query.setLong("entityId", entityId.longValue());
88c84
<             return keys;
---
>             list = query.list();
90c86
<             return Collections.EMPTY_LIST;
---
>             list = Collections.EMPTY_LIST;
99a96,97
> 
>         return list;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.