Results 1 to 1 of 1
  1. #1
    mrblack is offline Member
    Join Date
    Feb 2011
    Rep Power

    Default OpenJPA + DB2 + WebSphere

    Hi, I'm working on my school project where I need to create SessionBeans Entity Classes corresponding to database which is in this case DB2. Right now I'm living my worst programming nightmare, because I have been trying to figure out how to persist simple Entity with single attribute (generated ID), with no effect for 5 days. I'm able to persist Entity with two or more attributes, but I can't crack this one. After persist of following Entity I'm getting as it's ID null instead of generated value from DB2. Can somebody help me please? Thx

    Entity class:
    XML Code:
    package entity;
    import javax.persistence.*;
    @Table(name = "BINDING")
    public class Binding implements Serializable {
    	private static final long serialVersionUID = 1L;
    	private Long bindingId;
    	public Binding() {
    	@GeneratedValue(strategy = GenerationType.IDENTITY)
    	@Column(name = "BINDING_ID", unique = true, nullable = false)
    	public Long getBindingId() {
    		return this.bindingId;
    	public void setBindingId(Long bindingId) {
    		this.bindingId = bindingId;
    XML Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="2.0"
    	xmlns="" xmlns:xsi=""
    	<persistence-unit name="AppEJB" transaction-type="JTA">
    			<property name="openjpa.jdbc.Schema" value="BOOKSTORE" />
    			<property name="openjpa.jdbc.DBDictionary" value="db2" />
    Manage for entity:
    XML Code:
    package manager;
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    import entity.Binding;
    @Stateless(name = "bookManager", mappedName = "bookManager")
    public class BookManager implements BookManagerRemote {
    	@PersistenceContext(unitName = "AppEJB")
    	private EntityManager em;
    	protected EntityManager getEntityManager() {
    		return em;
    	public BookManager() {
    	public Binding create(Binding binding) {
    		return binding;
    I think the problem is that this generates SQL:
    XML Code:
    instead of
    XML Code:
    Last edited by mrblack; 02-27-2011 at 03:48 PM. Reason: missed something

Similar Threads

  1. SSL exception in websphere 6.1
    By shyamsundar1.g in forum Advanced Java
    Replies: 0
    Last Post: 10-29-2009, 05:52 AM
  2. Guide of development of WebSphere
    By Albert in forum Enterprise JavaBeans (EJB)
    Replies: 1
    Last Post: 07-06-2007, 08:29 AM
  3. Websphere doubt
    By Peter in forum Other IDEs
    Replies: 1
    Last Post: 07-05-2007, 03:47 AM
  4. Manual of websphere
    By Marcus in forum Web Frameworks
    Replies: 1
    Last Post: 06-27-2007, 05:01 PM
  5. Who will know like connecting from Websphere
    By Albert in forum Enterprise JavaBeans (EJB)
    Replies: 1
    Last Post: 06-27-2007, 04:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts