orm

Execute sql script after jpa/EclipseLink created tables?

Hello, is there a possibility to execute an sql script, after EclipseLink generated the ddl? In other words, is it possible that the EclipseLink property "eclipselink.ddl-generation" with "drop-and-create-tables" is used and EclipseLink executes another sql-file (to insert some data into some tables just created) after creating the ta...

How do I map a composite primary key in Entity Framework 4 code first?

I'm getting to grips with EF4 code first, and liking it so far. But I'm having trouble mapping an entity to a table with a composite primary key. The configuration I've tried looks like this: public SubscriptionUserConfiguration() { Property(u => u.SubscriptionID).IsIdentity(); Property(u => u.UserN...

ORM/ADO.NET data services for asp.net-mvc web application..

As i am a beginner to asp.net-mvc which should i use ORM/ADO.NET data services.... As far as i see all the examples are only with ORM support.... So experts please guide me on this... ...

Partioning with Hibernate

Hello, We have a requirement to delete data in the range of 200K from database everyday. Our application is Java/JEE based using Oracle DB and Hibernate ORM tool. We explored various options like Hibernate batch processing Stored procedure Database partitioning Our DBA suggests database partitioning is the best way to go, so we can...

How to I define/change the mappings for Linq To Sql in code.

I wish to be able to change the table a class is mapped to at run time, I can’t do this if all the mappings are defined with attributes. Therefore is there a way to define the mappings at runtime in code. (I would rather not have to maintain xml mapping files.) Say I have two tables: OldData NewData and sometimes I wished to que...

JPA 2.0 Eclipse Link

I have this code @Column(updatable=false) @Enumerated(EnumType.STRING) private ExamType examType; However, I can still change the value when I update it via merge. Why? ...

Hibernate Bi- Directional many to many mapping advice!

hi all, i woundered if anyone might be able to help me out. I am trying to work out what to google for (or any other ideas!!) basically i have a bidirectional many to many mapping between a user entity and a club entity (via a join table called userClubs) I now want to include a column in userClubs that represents the role so that when ...

Should I invest time in learning about OR\M or LINQ?

I'm a .NET web developer primarily who occasionally writes console applications to mine data, cleanup tasks, etc. Most of what I do winds up involving a database which I currently design via sql server management studio, using stored procedures, and query analyzer. I also create a lot of web services which are consumed via AJAX applica...

How to use an external file for database configuration in EJB environment

I need to have a file for database configuration outside of EAR file of my EJB application. Even if I define a datasource and call it via JNDI, I still have some properties that I want to change, like hibernate.dialect or hibernate.show_sql, for example. I tried using: <property name="hibernate.ejb.cfgfile" value="some-file.xml" /> an...

JPA @TableGenerator shared between multiple entities

Hi Guys, I have a 'dog' Entitiy with an @Id and a @TableGenerator ... @TableGenerator(table = "seq", name = "dog_gen", pkColumnName = "seq_name", valueColumnName="seq_val") @Id @GeneratedValue(strategy = GenerationType.TABLE, generator = "dog_gen") private Long id; ... Is there a way to reuse the same table generator (dog_gen) in othe...

JPA IndirectSet changes not reflected in Spring frontend

EDIT: Solved, but I don't know what was different now. If anyone can explain what happened differently, I'd appreciate it. The way it's working now is by merging only the Parent, not the Child at all, like so: Parent parent = child.getParent(); parent.getChildren().add(child); getJpaTemplate().merge(parent); Now, it seems to be worki...

sql query with space in the value

How do I write where clause where the value has spaces: Actually I am using openJPA and I have to set parameter. The value i will be setting has a space, eg: String somevalue="firstname lastname"; query.setparameter(somevalue); I did this but doesnot work. Any suggestion will be appreciated. Thanks. ...

Different cache concurrent strategies for root entity and its collection (Hibernate with EHCache)?

Given example from Hibernate docs and modifying it so that root level entity (Customer) is read-only while one of its collections (tickets) is read-write: @Entity @Cache(usage = CacheConcurrencyStrategy.READ_ONLY) public class Customer { ... @OneToMany(...) @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) public Sor...

hibernate formula with column

I have a table with a column that will be encrypted by a trigger after the record is inserted. When I read the column, I need to apply a decrypt function in the hibernate domain class. While saving the object, the value of the column will be saved as such. While reading the column, apply a database function on the read data. @Formula an...

Do I really need an ORM?

We're about to begin development on a mid-size ASP.Net MVC 2 web site. For a typical page, we grab data and throw it up on the web page, i.e. there is not much pre-processing of the data before it is sent to the UI. We're now making the decision whether or not to use an ORM and if yes, which one. We had been looking at EF2 AKA EF4 (...

Where/when does the object impedence mismatch occur?

When people talk about object impedence mismatch, where does the mismatch happen? What can't a database interpret from an object model? Thanks ...

How to configure Hibernate database reverse engineering tool to map database table relation as a entites inheritance?

Is it possible to configure Hibernate reverse engineering and code generation tool in such a way that one-to-many relation between tables is mapped to entities inheritance instead of enrites relation? I have Person table and Employee table, which are related with the foreign key (Person contains basic information, Employee the rest). In...

em.persist seems doesn't persist data on postgreSQL db

I've got a simple java main which must write bean data on a PostgreSQL database. I use Entity manager to persist or update object. I use hibernate and toplink driver connection which are specified in persistence.xml file. When I call em.persist(obj), nothing is saved on database, I don't know why. here is my simple code: private static...

Getting an entity from a repository by a custom string

What is considered good practice for querying entites from a database using a simple string as a query parameters. Who should implement the method that "converts" the string to an Entity, and who should call this method? The repository, the entity, or some other object, like the controller in an MVC application? For a more concrete exam...

error : java.lang.String cannot be cast to coldfusion.cfc.CFCBeanProxy anyone know about this ?

Does anyone know about this error I get when I try to insert a foreign key value in my entry entity using ColdFusion 9 Hibernate integration? java.lang.ClassCastException: java.lang.String cannot be cast to coldfusion.cfc.CFCBeanProxy Root cause :org.hibernate.HibernateException: java.lang.ClassCastException: java.lang.String ...