问:
Android SQLite: Update Statement
I need to implement SQLite in my application. I followed this tutorial:
Creating and using databases in Android one

Everything is working fine. I inserted 1 row with 5 columns.
Now I want to update the value of 1 column only and the others will remain the same.

There is one update method in the tutorial that needs all the parameters, however, I want to update only one column.

答:
I use this class to handle database.I hope it will help some one in future.

Happy coding.

```<code>public class Database {

private static class DBHelper extends SQLiteOpenHelper {

    /**
     * Database name
     */
    private static final String DB_NAME = "db_name";

    /**
     * Table Names
     */
    public static final String TABLE_CART = "DB_CART";

    /**
     *  Cart Table Columns
     */
    public static final String CART_ID_PK = "_id";// Primary key

    public static final String CART_DISH_NAME = "dish_name";
    public static final String CART_DISH_ID = "menu_item_id";
    public static final String CART_DISH_QTY = "dish_qty";
    public static final String CART_DISH_PRICE = "dish_price";

    /**
     * String to create reservation tabs table
     */
    private final String CREATE_TABLE_CART = "CREATE TABLE IF NOT EXISTS "
            + TABLE_CART + " ( "
            + CART_ID_PK + " INTEGER PRIMARY KEY, "
            + CART_DISH_NAME + " TEXT , "
            + CART_DISH_ID + " TEXT , "
            + CART_DISH_QTY + " TEXT , "
            + CART_DISH_PRICE + " TEXT);";

    public DBHelper(Context context) {
        super(context, DB_NAME, null, 2);

    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(CREATE_TABLE_CART);

    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int arg1, int arg2) {
        db.execSQL("DROP TABLE IF EXISTS " + CREATE_TABLE_CART);
        onCreate(db);
    }

}

     /**
      * CART handler
      */
      public static class Cart {

    /**
     * Check if Cart is available or not
     *
     * @param context
     * @return
     */
    public static boolean isCartAvailable(Context context) {

        DBHelper dbHelper = new DBHelper(context);
        SQLiteDatabase db = dbHelper.getReadableDatabase();
        boolean exists = false;

        try {
            String query = "SELECT * FROM " + DBHelper.TABLE_CART;
            Cursor cursor = db.rawQuery(query, null);
            exists = (cursor.getCount() > 0);
            cursor.close();
            db.close();
        } catch (SQLiteException e) {
            db.close();
        }

        return exists;
    }

    /**
     * Insert values in cart table
     *
     * @param context
     * @param dishName
     * @param dishPrice
     * @param dishQty
     * @return
     */
    public static boolean insertItem(Context context, String itemId, String dishName, String dishPrice, String dishQty) {

        DBHelper dbHelper = new DBHelper(context);
        SQLiteDatabase db = dbHelper.getWritableDatabase();
        ContentValues values = new ContentValues();
        values.put(DBHelper.CART_DISH_ID, "" + itemId);
        values.put(DBHelper.CART_DISH_NAME, "" + dishName);
        values.put(DBHelper.CART_DISH_PRICE, "" + dishPrice);
        values.put(DBHelper.CART_DISH_QTY, "" + dishQty);

        try {
            db.insert(DBHelper.TABLE_CART, null, values);
            db.close();
            return true;
        } catch (SQLiteException e) {
            db.close();
            return false;
        }
    }

    /**
     * Check for specific record by name
     *
     * @param context
     * @param dishName
     * @return
     */
    public static boolean isItemAvailable(Context context, String dishName) {

        DBHelper dbHelper = new DBHelper(context);
        SQLiteDatabase db = dbHelper.getReadableDatabase();
        boolean exists = false;

        String query = "SELECT * FROM " + DBHelper.TABLE_CART + " WHERE "
                + DBHelper.CART_DISH_NAME + " = '" + String.valueOf(dishName) + "'";

        try {
            Cursor cursor = db.rawQuery(query, null);

            exists = (cursor.getCount() > 0);
            cursor.close();

        } catch (SQLiteException e) {

            e.printStackTrace();
            db.close();

        }

        return exists;
    }

    /**
     * Update cart item by item name
     *
     * @param context
     * @param dishName
     * @param dishPrice
     * @param dishQty
     * @return
     */
    public static boolean updateItem(Context context, String itemId, String dishName, String dishPrice, String dishQty) {

        DBHelper dbHelper = new DBHelper(context);
        SQLiteDatabase db = dbHelper.getWritableDatabase();
        ContentValues values = new ContentValues();
        values.put(DBHelper.CART_DISH_ID, itemId);
        values.put(DBHelper.CART_DISH_NAME, dishName);
        values.put(DBHelper.CART_DISH_PRICE, dishPrice);
        values.put(DBHelper.CART_DISH_QTY, dishQty);

        try {

            String[] args = new String[]{dishName};
            db.update(DBHelper.TABLE_CART, values, DBHelper.CART_DISH_NAME + "=?", args);

            db.close();

            return true;
        } catch (SQLiteException e) {
            db.close();

            return false;
        }
    }

    /**
     * Get cart list
     *
     * @param context
     * @return
     */
    public static ArrayList<CartModel> getCartList(Context context) {

        DBHelper dbHelper = new DBHelper(context);
        SQLiteDatabase db = dbHelper.getReadableDatabase();

        ArrayList<CartModel> cartList = new ArrayList<>();

        try {
            String query = "SELECT * FROM " + DBHelper.TABLE_CART + ";";

            Cursor cursor = db.rawQuery(query, null);

            for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {

                cartList.add(new CartModel(
                        cursor.getString(cursor.getColumnIndex(DBHelper.CART_DISH_ID)),
                        cursor.getString(cursor.getColumnIndex(DBHelper.CART_DISH_NAME)),
                        cursor.getString(cursor.getColumnIndex(DBHelper.CART_DISH_QTY)),
                        Integer.parseInt(cursor.getString(cursor.getColumnIndex(DBHelper.CART_DISH_PRICE)))
                ));
            }

            db.close();

        } catch (SQLiteException e) {
            db.close();
        }
        return cartList;
    }

   /**
     * Get total amount of cart items
     *
     * @param context
     * @return
     */
    public static String getTotalAmount(Context context) {

        DBHelper dbHelper = new DBHelper(context);
        SQLiteDatabase db = dbHelper.getReadableDatabase();

        double totalAmount = 0.0;

        try {
            String query = "SELECT * FROM " + DBHelper.TABLE_CART + ";";

            Cursor cursor = db.rawQuery(query, null);

            for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {

                totalAmount = totalAmount + Double.parseDouble(cursor.getString(cursor.getColumnIndex(DBHelper.CART_DISH_PRICE))) *
                        Double.parseDouble(cursor.getString(cursor.getColumnIndex(DBHelper.CART_DISH_QTY)));
            }

            db.close();

        } catch (SQLiteException e) {
            db.close();
        }

        if (totalAmount == 0.0)
            return "";
        else
            return "" + totalAmount;
    }

    /**
     * Get item quantity
     *
     * @param context
     * @param dishName
     * @return
     */
    public static String getItemQty(Context context, String dishName) {

        DBHelper dbHelper = new DBHelper(context);
        SQLiteDatabase db = dbHelper.getReadableDatabase();

        Cursor cursor = null;
        String query = "SELECT * FROM " + DBHelper.TABLE_CART + " WHERE " + DBHelper.CART_DISH_NAME + " = '" + dishName + "';";
        String quantity = "0";

        try {
            cursor = db.rawQuery(query, null);

            if (cursor.getCount() > 0) {

                cursor.moveToFirst();
                quantity = cursor.getString(cursor
                        .getColumnIndex(DBHelper.CART_DISH_QTY));

                return quantity;
            }

        } catch (SQLiteException e) {
            e.printStackTrace();
        }

        return quantity;
    }

    /**
     * Delete cart item by name
     *
     * @param context
     * @param dishName
     */
    public static void deleteCartItem(Context context, String dishName) {
        DBHelper dbHelper = new DBHelper(context);
        SQLiteDatabase db = dbHelper.getReadableDatabase();

        try {

            String[] args = new String[]{dishName};
            db.delete(DBHelper.TABLE_CART, DBHelper.CART_DISH_NAME + "=?", args);

            db.close();
        } catch (SQLiteException e) {
            db.close();
            e.printStackTrace();
        }

    }

}//End of cart class

/**
 * Delete database table
 *
 * @param context
 */
public static void deleteCart(Context context) {
    DBHelper dbHelper = new DBHelper(context);
    SQLiteDatabase db = dbHelper.getReadableDatabase();

    try {

        db.execSQL("DELETE FROM " + DBHelper.TABLE_CART);

    } catch (SQLiteException e) {
        e.printStackTrace();
    }

}
</code>```

}

