Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
16 posts
|
Hi All,
Is there any back door for us to run a SQL and get the result as a resultset directly in java code in ofbiz? Thanks. Regards, Liu Xiangqian Wizitsoft Information Technology Ltd. www.wizitsoft.com | (86) 010-62670653 ext 614 |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
92 posts
|
Of course, below is an example:
public static synchronized Long getNextSeqId(GenericDelegator delegator, String tableName) throws Exception { Long sequenceId = null; String helperName = delegator.getGroupHelperName("com.aicent"); Connection conn = ConnectionFactory.getConnection(helperName); Statement statement = conn.createStatement(); statement.execute("SELECT max(id) FROM " + tableName); ResultSet results = statement.getResultSet(); if (results.next()) { sequenceId = new Long(results.getLong(1) + 1); } Debug.logInfo("MAX ID :" + sequenceId, module); return sequenceId; } -----Original Message----- From: Larry.Liu [mailto:[hidden email]] Sent: 2009年3月25日 14:51 To: [hidden email] Subject: how to run a sql directly in java class in ofbiz? Hi All, Is there any back door for us to run a SQL and get the result as a resultset directly in java code in ofbiz? Thanks. Regards, Liu Xiangqian Wizitsoft Information Technology Ltd. www.wizitsoft.com | (86) 010-62670653 ext 614 |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
16 posts
|
Thanks :)
Regards, Liu Xiangqian Wizitsoft Information Technology Ltd. www.wizitsoft.com | (86) 010-62670653 ext 614 2009/3/25 Jack Liu <[hidden email]> > Of course, below is an example: > > public static synchronized Long getNextSeqId(GenericDelegator delegator, > String tableName) throws Exception { > Long sequenceId = null; > > String helperName = > delegator.getGroupHelperName("com.aicent"); > > Connection conn = > ConnectionFactory.getConnection(helperName); > > Statement statement = conn.createStatement(); > statement.execute("SELECT max(id) FROM " + tableName); > ResultSet results = statement.getResultSet(); > > if (results.next()) { > > sequenceId = new Long(results.getLong(1) + 1); > } > Debug.logInfo("MAX ID :" + sequenceId, module); > return sequenceId; > } > > -----Original Message----- > From: Larry.Liu [mailto:[hidden email]] > Sent: 2009年3月25日 14:51 > To: [hidden email] > Subject: how to run a sql directly in java class in ofbiz? > > Hi All, > > Is there any back door for us to run a SQL and get the result as a > resultset > directly in java code in ofbiz? > > Thanks. > > Regards, > Liu Xiangqian > > Wizitsoft Information Technology Ltd. > www.wizitsoft.com | (86) 010-62670653 ext 614 > ... [show rest of quote]
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
6819 posts
|
In reply to this post by Larry.Liu
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 you can look at webtools Entity SQL processor code. Larry.Liu sent the following on 3/24/2009 11:50 PM: > Hi All, > > Is there any back door for us to run a SQL and get the result as a resultset > directly in java code in ofbiz? > > Thanks. > > Regards, > Liu Xiangqian > > Wizitsoft Information Technology Ltd. > www.wizitsoft.com | (86) 010-62670653 ext 614 > Version: GnuPG v1.4.6 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFJyhsarP3NbaWWqE4RAhc2AJ9iICVEVMjrAI6sjTx/vKzsgLPIPwCfapF1 CtGjZXYA3XDw9w79PI1UuR4= =kDjN -----END PGP SIGNATURE----- |
Free forum by Nabble | Edit this page |