Topic
2 replies Latest Post - ‏2011-02-03T14:56:11Z by sutter
SystemAdmin
SystemAdmin
45 Posts
ACCEPTED ANSWER

Pinned topic ExternalValues does not seems to be working?

‏2011-02-03T11:36:32Z |
Hi,

I am doing a POC with JPA 2.0 on WAS7 server embedded in RAD 8. I have WAS 7.0.0.13 with JPA 2.0 feature pack installed.

I am trying to use ExternalValues annotation as in following:
[code]

package com.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.apache.openjpa.persistence.ExternalValues;
import org.apache.openjpa.persistence.Type;
/**
* The persistent class for the REG_APPLICATION database table.
*
*/
@Entity
@Table(name="REG_APPLICATION")
public class RegApplication implements Serializable {
private static final long serialVersionUID = 1L;

@Id
@SequenceGenerator(name="REG_APPLICATION_REGAPPLICATIONID_GENERATOR", sequenceName="REG_APPLICATION_ID_SEQ")
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="REG_APPLICATION_REGAPPLICATIONID_GENERATOR")
@Column(name="REG_APPLICATION_ID")
private long regApplicationId;

@Column(name="IS_ACTIVE")
@ExternalValues({"true='Y'", "false='N'"})
@Type(char.class)
private Boolean isActive;

public RegApplication() {
}

public long getRegApplicationId() {
return this.regApplicationId;
}

public Boolean getIsActive() {
return this.isActive;
}

public void setIsActive(Boolean isActive) {
this.isActive = isActive;
}

}
[/code]

I enhanced the byte code using wsenhancer before deploying it in the WAS7. However, it seems not to convert boolean values to 'Y' or 'N'.

It is generating following query: INSERT INTO SCOTT.REG_APPLICATION (REG_APPLICATION_ID, IS_ACTIVE) VALUES (?, ?) params=(long) 1101, (int) 78

Am I missing something or is it not working as expected?

Cheers,
Amit
Updated on 2011-02-03T14:56:11Z at 2011-02-03T14:56:11Z by sutter
  • sutter
    sutter
    94 Posts
    ACCEPTED ANSWER

    Re: ExternalValues does not seems to be working?

    ‏2011-02-03T14:55:35Z  in response to SystemAdmin
    It looks like this question was on two separate forums. I have already responded on the other forum...

    <http://www.ibm.com/developerworks/forums/thread.jspa?messageID=14578367>

    Thanks,
    Kevin
  • sutter
    sutter
    94 Posts
    ACCEPTED ANSWER

    Re: ExternalValues does not seems to be working?

    ‏2011-02-03T14:56:11Z  in response to SystemAdmin
    Covered on a separate forum. Link was in previous reply.