ibatis « SQL « Java Database Q&A





1. ibatis return values    stackoverflow.com

I'm currently using ibatis to returns some pojos and everything works great.
My question is: I have to return 1 row from a table, just like 3 fields, and I don't want ...

2. How to use an IN clause in iBATIS?    stackoverflow.com

I'm using iBATIS to create select statements. Now I would like to implement the following SQL statement with iBATIS:

SELECT * FROM table WHERE col1 IN ('value1', 'value2');
With the following ...

3. iBatis circular references question    stackoverflow.com

I have an Office object and a Device Object. An Office has a device and a device belongs to an office. So, obtaining an Office object should populate Office.Device reference and ...

4. ibatis isNotEmpty with multiple variables    stackoverflow.com

Suppose I have a massive table called inactiveUsers and a search form. I want to conditionally join the inactiveUsers table if any user related characteristic is chosen (address, name, phoneNumber, etc...). ...

5. iBatis how to solve a more complex N+1 problem    stackoverflow.com

I have a database that is similar to the following:

create table Store(storeId)
create table Staff(storeId_fk, staff_id, staffName)
create table Item(storeId_fk, itme_id, itemName)
The Store table is large. And I have create the following java bean
public ...

6. how to do Ibatis version of show sql    stackoverflow.com

Is there an Ibatis setting to view the generated SQL like how Hibernate has show_sql=true? thanks

7. Iterate list of Objects in Ibatis    stackoverflow.com

I have a list of object where I want to iterate and access a particular field in ibatis sql. Ex.

public Class Student
{
String id;
String name;
}
I will pass as parameter a List ...

8. sql: how to improve this statment    stackoverflow.com

I have the following sql statement that I need to make quicker. There are 500k rows, and I an index for 'HARDWARE_ID', but this still take up to a second to perform. ...

9. IBatis sql fragments used in different namespace    stackoverflow.com

I've got a sql fragments defined in a particular namespace like:

<sqlMap namespace="firstNamespace">
   .....
   <sql id="fragmentOne">
and then from another namespace I'm trying to use it, but seems that ...





10. Truncating strings    stackoverflow.com

I'm working with third party user data that may or may not fit into our database. The data needs to be truncated if it is too long. We are using IBatis with ...

11. Return a Single Map in IBATIS    stackoverflow.com

I have a SqlMap query that returns 2 columns, an ID and a string. I know how to return a list of maps where the ID is the key and ...

12. iBatis Silent Failure to Map Columns    stackoverflow.com

When I am mapping a POJO with iBatis such as below:

Person {
    String firstName
    String lastName;
}
To the query:
select firstName, last_name from Person
I am finding that ...

13. Mapping Composition in MyBatis    stackoverflow.com

I'm having some trouble with a mapping in MyBatis for Java and would appreciate some help. My class structure is as below:

//Getters/setters omitted for clarity

class Foo 
{
  int id;
  ...

14. Is it possible to create iBatis/MyBatis artifacts for Views in SQL?    stackoverflow.com

I am new to iBatis. I want to know -

  1. Is it possible to create ibatis Artifacts (.java files) for views in SQL Server 2005?
  2. Is querying those views will be same ...

15. ibatis.net datetime and dynamic sql    stackoverflow.com

how can i test if a property of type dateTime contains value on dynamic sql statement with ibatis.net my mapping file is as follow, but it does not work

<select id="Select" resultMap ...

16. ibatis.net isGreaterThan and enumerations    stackoverflow.com

the operator isGreaterThan doesn't work when used with enummerations i have the snippet bellow in a dynamic statement

<select id="SelectCongeTest" resultMap ="CongeResult" parameterMap="CongeParam">
  SELECT * FROM CONGE INNER JOIN SALARIE ON ...





17. Mapper for XPath field in mybatis    stackoverflow.com

How to create mapper for last select query in myBatis?

CREATE TABLE dbo.ProductBilling
(ProductBillingID int IDENTITY(1,1) PRIMARY KEY,
ProductBillingXML XML NOT NULL)
GO
INSERT dbo.ProductBilling(ProductBillingXML)
VALUES ('<ProductBilling Billingnumber="1" customerid="22" orderdate="7/1/2005">
<OrderItems>
<Item id="22" qty="1" name="SQL"/>
<Item id="24" qty="1" name="T-SQL"/>
</OrderItems>
</ProductBilling>')

INSERT dbo.ProductBilling
(ProductBillingXML)
VALUES ...

18. MyBatis/iBatis - reusable sql fragments in a separate SQL Map file?    stackoverflow.com

I would like to put sql fragments used by several of my SQL Map XML files in a separate file. At the moment, the <sql> elements with these fragments are in ...

19. Declare a local variable as number/integer in ibatis    stackoverflow.com

DECLARE

CommitCmpt int; HERE the variable to use it later

 BEGIN

INSERT INTO test....

Commitcmpt := CommitCmpt + 1 ;

END;
I am getting an error on this line:
 CommitCmpt int;

com.ibatis.common.jdbc.exception.NestedSQLException:  
--- Cause: com.microsoft.sqlserver.jdbc.SQLServerException: 'int' ...