generate « Column « JPA Q&A

1. Hibernates generates VARBINARY column with JPA @Enumerated annotation

Hibernates is generating a VARBINARY column with JPA @Enumerated annotation. I'm using SQL Server 2005 w/ JTDS driver. The mapping is dirt simple:

private MyEnum foo;
I would have expected Hibernate to generate ...

2. JPA: Database Generated columns

I am facing an issue with Hibernate and JPA. My requirement is column CreatedDTTM and LastUPDATEDDTTM should be populated at the DB level. I have tried following but no use. My ...

3. Generated column and table names in hibernate with underscore

how do I force hibernate to generate db schema such that it converts CamelCase into Underscores (using HBM)? Eg. I have:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC

4. Hibernate ID column always last in generated SQL

I have a model that looks like this:

public abstract class BaseEntity {
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "generator")
    @Column(name = "ID")

5. Why is ColdFusion/Hibernate adding the entity name as a prefix to column names in generated SQL?

I am running ColdFusion 9.01 with all the latest hotfixes applied as of this writing. I've been using ColdFusion 9's Hibernate integration on a production site for well over a year ...

6. Column appears twice - Hibernate generated prepared statemnt

Hi, Here are my hibernate mappings: Code: ...

7. Add a column to a generated table by a

8. Generated value for NON-PRIMARY column

I have a table that has a primary key and another value that is not a primary/foreign key, but is set as a not-null IDENTITY that is incremented by 1. How do I set this up in my mappings? This is what I am currently doing (originally generated from the database schema using a tool): Code: ...

9. Generated property that is not id column

Hibernate version:3.0 Name and version of the database you are using:Db2 8.1 Application type: Web application Hello, I would like to use an id generator to generate a value for a non-id property of one of my entities. The entity has an unique id (which is generated using a MultipleHiLoPerTableGenerator) but also a unique number which I would like to generate ...

10. Column not generated by HB3

Newbie Joined: Mon Sep 19, 2005 2:08 pm Posts: 3 I am using Hibernate 3.0.5 and have encountered a weird problem where a particular column is not included in the SQL though it has been stated in the mapping. I just want to verify that it is a subtle problem that my mapping may have introduced before actually concluding that it ...

11. The generated elt column

There are a number of posts about where the generated column named elt comes from. Haven't seen an answer. I'm getting it in a many-to-many bidirectional association using Map collections. Here is the Hibernate mapping: ...

12. Column is repeated in generated SQL... why?

I was experimenting with fetch="subselect" and noticed that the generated SQL repeats the id column (see below). I think I've noticed this in other situations too. Does anyone have an explanation? is it something I am doing wrong? thanks Carl Hibernate version: v3.2 Mapping documents:

13. Multiple generated columns in one table/class

I've got an Oracle 10g table that has one surrogate primary key and a couple of other columns. For the primary key, I'm using an Oracle sequence to populate the value. Easy enough. However, I'd like to use another Oracle sequence for another (non-primary or foreign key) column in the table. While this second generated field is not used for any ...

14. Unique column generation process

Hi, i have the next many to one relation: _____________WORKS_______________ WORK_ID (PK) BIGINT AUTOINCREMENT WORK_CODE VARCHAR(10) USER_ID BIGINT (FK) ___________USERS_________________ USER_ID (PK) BIGINT AUTOINCREMENT I have to generate the UNIQUE column WORK_CODE with the following format: 4 digits alphanumeric code identifying the owner (user)-6 digits autonumeric. For example, i'll have this 2 work_codes for one user. A001-000100 A001-000101 The next work ...

15. Column property generation

I have a table with two relationships coming in from another table. The foreign keys are named test1_id and test2_id in the database. In my reverse engineering file I have this to generate test1 and test2. Hibernate isn't generating either of these two it comes up with its own naming. Does anyone know where this is coming from? hibernate.reveng.xml

16. SQL generation error, column in wrong class

17. Custom type for auto-generated id column

Hi, I'd like to use a custom type for an id field, that's represented as an INTEGER in the database. I can't seem to get Hibernate to cope with this, as it's expecting either an Integer, Long, String, etc. in the case of auto-generated id assignment. Is there a way I can do this without having to write a setID(Integer id) ...

18. Auto generated value as column value

Hi all, I want to set an auto generated value in a column when ever a record is created in a table. The logic of creation of this value is as such : Value = base 36 converted value of primary key or the ID Is it possible to do using the Hibernate API or extending the hibernate API. I am ...

19. Can we assign generated value to more than one column?

Hi All, I have the below mapping to generate a value for the primary key in my table. SEQ_ACTIVITY_TABLE We added a new column ACTIVITY_ORDER to the table recently. Is there any way I can populate the ACTIVITY_ORDER with same value as ACTIVITY_NO through hibernate mapping? Any ...