From 9d49973adb7be00dfe636004de4a58af0cbb6cca Mon Sep 17 00:00:00 2001 From: wght Date: Thu, 7 Jun 2007 21:32:14 +0000 Subject: [PATCH] Bug fix for bug#: 1733082 --- base/src/org/compiere/model/M_Element.java | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/base/src/org/compiere/model/M_Element.java b/base/src/org/compiere/model/M_Element.java index 6bb129e5cf..9fe28cf57a 100644 --- a/base/src/org/compiere/model/M_Element.java +++ b/base/src/org/compiere/model/M_Element.java @@ -123,6 +123,51 @@ public class M_Element extends X_AD_Element return retValue; } // get + /** + * Get Element + * @param ctx context + * @param columnName case insentitive column name + * @param columnName case insentitive column name + * @param trxName trx + * @return case sensitive column name + */ + public static M_Element getOfColumn (Properties ctx, int AD_Column_ID, String trxName) + { + if (AD_Column_ID ==0) + return null; + M_Element retValue = null; + String sql = "SELECT * FROM AD_Element e " + + "WHERE EXISTS (SELECT * FROM AD_Column c " + + "WHERE c.AD_Element_ID=e.AD_Element_ID AND c.AD_Column_ID=?)"; + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement (sql, trxName); + pstmt.setInt (1, AD_Column_ID); + ResultSet rs = pstmt.executeQuery (); + if (rs.next ()) + retValue = new M_Element (ctx, rs, trxName); + rs.close (); + pstmt.close (); + pstmt = null; + } + catch (Exception e) + { + s_log.log (Level.SEVERE, sql, e); + } + try + { + if (pstmt != null) + pstmt.close (); + pstmt = null; + } + catch (Exception e) + { + pstmt = null; + } + return retValue; + } // get + /** * Get Element * @param ctx context