Usage:

```<code>  if(Database.Cart.isCartAvailable(context)){

       Database.deleteCart(context);

   }
</code>```

Title: Android SQLite: Update Statement

Body:
I use this class to handle database.I hope it will help some one in future.

Happy coding.

public class Database {

private static class DBHelper extends SQLiteOpenHelper {

    /**
     * Database name
     */
    private static final String DB_NAME = "db_name";

    /**
     * Table Names
     */
    public static final String TABLE_CART = "DB_CART";

    /**
     *  Cart Table Columns
     */
    public static final String CART_ID_PK = "_id";// Primary key

    public static final String CART_DISH_NAME = "dish_name";
    public static final String CART_DISH_ID = "menu_item_id";
    public static final String CART_DISH_QTY = "dish_qty";
    public static final String CART_DISH_PRICE = "dish_price";

    /**
     * String to create reservation tabs table
     */
    private final String CREATE_TABLE_CART = "CREATE TABLE IF NOT EXISTS "
            + TABLE_CART + " ( "
            + CART_ID_PK + " INTEGER PRIMARY KEY, "
            + CART_DISH_NAME + " TEXT , "
            + CART_DISH_ID + " TEXT , "
            + CART_DISH_QTY + " TEXT , "
            + CART_DISH_PRICE + " TEXT);";

    public DBHelper(Context context) {
        super(context, DB_NAME, null, 2);

    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(CREATE_TABLE_CART);

    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int arg1, int arg2) {
        db.execSQL("DROP TABLE IF EXISTS " + CREATE_TABLE_CART);
        onCreate(db);
    }

}

     /**
      * CART handler
      */
      public static class Cart {

    /**
     * Check if Cart is available or not
     *
     * @param context
     * @return
     */
    public static boolean isCartAvailable(Context context) {

        DBHelper dbHelper = new DBHelper(context);
        SQLiteDatabase db = dbHelper.getReadableDatabase();
        boolean exists = false;

        try {
            String query = "SELECT * FROM " + DBHelper.TABLE_CART;
            Cursor cursor = db.rawQuery(query, null);
            exists = (cursor.getCount() > 0);
            cursor.close();
            db.close();
        } catch (SQLiteException e) {
            db.close();
        }

        return exists;
    }

    /**
     * Insert values in cart table
     *
     * @param context
     * @param dishName
     * @param dishPrice
     * @param dishQty
     * @return
     */
    public static boolean insertItem(Context context, String itemId, String dishName, String dishPrice, String dishQty) {

        DBHelper dbHelper = new DBHelper(context);
        SQLiteDatabase db = dbHelper.getWritableDatabase();
        ContentValues values = new ContentValues();
        values.put(DBHelper.CART_DISH_ID, "" + itemId);
        values.put(DBHelper.CART_DISH_NAME, "" + dishName);
        values.put(DBHelper.CART_DISH_PRICE, "" + dishPrice);
        values.put(DBHelper.CART_DISH_QTY, "" + dishQty);

        try {
            db.insert(DBHelper.TABLE_CART, null, values);
            db.close();
            return true;
        } catch (SQLiteException e) {
            db.close();
            return false;
        }
    }

    /**
     * Check for specific record by name
     *
     * @param context
     * @param dishName
     * @return
     */
    public static boolean isItemAvailable(Context context, String dishName) {

        DBHelper dbHelper = new DBHelper(context);
        SQLiteDatabase db = dbHelper.getReadableDatabase();
        boolean exists = false;

        String query = "SELECT * FROM " + DBHelper.TABLE_CART + " WHERE "
                + DBHelper.CART_DISH_NAME + " = '" + String.valueOf(dishName) + "'";

        try {
            Cursor cursor = db.rawQuery(query, null);

            exists = (cursor.getCount() > 0);
            cursor.close();

        } catch (SQLiteException e) {

            e.printStackTrace();
            db.close();

        }

        return exists;
    }

    /**
     * Update cart item by item name
     *
     * @param context
     * @param dishName
     * @param dishPrice
     * @param dishQty
     * @return
     */
    public static boolean updateItem(Context context, String itemId, String dishName, String dishPrice, String dishQty) {

        DBHelper dbHelper = new DBHelper(context);
        SQLiteDatabase db = dbHelper.getWritableDatabase();
        ContentValues values = new ContentValues();
        values.put(DBHelper.CART_DISH_ID, itemId);
        values.put(DBHelper.CART_DISH_NAME, dishName);
        values.put(DBHelper.CART_DISH_PRICE, dishPrice);
        values.put(DBHelper.CART_DISH_QTY, dishQty);

        try {

            String[] args = new String[]{dishName};
            db.update(DBHelper.TABLE_CART, values, DBHelper.CART_DISH_NAME + "=?", args);

            db.close();

            return true;
        } catch (SQLiteException e) {
            db.close();

            return false;
        }
    }

    /**
     * Get cart list
     *
     * @param context
     * @return
     */
    public static ArrayList<CartModel> getCartList(Context context) {

        DBHelper dbHelper = new DBHelper(context);
        SQLiteDatabase db = dbHelper.getReadableDatabase();

        ArrayList<CartModel> cartList = new ArrayList<>();

        try {
            String query = "SELECT * FROM " + DBHelper.TABLE_CART + ";";

            Cursor cursor = db.rawQuery(query, null);

            for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {

                cartList.add(new CartModel(
                        cursor.getString(cursor.getColumnIndex(DBHelper.CART_DISH_ID)),
                        cursor.getString(cursor.getColumnIndex(DBHelper.CART_DISH_NAME)),
                        cursor.getString(cursor.getColumnIndex(DBHelper.CART_DISH_QTY)),
                        Integer.parseInt(cursor.getString(cursor.getColumnIndex(DBHelper.CART_DISH_PRICE)))
                ));
            }

            db.close();

        } catch (SQLiteException e) {
            db.close();
        }
        return cartList;
    }

