[JBoss Seam] - Re: Mixing Hibernate & EJB3
by MSchmidke
"gavin king" wrote : You _will_ need a hibernate.cfg.xml, of course!
Will I? But ... until now, I never needed one. persistence.xml was all I had.
Ok, when I create one, will I only have to put this session-factory entry into it? Or will I have to move configuration parameters from persistence.xml into hibernate.cfg.xml?
persistence.xml:
| <?xml version="1.0" encoding="UTF-8"?>
|
| <persistence>
| <persistence-unit name="LeistungserfassungEntityManager">
| <jta-data-source>java:/LeistungserfassungDS</jta-data-source>
| <properties>
| <property name="hibernate.hbm2ddl.auto" value=""/>
| <property name="hibernate.show_sql" value="true"/>
| <property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect" />
| <property name="hibernate.max_fetch_depth" value="0" />
| <property name="hibernate.default_batch_fetch_size" value="100" />
| <property name="hibernate.use_sql_comments" value="true" />
| <property name="hibernate.bytecode.use_reflection_optimizer" value="false" />
| </properties>
| </persistence-unit>
| </persistence>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961292#3961292
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961292
19 years, 9 months
[EJB 3.0] - Override Primary Key Mapping
by poupou
Hi,
I am trying to override the primary key mapping in subclasses. The problem is that the table created for the subclass keeps both two columns: the primary key of the superclass and the overriden mapping.
Here is the code:
@Entity
@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
public abstract class MyAbstractSuper {
private Long id_MyAbstractSuper;
@Id
public Long getId_MyAbstractSuper() {
return id_MyAbstractSuper;
}
public void setId_MyAbstractSuper(Long id_MyAbstractSuper) {
this.id_MyAbstractSuper = id_MyAbstractSuper;
}
}
@Entity
@Table(name="MySubClass")
@AttributeOverride(name="id_MyAbstractSuper",column=@Column(name="id_MySubClass"))
public class MySubClass extends MyAbstractSuperclass {
@Override
public Long getId_MyAbstractSuperclass(){
return super.getId_MyAbstractSuperclass();
}
}
I read that there was a bug with javassist and tried to replace it with cglib but the problem still remains.
Thank you.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961283#3961283
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961283
19 years, 9 months