column « Insert « JPA Q&A

1. SQL insert avoid column names

In SQL insert, generally we specify the names of the columns in the SQL. Is there a way to generate that dynamically? basically if we specify the names of columns then ...

2. Hibernate insert with single column table problem

I'm using Hibernate with a SQLite database. I have the following class :

public abstract class Authority {

    private int idAuthority;
I ...

3. Sybase text column insert with Hibernate

Hi, I have a Sybase table that has a column of type TEXT. What I am doing is that, I am reading characters from a file, convert them into String object and then insert into this column. The value of the String gets into the TEXT column. The String object (roughly 4K characters) gets inserted successfully into the column and when ...

4. insert data into a column based on other column of the table

Hi, I would like to insert/update a column using a formula, which is similar to retrieving a column based on formula. Below is the sample code, --------------------------------- -------------------------------------- The idea, is to track department_id of an employee which will/can change frequently ...

5. Problem with INSERTED and UPDATED column

recently my product has been updated to hibernate3 from hibernate 2.8.1, we have one table in our schema called "XYZ", hibernate mapping file for the table looks like this: XyzService_Seq

6. I have a problem during inserting the data into the columns

Newbie Joined: Sat Oct 08, 2011 8:59 am Posts: 1 I am using derby database and here is my main class code package com.hibernate.test; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.AnnotationConfiguration; import org.hibernate.tool.hbm2ddl.SchemaExport; import com.hibernate.example.Employee; public class TestEmployee { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub try{ AnnotationConfiguration config = new AnnotationConfiguration(); config.addAnnotatedClass(Employee.class); ...

7. adding a constant column value when inserting?

I'm evaluating the possibility of using hibernate with our legacy database schema and when writing some test code I stumbled into this: Thre is an ADDRESS table in the database holding different types of addresses (email and postal). Each type is identified by a different ADDRESS_TYPE_ID. Now I want to map a set of Address objects to a Person corresponding to ...

8. insert many data into a single column

i have a user table which consists of property 'user_id' (primary key), 'first_name' and 'last_name'. i have another service table which consists of 'service_id' (primary key) and 'user_info'. is it possible for me to insert the all data collected in user table (last_name and first_name) to a single column 'user_info' in service table?

9. How to insert and update selective columns only?

Hi, Sometimes, we just want to update maybe 1 column value instead of 3 columns of a table. Say the table has name, address, contact. How should I specify my update statement in mapping file cos sometime I just want to update address, sometimes I just want to update the contact. Meaning depends on the condition, only certain columns should be ...

10. One-to-many bi-directional insert ok, update resets column

Newbie Joined: Mon Feb 11, 2008 12:59 pm Posts: 4 Problem: I have a one to many relationship where a user can have 1 or more Roles within the application. The available roles already exist in the DB, therefore the relationship is to a table that just holds the userId and roleId with no updating of the role table itself. It ...

11. Inserting text into a column

Author Message javydreamercsw Post subject: Inserting text into a column Posted: Fri May 29, 2009 6:49 pm Newbie Joined: Fri Jan 18, 2008 3:43 pm Posts: 9 I have the following working MySQL statement that is giving me issues if I place it in the import.sql file to be executed when the database is created: Code: INSERT INTO xinco_add_attribute ...