   /**
     * Get total amount of cart items
     *
     * @param context
     * @return
     */
    public static String getTotalAmount(Context context) {

        DBHelper dbHelper = new DBHelper(context);
        SQLiteDatabase db = dbHelper.getReadableDatabase();

        double totalAmount = 0.0;

        try {
            String query = "SELECT * FROM " + DBHelper.TABLE_CART + ";";

            Cursor cursor = db.rawQuery(query, null);

            for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {

                totalAmount = totalAmount + Double.parseDouble(cursor.getString(cursor.getColumnIndex(DBHelper.CART_DISH_PRICE))) *
                        Double.parseDouble(cursor.getString(cursor.getColumnIndex(DBHelper.CART_DISH_QTY)));
            }

            db.close();

        } catch (SQLiteException e) {
            db.close();
        }

        if (totalAmount == 0.0)
            return "";
        else
            return "" + totalAmount;
    }

    /**
     * Get item quantity
     *
     * @param context
     * @param dishName
     * @return
     */
    public static String getItemQty(Context context, String dishName) {

        DBHelper dbHelper = new DBHelper(context);
        SQLiteDatabase db = dbHelper.getReadableDatabase();

        Cursor cursor = null;
        String query = "SELECT * FROM " + DBHelper.TABLE_CART + " WHERE " + DBHelper.CART_DISH_NAME + " = '" + dishName + "';";
        String quantity = "0";

        try {
            cursor = db.rawQuery(query, null);

            if (cursor.getCount() > 0) {

                cursor.moveToFirst();
                quantity = cursor.getString(cursor
                        .getColumnIndex(DBHelper.CART_DISH_QTY));

                return quantity;
            }

        } catch (SQLiteException e) {
            e.printStackTrace();
        }

        return quantity;
    }

    /**
     * Delete cart item by name
     *
     * @param context
     * @param dishName
     */
    public static void deleteCartItem(Context context, String dishName) {
        DBHelper dbHelper = new DBHelper(context);
        SQLiteDatabase db = dbHelper.getReadableDatabase();

        try {

            String[] args = new String[]{dishName};
            db.delete(DBHelper.TABLE_CART, DBHelper.CART_DISH_NAME + "=?", args);

            db.close();
        } catch (SQLiteException e) {
            db.close();
            e.printStackTrace();
        }

    }

}//End of cart class

/**
 * Delete database table
 *
 * @param context
 */
public static void deleteCart(Context context) {
    DBHelper dbHelper = new DBHelper(context);
    SQLiteDatabase db = dbHelper.getReadableDatabase();

    try {

        db.execSQL("DELETE FROM " + DBHelper.TABLE_CART);

    } catch (SQLiteException e) {
        e.printStackTrace();
    }

}

}

Usage:

  if(Database.Cart.isCartAvailable(context)){

       Database.deleteCart(context);

   }


来源: stackexchange

问:
C Language: Structure and Arrays
Is it possible to make an existing structure an array?

```<code>struct violation v1={"AA1", "Defective_Brakes", 150};
struct violation v2={"AA2", "Disregarding_Traffic_Signs", 150};
struct violation v3={"AA3", "Driving_Under_the_Influence_of_Liquor", 2000};
struct violation v4={"AA4", "Driving_while_using_Mobile_Devices", 200};
struct violation v5={"AA5", "Drinving_without_License", 750};
struct violation v6={"AA6", "Driving_Against_Traffic", 2000};
struct violation v7={"AA7", "Failure_to_use_Seatbelt", 500};
struct violation v8={"AA8", "Illegal_Parking", 200};
struct violation v9={"AA9", "Overspeeding", 1200};
struct violation v10={"AA10", "Reckless_Driving", 750};
</code>```

This is the supposed to be database of my codes. I would like to turn it into an array to make searching in the database easier.  What can I do?

答:
Yes. Just as you would do for a regular array, you can create an array of structs:

```<code>struct violation v[10]={
                    {"AA1",  "Defective_Brakes",                      150},
                    {"AA2",  "Disregarding_Traffic_Signs",            150},
                    {"AA3",  "Driving_Under_the_Influence_of_Liquor", 2000},
                    {"AA4",  "Driving_while_using_Mobile_Devices",    200},
                    {"AA5",  "Drinving_without_License",              750},
                    {"AA6",  "Driving_Against_Traffic",               2000},
                    {"AA7",  "Failure_to_use_Seatbelt",               500},
                    {"AA8",  "Illegal_Parking",                       200},
                    {"AA9",  "Overspeeding",                          1200},
                    {"AA10", "Reckless_Driving",                      750},
                 };
</code>```

ContentLicense: CC BY-SA 3.0

Title: C Language: Structure and Arrays

Body:
Is it possible to make an existing structure an array?

struct violation v1={"AA1", "Defective_Brakes", 150};
struct violation v2={"AA2", "Disregarding_Traffic_Signs", 150};
struct violation v3={"AA3", "Driving_Under_the_Influence_of_Liquor", 2000};
struct violation v4={"AA4", "Driving_while_using_Mobile_Devices", 200};
struct violation v5={"AA5", "Drinving_without_License", 750};
struct violation v6={"AA6", "Driving_Against_Traffic", 2000};
struct violation v7={"AA7", "Failure_to_use_Seatbelt", 500};
struct violation v8={"AA8", "Illegal_Parking", 200};
struct violation v9={"AA9", "Overspeeding", 1200};
struct violation v10={"AA10", "Reckless_Driving", 750};

This is the supposed to be database of my codes. I would like to turn it into an array to make searching in the database easier.  What can I do?

Body:
Yes. Just as you would do for a regular array, you can create an array of structs:

struct violation v[10]={
                    {"AA1",  "Defective_Brakes",                      150},
                    {"AA2",  "Disregarding_Traffic_Signs",            150},
                    {"AA3",  "Driving_Under_the_Influence_of_Liquor", 2000},
                    {"AA4",  "Driving_while_using_Mobile_Devices",    200},
                    {"AA5",  "Drinving_without_License",              750},
                    {"AA6",  "Driving_Against_Traffic",               2000},
                    {"AA7",  "Failure_to_use_Seatbelt",               500},
                    {"AA8",  "Illegal_Parking",                       200},
                    {"AA9",  "Overspeeding",                          1200},
                    {"AA10", "Reckless_Driving",                      750},
                 };


答:
You can easily put your data in an array instead of ten separate variables:</p>

```<code>struct violation violations[] = {
    {"AA1", "Defective_Brakes", 150},
    {"AA2", "Disregarding_Traffic_Signs", 150},
    {"AA3", "Driving_Under_the_Influence_of_Liquor", 2000},
    {"AA4", "Driving_while_using_Mobile_Devices", 200},
    {"AA5", "Drinving_without_License", 750},
    {"AA6", "Driving_Against_Traffic", 2000},
    {"AA7", "Failure_to_use_Seatbelt", 500},
    {"AA8", "Illegal_Parking", 200},
    {"AA9", "Overspeeding", 1200},
    {"AA10", "Reckless_Driving", 750}
};
</code>```

Title: C Language: Structure and Arrays

Body:
You can easily put your data in an array instead of ten separate variables:

struct violation violations[] = {
    {"AA1", "Defective_Brakes", 150},
    {"AA2", "Disregarding_Traffic_Signs", 150},
    {"AA3", "Driving_Under_the_Influence_of_Liquor", 2000},
    {"AA4", "Driving_while_using_Mobile_Devices", 200},
    {"AA5", "Drinving_without_License", 750},
    {"AA6", "Driving_Against_Traffic", 2000},
    {"AA7", "Failure_to_use_Seatbelt", 500},
    {"AA8", "Illegal_Parking", 200},
    {"AA9", "Overspeeding", 1200},
    {"AA10", "Reckless_Driving", 750}
};


问:
How are these quoted strings replaced with the values in perl .pm file?
Below is the Perl code in .pm file which is supposed to replace the specified strings (that are in "quotes") with some values. But its not happening. Can anyone explain what is happening in this code?</p>

```<code>package SomePackage;

require Exporter;

@ISA    = qw(Exporter);
@EXPORT = qw(send_request, create_mmd_and_transfer, update_mmd_file);

sub send_request {
    my ( $service, $action, $torole ) = @_;

    my ( $seller_request_mmd );

    my $replace_contents = ();
    $replace_contents{"REPLACE_Service"}        = $service;
    $replace_contents{"REPLACE_RequestAction"}  = $action;
    $replace_contents{"REPLACE_TradingPartner"} = $torole;
    $replace_contents{"REPLACE_Requestxml"}     = "Request.xml";

    create_mmd_and_transfer( \%replace_contents, $seller_request_mmd, "/MMD.xml" );
}

sub create_mmd_and_transfer {

    my $local_replace_contents = shift;
    my $input_mmd              = shift;
    my $local_output_mmd       = shift;
    my $output_mmd             = shift;

    update_mmd_file( "$input_mmd", "temp_mmd_file.xml", $local_replace_contents );
}

sub update_mmd_file {

    my $input_file  = shift;
    my $output_file = shift;
    my $contents    = shift;

    open( MMD_FILE, "<$input_file" )
            or main::error_exit(" Cannot open MMD file template $input_file \n $input_file not found int the Templates folder \n Please place the same and then run the script ");

    open( TEMP_MMD_FILE, ">$output_file" );

    while ( <MMD_FILE> ) {

        s/^M//g;    # Getrid of the ^Ms

        foreach my $content ( keys( %$contents ) ) {

            my $exact_value = ${%$contents}{$content};

            if ( $main::test_scenario =~ /^Invalid Request Action \a\n\d Service/
                and ( $content =~ /REPLACE_Service|REPLACE_RequestAction/i ) ) {
            }
            else {

                if ( $exact_value ne "" ) {
                    s/$content/$exact_value/g;
                }
            }
        }

        print TEMP_MMD_FILE;
    }

    close MMD_FILE;
    close TEMP_MMD_FILE;
}
</code>```

答:
Ok. Here's what I've done to test this.

Firstly, you didn't give us an input file or the code that you use to call the module. So I invented them. I made the simplest possible input file:

```<code>REPLACE_Service
REPLACE_RequestAction
REPLACE_TradingPartner
REPLACE_Requestxml
</code>```

And this driver program:

```<code>#!/usr/bin/perl

use strict;
use warnings;

use SomePackage;

send_request('foo', 'bar', 'baz');

sub error_exit {
  die @_;
}
</code>```

The first time, I ran it, I got this error:

Undefined subroutine &main::send_request called at test line 8.

That was because your @EXPORT line was wrong. You had:

```<code>@EXPORT = qw(send_request, create_mmd_and_transfer, update_mmd_file);
</code>```

But the point of qw(...) is that you don't need the commas. So I corrected it to:

```<code>@EXPORT = qw(send_request create_mmd_and_transfer update_mmd_file);
</code>```

Then I re-ran the program and got this error:

Cannot open MMD file template

   not found int the Templates folder
  Please place the same and then run the script  at test line 11.

That looked like there was something missing. I changed the error message, adding indicators of where the variable interpolation was supposed to happen:

```<code>open( MMD_FILE, "<$input_file" )
        or main::error_exit(" Cannot open MMD file template <$input_file> \n <$input_file> not found int the Templates folder \n Please place the same and then run the script ");
</code>```

Then the error message looked like this:

Cannot open MMD file template <>
   <> not found int the Templates folder
  Please place the same and then run the script  at test line 11.

So it seems clear that the $input_file variable isn't set in the update_mmd_file() subroutine. Tracing that variable back, we see that this value is originally the $seller_request_mmd variable in send_request(). But in send_request() you declare $seller_request_mmd but you never give it a value. So let's do that:

```<code>my ( $seller_request_mmd ) = 'test_input.txt';
</code>```

Now, when I run your program, it runs to completion without any errors. And I find a new temp_mmd_file.xml is generated. But it is exactly the same as the input file. So more investigation is needed.

Digging into the update_mmd_file() subroutine, we find this interesting line:

```<code>my $exact_value = ${%$contents}{$content};
</code>```

I think you're trying to extract a value from $contents, which is a hash reference. But your syntax is wrong. You were probably aiming at:

```<code>my $exact_value = ${$contents}{$content};
</code>```

But most Perl programmers prefer the arrow notation for working with reference look-ups.

```<code>my $exact_value = $contents->{$content};
</code>```

Making that change and re-running the program, I get an output file that contains:

```<code>foo
bar
baz
Request.xml
</code>```

Which is exactly what I expected. So the program now works.

But there is still a lot of work to do. As you have been told repeatedly, you should always add:

```<code>#!/usr/bin/perl

use strict;
use warnings;

use SomePackage;

send_request('foo', 'bar', 'baz');

sub error_exit {
  die @_;
}
</code>```0

to your code. That will find a lot of potential problems in your code - which you should fix.

To be honest, this feels to me like you were trying to run before you could walk. I'd recommend spending some time to work through a good Perl introductory book before taking on my more Perl work.

And there was a lot of useful information missing from your question. It wouldn't have taken as long to get to the solution if you had shown us your driver program and your input data.

Body:
Below is the Perl code in .pm file which is supposed to replace the specified strings (that are in "quotes") with some values. But its not happening. Can anyone explain what is happening in this code?

package SomePackage;

require Exporter;

@ISA    = qw(Exporter);
@EXPORT = qw(send_request, create_mmd_and_transfer, update_mmd_file);

sub send_request {
    my ( $service, $action, $torole ) = @_;

    my ( $seller_request_mmd );

    my $replace_contents = ();
    $replace_contents{"REPLACE_Service"}        = $service;
    $replace_contents{"REPLACE_RequestAction"}  = $action;
    $replace_contents{"REPLACE_TradingPartner"} = $torole;
    $replace_contents{"REPLACE_Requestxml"}     = "Request.xml";

    create_mmd_and_transfer( \%replace_contents, $seller_request_mmd, "/MMD.xml" );
}

sub create_mmd_and_transfer {

    my $local_replace_contents = shift;
    my $input_mmd              = shift;
    my $local_output_mmd       = shift;
    my $output_mmd             = shift;

    update_mmd_file( "$input_mmd", "temp_mmd_file.xml", $local_replace_contents );
}

sub update_mmd_file {

    my $input_file  = shift;
    my $output_file = shift;
    my $contents    = shift;

    open( MMD_FILE, "<$input_file" )
            or main::error_exit(" Cannot open MMD file template $input_file \n $input_file not found int the Templates folder \n Please place the same and then run the script ");

    open( TEMP_MMD_FILE, ">$output_file" );

    while ( <MMD_FILE> ) {

        s/^M//g;    # Getrid of the ^Ms

        foreach my $content ( keys( %$contents ) ) {

            my $exact_value = ${%$contents}{$content};

            if ( $main::test_scenario =~ /^Invalid Request Action \a\n\d Service/
                and ( $content =~ /REPLACE_Service|REPLACE_RequestAction/i ) ) {
            }
            else {

                if ( $exact_value ne "" ) {
                    s/$content/$exact_value/g;
                }
            }
        }

        print TEMP_MMD_FILE;
    }

    close MMD_FILE;
    close TEMP_MMD_FILE;
}

Body:
Ok. Here's what I've done to test this.

Firstly, you didn't give us an input file or the code that you use to call the module. So I invented them. I made the simplest possible input file:

REPLACE_Service
REPLACE_RequestAction
REPLACE_TradingPartner
REPLACE_Requestxml

And this driver program:

#!/usr/bin/perl

use strict;
use warnings;

use SomePackage;

send_request('foo', 'bar', 'baz');

sub error_exit {
  die @_;
}

The first time, I ran it, I got this error:

Undefined subroutine &main::send_request called at test line 8.

That was because your @EXPORT line was wrong. You had:

@EXPORT = qw(send_request, create_mmd_and_transfer, update_mmd_file);

But the point of qw(...) is that you don't need the commas. So I corrected it to:

@EXPORT = qw(send_request create_mmd_and_transfer update_mmd_file);

Then I re-ran the program and got this error:

Cannot open MMD file template

   not found int the Templates folder
  Please place the same and then run the script  at test line 11.

That looked like there was something missing. I changed the error message, adding indicators of where the variable interpolation was supposed to happen:

open( MMD_FILE, "<$input_file" )
        or main::error_exit(" Cannot open MMD file template <$input_file> \n <$input_file> not found int the Templates folder \n Please place the same and then run the script ");

Then the error message looked like this:

Cannot open MMD file template <>
   <> not found int the Templates folder
  Please place the same and then run the script  at test line 11.

So it seems clear that the $input_file variable isn't set in the update_mmd_file() subroutine. Tracing that variable back, we see that this value is originally the $seller_request_mmd variable in send_request(). But in send_request() you declare $seller_request_mmd but you never give it a value. So let's do that:

my ( $seller_request_mmd ) = 'test_input.txt';

Now, when I run your program, it runs to completion without any errors. And I find a new temp_mmd_file.xml is generated. But it is exactly the same as the input file. So more investigation is needed.

Digging into the update_mmd_file() subroutine, we find this interesting line:

my $exact_value = ${%$contents}{$content};

I think you're trying to extract a value from $contents, which is a hash reference. But your syntax is wrong. You were probably aiming at:

my $exact_value = ${$contents}{$content};

But most Perl programmers prefer the arrow notation for working with reference look-ups.

my $exact_value = $contents->{$content};

Making that change and re-running the program, I get an output file that contains:

foo
bar
baz
Request.xml

Which is exactly what I expected. So the program now works.

But there is still a lot of work to do. As you have been told repeatedly, you should always add:

use strict;
use warnings;

to your code. That will find a lot of potential problems in your code - which you should fix.

To be honest, this feels to me like you were trying to run before you could walk. I'd recommend spending some time to work through a good Perl introductory book before taking on my more Perl work.

And there was a lot of useful information missing from your question. It wouldn't have taken as long to get to the solution if you had shown us your driver program and your input data.


问:
Help needed with Database update with JSF, JPA 2.0, hibernate
I am using  JPA 2.0 and hibernate to save some data in a data base and to update them in a later time. Data is entered through a JSF 2.0 web based UI.it gives me a following exception and cant figure out what the reason is. I am new to all these so really need some help.

Thanks in advance and I've posted the code and the exception below.

```<code>int i=em.createQuery("UPDATE UserGroup g SET g.groupName = 'CrazyTest' WHERE g.id="+order.getId()).executeUpdate();
</code>```

```16:19:00.359 (31473614@qtp-21250902-2) WARN  - o.h.util.JDBCExceptionReporter: SQL Error: -3401, SQLState: 22001
16:19:00.359 (31473614@qtp-21250902-2) ERROR - o.h.util.JDBCExceptionReporter: data exception: string data, right truncation
16:19:00.375 (31473614@qtp-21250902-2) ERROR - o.h.e.d.AbstractFlushingEventListener: Could not synchronize database state with session
org.hibernate.exception.DataException: could not update:
 at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:102) ~[hibernate-core-3.5.1-Final.jar:3.5.1-Final]```

Full Stack trace is copied below

```16:19:00.359 (31473614@qtp-21250902-2) WARN  - o.h.util.JDBCExceptionReporter: SQL Error: -3401, SQLState: 22001
16:19:00.359 (31473614@qtp-21250902-2) ERROR - o.h.util.JDBCExceptionReporter: data exception: string data, right truncation
16:19:00.375 (31473614@qtp-21250902-2) ERROR - o.h.e.d.AbstractFlushingEventListener: Could not synchronize database state with session
org.hibernate.exception.DataException: could not update: [Order#3]
 at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:102) ~[hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) ~[hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2596) ~[hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2478) ~[hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2805) ~[hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:114) ~[hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:268) ~[hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:260) ~[hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:180) ~[hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321) ~[hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:64) [hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1175) [hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1273) [hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:117) [hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.ejb.QueryImpl.internalExecuteUpdate(QueryImpl.java:183) [hibernate-entitymanager-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.ejb.AbstractQueryImpl.executeUpdate(AbstractQueryImpl.java:99) [hibernate-entitymanager-3.5.1-Final.jar:3.5.1-Final]
 at com.digia.sesath.web.service.ProfileService.findGroup(ProfileService.java:51) [classes/:na]
 at com.digia.sesath.web.service.ProfileService$$FastClassByCGLIB$$492d6578.invoke() [cglib-2.2.jar:na]
 at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191) [cglib-2.2.jar:na]
 at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:692) [spring-aop-3.0.2.RELEASE.jar:3.0.2.RELEASE]
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) [spring-aop-3.0.2.RELEASE.jar:3.0.2.RELEASE]
 at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) [spring-tx-3.0.2.RELEASE.jar:3.0.2.RELEASE]
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [spring-aop-3.0.2.RELEASE.jar:3.0.2.RELEASE]
 at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:625) [spring-aop-3.0.2.RELEASE.jar:3.0.2.RELEASE]
 at com.digia.sesath.web.service.ProfileService$$EnhancerByCGLIB$$932e77e4.findGroup() [cglib-2.2.jar:na]
 at com.digia.sesath.web.component.permissionManager.GroupUpdateBean.updateGroupDetails(GroupUpdateBean.java:56) [classes/:na]
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_18]
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_18]
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_18]
 at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_18]
 at javax.el.BeanELResolver.invokeMethod(BeanELResolver.java:737) [el-api-2.2.jar:na]
 at javax.el.BeanELResolver.invoke(BeanELResolver.java:467) [el-api-2.2.jar:na]
 at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:246) [el-api-2.2.jar:na]
 at com.sun.el.parser.AstValue.invoke(AstValue.java:228) [el-impl-2.2.jar:na]
 at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297) [el-impl-2.2.jar:na]
 at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:98) [jsf-impl-2.0.2.jar:2.0.2-FCS]
 at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88) [jsf-api-2.0.jar:2.0.2-SNAPSHOT]
 at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102) [jsf-impl-2.0.2.jar:2.0.2-FCS]
 at javax.faces.component.UICommand.broadcast(UICommand.java:315) [jsf-api-2.0.jar:2.0.2-SNAPSHOT]
 at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:775) [jsf-api-2.0.jar:2.0.2-SNAPSHOT]
 at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1267) [jsf-api-2.0.jar:2.0.2-SNAPSHOT]
 at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82) [jsf-impl-2.0.2.jar:2.0.2-FCS]
 at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.0.2.jar:2.0.2-FCS]
 at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.0.2.jar:2.0.2-FCS]
 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312) [jsf-api-2.0.jar:2.0.2-SNAPSHOT]
 at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166) [jetty-6.1.24.jar:6.1.24]
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:343) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:188) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:109) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:149) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237) [spring-web-3.0.2.RELEASE.jar:3.0.2.RELEASE]
 at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) [spring-web-3.0.2.RELEASE.jar:3.0.2.RELEASE]
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) [jetty-6.1.24.jar:6.1.24]
 at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113) [spring-orm-3.0.2.RELEASE.jar:3.0.2.RELEASE]
 at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) [spring-web-3.0.2.RELEASE.jar:3.0.2.RELEASE]
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.Server.handle(Server.java:326) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) [jetty-util-6.1.24.jar:6.1.24]
Caused by: java.sql.SQLException: data exception: string data, right truncation
 at org.hsqldb.jdbc.Util.sqlException(Unknown Source) ~[hsqldb-2.0.0.jar:2.0.0]
 at org.hsqldb.jdbc.JDBCPreparedStatement.fetchResult(Unknown Source) ~[hsqldb-2.0.0.jar:2.0.0]
 at org.hsqldb.jdbc.JDBCPreparedStatement.executeUpdate(Unknown Source) ~[hsqldb-2.0.0.jar:2.0.0]
 at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) ~[commons-dbcp-1.4.jar:1.4]
 at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) ~[commons-dbcp-1.4.jar:1.4]
 at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2578) ~[hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 ... 91 common frames omitted
Caused by: org.hsqldb.HsqlException: data exception: string data, right truncation
 at org.hsqldb.error.Error.error(Unknown Source) ~[hsqldb-2.0.0.jar:2.0.0]
 at org.hsqldb.error.Error.error(Unknown Source) ~[hsqldb-2.0.0.jar:2.0.0]
 at org.hsqldb.types.BinaryType.castOrConvertToType(Unknown Source) ~[hsqldb-2.0.0.jar:2.0.0]
 at org.hsqldb.types.BinaryType.convertToType(Unknown Source) ~[hsqldb-2.0.0.jar:2.0.0]
 at org.hsqldb.StatementDML.getUpdatedData(Unknown Source) ~[hsqldb-2.0.0.jar:2.0.0]
 at org.hsqldb.StatementDML.executeUpdateStatement(Unknown Source) ~[hsqldb-2.0.0.jar:2.0.0]
 at org.hsqldb.StatementDML.getResult(Unknown Source) ~[hsqldb-2.0.0.jar:2.0.0]
 at org.hsqldb.StatementDMQL.execute(Unknown Source) ~[hsqldb-2.0.0.jar:2.0.0]
 at org.hsqldb.Session.executeCompiledStatement(Unknown Source) ~[hsqldb-2.0.0.jar:2.0.0]
 at org.hsqldb.Session.execute(Unknown Source) ~[hsqldb-2.0.0.jar:2.0.0]
 ... 96 common frames omitted
30.11.2010 16:19:00 com.sun.faces.application.ActionListenerImpl processAction
SEVERE: javax.persistence.PersistenceException: org.hibernate.exception.DataException: could not update: [Order#3]
javax.faces.el.EvaluationException: javax.persistence.PersistenceException: org.hibernate.exception.DataException: could not update: [Order#3]
 at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
 at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
 at javax.faces.component.UICommand.broadcast(UICommand.java:315)
 at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:775)
 at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1267)
 at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
 at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
 at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
 at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:343)
 at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
 at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:188)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:109)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:149)
 at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
 at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
 at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
 at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
 at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
 at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
 at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
 at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
 at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
 at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
 at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
 at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
 at org.mortbay.jetty.Server.handle(Server.java:326)
 at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
 at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943)
 at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
 at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
 at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
 at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
 at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.DataException: could not update: [com.digia.sesath.web.domain.Group#3]
 at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1235)
 at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1168)
 at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:1245)
 at org.hibernate.ejb.AbstractQueryImpl.executeUpdate(AbstractQueryImpl.java:108)
 at com.digia.sesath.web.service.ProfileService.findGroup(ProfileService.java:51)
 at com.digia.sesath.web.service.ProfileService$$FastClassByCGLIB$$492d6578.invoke()
 at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
 at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:692)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
 at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
 at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:625)
 at com.digia.sesath.web.service.ProfileService$$EnhancerByCGLIB$$932e77e4.findGroup()
 at com.digia.sesath.web.component.permissionManager.GroupUpdateBean.updateGroupDetails(GroupUpdateBean.java:56)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at javax.el.BeanELResolver.invokeMethod(BeanELResolver.java:737)
 at javax.el.BeanELResolver.invoke(BeanELResolver.java:467)
 at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:246)
 at com.sun.el.parser.AstValue.invoke(AstValue.java:228)
 at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
 at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:98)
 at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
 ... 57 more
Caused by: org.hibernate.exception.DataException: could not update: [com.digia.sesath.web.domain.Group#3]
 at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:102)
 at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
 at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2596)
 at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2478)
 at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2805)
 at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:114)
 at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:268)
 at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:260)
 at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:180)
 at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
 at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:64)
 at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1175)
 at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1273)
 at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:117)
 at org.hibernate.ejb.QueryImpl.internalExecuteUpdate(QueryImpl.java:183)
 at org.hibernate.ejb.AbstractQueryImpl.executeUpdate(AbstractQueryImpl.java:99)
 ... 78 more
Caused by: java.sql.SQLException: data exception: string data, right truncation
 at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
 at org.hsqldb.jdbc.JDBCPreparedStatement.fetchResult(Unknown Source)
 at org.hsqldb.jdbc.JDBCPreparedStatement.executeUpdate(Unknown Source)
 at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
 at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
 at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2578)
 ... 91 more
Caused by: org.hsqldb.HsqlException: data exception: string data, right truncation
 at org.hsqldb.error.Error.error(Unknown Source)
 at org.hsqldb.error.Error.error(Unknown Source)
 at org.hsqldb.types.BinaryType.castOrConvertToType(Unknown Source)
 at org.hsqldb.types.BinaryType.convertToType(Unknown Source)
 at org.hsqldb.StatementDML.getUpdatedData(Unknown Source)
 at org.hsqldb.StatementDML.executeUpdateStatement(Unknown Source)
 at org.hsqldb.StatementDML.getResult(Unknown Source)
 at org.hsqldb.StatementDMQL.execute(Unknown Source)
 at org.hsqldb.Session.executeCompiledStatement(Unknown Source)
 at org.hsqldb.Session.execute(Unknown Source)
 ... 96 more
30.11.2010 16:19:00 com.sun.faces.lifecycle.InvokeApplicationPhase execute
WARNING: #{groupUpdateBean.updateGroupDetails()}: javax.persistence.PersistenceException: org.hibernate.exception.DataException: could not update: []
javax.faces.FacesException: #{groupUpdateBean.updateGroupDetails()}: javax.persistence.PersistenceException: org.hibernate.exception.DataException: could not update: [Order#3]
 at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
 at javax.faces.component.UICommand.broadcast(UICommand.java:315)
 at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:775)
 at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1267)
 at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
 at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
 at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
 at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:343)
 at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
 at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at ```

答: Check that order.getId() is returning what you think it is. It sounds like the returned value is too large for the column size.

ContentLicense: CC BY-SA 2.5

Body:
I am using  JPA 2.0 and hibernate to save some data in a data base and to update them in a later time. Data is entered through a JSF 2.0 web based UI.it gives me a following exception and cant figure out what the reason is. I am new to all these so really need some help.

Thanks in advance and I've posted the code and the exception below.

int i=em.createQuery("UPDATE UserGroup g SET g.groupName = 'CrazyTest' WHERE g.id="+order.getId()).executeUpdate();

16:19:00.359 (31473614@qtp-21250902-2) WARN  - o.h.util.JDBCExceptionReporter: SQL Error: -3401, SQLState: 22001
16:19:00.359 (31473614@qtp-21250902-2) ERROR - o.h.util.JDBCExceptionReporter: data exception: string data, right truncation
16:19:00.375 (31473614@qtp-21250902-2) ERROR - o.h.e.d.AbstractFlushingEventListener: Could not synchronize database state with session
org.hibernate.exception.DataException: could not update:
 at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:102) ~[hibernate-core-3.5.1-Final.jar:3.5.1-Final]

Full Stack trace is copied below

16:19:00.359 (31473614@qtp-21250902-2) WARN  - o.h.util.JDBCExceptionReporter: SQL Error: -3401, SQLState: 22001
16:19:00.359 (31473614@qtp-21250902-2) ERROR - o.h.util.JDBCExceptionReporter: data exception: string data, right truncation
16:19:00.375 (31473614@qtp-21250902-2) ERROR - o.h.e.d.AbstractFlushingEventListener: Could not synchronize database state with session
org.hibernate.exception.DataException: could not update: [Order#3]
 at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:102) ~[hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) ~[hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2596) ~[hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2478) ~[hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2805) ~[hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:114) ~[hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:268) ~[hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:260) ~[hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:180) ~[hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321) ~[hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:64) [hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1175) [hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1273) [hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:117) [hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.ejb.QueryImpl.internalExecuteUpdate(QueryImpl.java:183) [hibernate-entitymanager-3.5.1-Final.jar:3.5.1-Final]
 at org.hibernate.ejb.AbstractQueryImpl.executeUpdate(AbstractQueryImpl.java:99) [hibernate-entitymanager-3.5.1-Final.jar:3.5.1-Final]
 at com.digia.sesath.web.service.ProfileService.findGroup(ProfileService.java:51) [classes/:na]
 at com.digia.sesath.web.service.ProfileService$$FastClassByCGLIB$$492d6578.invoke() [cglib-2.2.jar:na]
 at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191) [cglib-2.2.jar:na]
 at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:692) [spring-aop-3.0.2.RELEASE.jar:3.0.2.RELEASE]
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) [spring-aop-3.0.2.RELEASE.jar:3.0.2.RELEASE]
 at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) [spring-tx-3.0.2.RELEASE.jar:3.0.2.RELEASE]
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [spring-aop-3.0.2.RELEASE.jar:3.0.2.RELEASE]
 at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:625) [spring-aop-3.0.2.RELEASE.jar:3.0.2.RELEASE]
 at com.digia.sesath.web.service.ProfileService$$EnhancerByCGLIB$$932e77e4.findGroup() [cglib-2.2.jar:na]
 at com.digia.sesath.web.component.permissionManager.GroupUpdateBean.updateGroupDetails(GroupUpdateBean.java:56) [classes/:na]
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_18]
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_18]
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_18]
 at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_18]
 at javax.el.BeanELResolver.invokeMethod(BeanELResolver.java:737) [el-api-2.2.jar:na]
 at javax.el.BeanELResolver.invoke(BeanELResolver.java:467) [el-api-2.2.jar:na]
 at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:246) [el-api-2.2.jar:na]
 at com.sun.el.parser.AstValue.invoke(AstValue.java:228) [el-impl-2.2.jar:na]
 at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297) [el-impl-2.2.jar:na]
 at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:98) [jsf-impl-2.0.2.jar:2.0.2-FCS]
 at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88) [jsf-api-2.0.jar:2.0.2-SNAPSHOT]
 at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102) [jsf-impl-2.0.2.jar:2.0.2-FCS]
 at javax.faces.component.UICommand.broadcast(UICommand.java:315) [jsf-api-2.0.jar:2.0.2-SNAPSHOT]
 at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:775) [jsf-api-2.0.jar:2.0.2-SNAPSHOT]
 at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1267) [jsf-api-2.0.jar:2.0.2-SNAPSHOT]
 at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82) [jsf-impl-2.0.2.jar:2.0.2-FCS]
 at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.0.2.jar:2.0.2-FCS]
 at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.0.2.jar:2.0.2-FCS]
 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312) [jsf-api-2.0.jar:2.0.2-SNAPSHOT]
 at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166) [jetty-6.1.24.jar:6.1.24]
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:343) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:188) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:109) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:149) [spring-security-web-3.0.2.RELEASE.jar:na]
 at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237) [spring-web-3.0.2.RELEASE.jar:3.0.2.RELEASE]
 at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) [spring-web-3.0.2.RELEASE.jar:3.0.2.RELEASE]
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) [jetty-6.1.24.jar:6.1.24]
 at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113) [spring-orm-3.0.2.RELEASE.jar:3.0.2.RELEASE]
 at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) [spring-web-3.0.2.RELEASE.jar:3.0.2.RELEASE]
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.Server.handle(Server.java:326) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410) [jetty-6.1.24.jar:6.1.24]
 at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) [jetty-util-6.1.24.jar:6.1.24]
Caused by: java.sql.SQLException: data exception: string data, right truncation
 at org.hsqldb.jdbc.Util.sqlException(Unknown Source) ~[hsqldb-2.0.0.jar:2.0.0]
 at org.hsqldb.jdbc.JDBCPreparedStatement.fetchResult(Unknown Source) ~[hsqldb-2.0.0.jar:2.0.0]
 at org.hsqldb.jdbc.JDBCPreparedStatement.executeUpdate(Unknown Source) ~[hsqldb-2.0.0.jar:2.0.0]
 at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) ~[commons-dbcp-1.4.jar:1.4]
 at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) ~[commons-dbcp-1.4.jar:1.4]
 at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2578) ~[hibernate-core-3.5.1-Final.jar:3.5.1-Final]
 ... 91 common frames omitted
Caused by: org.hsqldb.HsqlException: data exception: string data, right truncation
 at org.hsqldb.error.Error.error(Unknown Source) ~[hsqldb-2.0.0.jar:2.0.0]
 at org.hsqldb.error.Error.error(Unknown Source) ~[hsqldb-2.0.0.jar:2.0.0]
 at org.hsqldb.types.BinaryType.castOrConvertToType(Unknown Source) ~[hsqldb-2.0.0.jar:2.0.0]
 at org.hsqldb.types.BinaryType.convertToType(Unknown Source) ~[hsqldb-2.0.0.jar:2.0.0]
 at org.hsqldb.StatementDML.getUpdatedData(Unknown Source) ~[hsqldb-2.0.0.jar:2.0.0]
 at org.hsqldb.StatementDML.executeUpdateStatement(Unknown Source) ~[hsqldb-2.0.0.jar:2.0.0]
 at org.hsqldb.StatementDML.getResult(Unknown Source) ~[hsqldb-2.0.0.jar:2.0.0]
 at org.hsqldb.StatementDMQL.execute(Unknown Source) ~[hsqldb-2.0.0.jar:2.0.0]
 at org.hsqldb.Session.executeCompiledStatement(Unknown Source) ~[hsqldb-2.0.0.jar:2.0.0]
 at org.hsqldb.Session.execute(Unknown Source) ~[hsqldb-2.0.0.jar:2.0.0]
 ... 96 common frames omitted
30.11.2010 16:19:00 com.sun.faces.application.ActionListenerImpl processAction
SEVERE: javax.persistence.PersistenceException: org.hibernate.exception.DataException: could not update: [Order#3]
javax.faces.el.EvaluationException: javax.persistence.PersistenceException: org.hibernate.exception.DataException: could not update: [Order#3]
 at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
 at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
 at javax.faces.component.UICommand.broadcast(UICommand.java:315)
 at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:775)
 at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1267)
 at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
 at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
 at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
 at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:343)
 at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
 at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:188)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:109)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:149)
 at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
 at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
 at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
 at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
 at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
 at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
 at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
 at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
 at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
 at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
 at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
 at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
 at org.mortbay.jetty.Server.handle(Server.java:326)
 at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
 at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943)
 at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
 at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
 at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
 at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
 at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.DataException: could not update: [com.digia.sesath.web.domain.Group#3]
 at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1235)
 at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1168)
 at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:1245)
 at org.hibernate.ejb.AbstractQueryImpl.executeUpdate(AbstractQueryImpl.java:108)
 at com.digia.sesath.web.service.ProfileService.findGroup(ProfileService.java:51)
 at com.digia.sesath.web.service.ProfileService$$FastClassByCGLIB$$492d6578.invoke()
 at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
 at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:692)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
 at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
 at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:625)
 at com.digia.sesath.web.service.ProfileService$$EnhancerByCGLIB$$932e77e4.findGroup()
 at com.digia.sesath.web.component.permissionManager.GroupUpdateBean.updateGroupDetails(GroupUpdateBean.java:56)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at javax.el.BeanELResolver.invokeMethod(BeanELResolver.java:737)
 at javax.el.BeanELResolver.invoke(BeanELResolver.java:467)
 at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:246)
 at com.sun.el.parser.AstValue.invoke(AstValue.java:228)
 at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
 at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:98)
 at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
 ... 57 more
Caused by: org.hibernate.exception.DataException: could not update: [com.digia.sesath.web.domain.Group#3]
 at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:102)
 at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
 at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2596)
 at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2478)
 at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2805)
 at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:114)
 at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:268)
 at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:260)
 at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:180)
 at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
 at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:64)
 at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1175)
 at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1273)
 at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:117)
 at org.hibernate.ejb.QueryImpl.internalExecuteUpdate(QueryImpl.java:183)
 at org.hibernate.ejb.AbstractQueryImpl.executeUpdate(AbstractQueryImpl.java:99)
 ... 78 more
Caused by: java.sql.SQLException: data exception: string data, right truncation
 at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
 at org.hsqldb.jdbc.JDBCPreparedStatement.fetchResult(Unknown Source)
 at org.hsqldb.jdbc.JDBCPreparedStatement.executeUpdate(Unknown Source)
 at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
 at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
 at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2578)
 ... 91 more
Caused by: org.hsqldb.HsqlException: data exception: string data, right truncation
 at org.hsqldb.error.Error.error(Unknown Source)
 at org.hsqldb.error.Error.error(Unknown Source)
 at org.hsqldb.types.BinaryType.castOrConvertToType(Unknown Source)
 at org.hsqldb.types.BinaryType.convertToType(Unknown Source)
 at org.hsqldb.StatementDML.getUpdatedData(Unknown Source)
 at org.hsqldb.StatementDML.executeUpdateStatement(Unknown Source)
 at org.hsqldb.StatementDML.getResult(Unknown Source)
 at org.hsqldb.StatementDMQL.execute(Unknown Source)
 at org.hsqldb.Session.executeCompiledStatement(Unknown Source)
 at org.hsqldb.Session.execute(Unknown Source)
 ... 96 more
30.11.2010 16:19:00 com.sun.faces.lifecycle.InvokeApplicationPhase execute
WARNING: #{groupUpdateBean.updateGroupDetails()}: javax.persistence.PersistenceException: org.hibernate.exception.DataException: could not update: []
javax.faces.FacesException: #{groupUpdateBean.updateGroupDetails()}: javax.persistence.PersistenceException: org.hibernate.exception.DataException: could not update: [Order#3]
 at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
 at javax.faces.component.UICommand.broadcast(UICommand.java:315)
 at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:775)
 at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1267)
 at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
 at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
 at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
 at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:343)
 at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
 at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
 at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
 at