View | Details | Raw Unified | Return to bug 265512
Collapse All | Expand All

(-)foundation/eclipselink.extension.oracle.test/build.xml (-3 / +10 lines)
Lines 119-126 Link Here
119
        <delete includeEmptyDirs="true" failonerror="false">
119
        <delete includeEmptyDirs="true" failonerror="false">
120
            <fileset dir="${classes.dir}"/>
120
            <fileset dir="${classes.dir}"/>
121
            <fileset file="${eclipselink.oracle.depend.test.jar}"/>
121
            <fileset file="${eclipselink.oracle.depend.test.jar}"/>
122
            <fileset file="eclipselink-struct-converter-model-tests.jar"/>
123
            <fileset file="eclipselink-struct-converter-model.jar"/>
122
            <fileset file="eclipselink-struct-converter-model.jar"/>
123
            <fileset file="eclipselink-customfeatures-model.jar"/>
124
            <fileset file="eclipselink-jpa-oracle-tests.jar"/>
124
        </delete>
125
        </delete>
125
    </target>
126
    </target>
126
127
Lines 154-162 Link Here
154
            <fileset dir="${classes.dir}"
155
            <fileset dir="${classes.dir}"
155
                     includes="org/eclipse/persistence/testing/models/jpa/**"/>
156
                     includes="org/eclipse/persistence/testing/models/jpa/**"/>
156
        </jar>
157
        </jar>
157
        <!-- Package the structconverter JPA tests jar. -->
158
        <!-- Package the customfeatures JPA model jar. -->
158
        <jar jarfile="eclipselink-struct-converter-model-tests.jar">
159
        <jar jarfile="eclipselink-customfeatures-model.jar">
160
            <zipfileset dir="resource/customfeatures" includes="*.xml" prefix="META-INF"/>
159
            <fileset dir="${classes.dir}"
161
            <fileset dir="${classes.dir}"
162
                     includes="org/eclipse/persistence/testing/models/jpa/customfeatures/**"/>
163
        </jar>
164
        <!-- Package the JPA oracle specific tests jar. -->
165
        <jar jarfile="eclipselink-jpa-oracle-tests.jar">
166
            <fileset dir="${classes.dir}"
160
                     includes="org/eclipse/persistence/testing/tests/jpa/**"/>
167
                     includes="org/eclipse/persistence/testing/tests/jpa/**"/>
161
        </jar>
168
        </jar>
162
        <!-- Build tests jar. -->
169
        <!-- Build tests jar. -->
(-)foundation/eclipselink.extension.oracle.test/resource/customfeatures/persistence.xml (+12 lines)
Line 0 Link Here
1
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence_1_0.xsd" version="1.0">
2
    <persistence-unit name="customfeatures" transaction-type="RESOURCE_LOCAL">
3
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
4
        <class>org.eclipse.persistence.testing.models.jpa.customfeatures.Employee</class>
5
        <property name="eclipselink.logging.level" value="FINEST"/>
6
        <property name="eclipselink.descriptor.customizer" value="org.eclipse.persistence.testing.models.jpa.customfeatures.XmlDataCustomizer"/>
7
        <property name="eclipselink.jdbc.batch-writing" value="Oracle-JDBC"/>
8
    </persistence-unit>
9
    
10
</persistence>
11
12
(-)foundation/eclipselink.extension.oracle.test/resource/customfeatures/persistence.xml (+12 lines)
Line 0 Link Here
1
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence_1_0.xsd" version="1.0">
2
    <persistence-unit name="customfeatures" transaction-type="RESOURCE_LOCAL">
3
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
4
        <class>org.eclipse.persistence.testing.models.jpa.customfeatures.Employee</class>
5
        <property name="eclipselink.logging.level" value="FINEST"/>
6
        <property name="eclipselink.descriptor.customizer" value="org.eclipse.persistence.testing.models.jpa.customfeatures.XmlDataCustomizer"/>
7
        <property name="eclipselink.jdbc.batch-writing" value="Oracle-JDBC"/>
8
    </persistence-unit>
9
    
10
</persistence>
11
12
(-)foundation/eclipselink.extension.oracle.test/src/org/eclipse/persistence/testing/models/jpa/customfeatures/Employee.java (+142 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 1998, 2008 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation from Oracle TopLink
12
 ******************************************************************************/  
13
package org.eclipse.persistence.testing.models.jpa.customfeatures;
14
15
import java.io.Serializable;
16
import javax.persistence.Column;
17
import javax.persistence.JoinColumn;
18
import javax.persistence.Entity;
19
import javax.persistence.GeneratedValue;
20
import javax.persistence.GenerationType;
21
import javax.persistence.Id;
22
import javax.persistence.Table;
23
import javax.persistence.SequenceGenerator;
24
import javax.persistence.Transient;
25
import javax.persistence.Version;
26
27
import org.w3c.dom.*;
28
29
import oracle.sql.*;
30
import org.eclipse.persistence.annotations.Convert;
31
import org.eclipse.persistence.annotations.NamedStoredProcedureQuery;
32
import org.eclipse.persistence.annotations.NamedStoredProcedureQueries;
33
import org.eclipse.persistence.annotations.StoredProcedureParameter;
34
import org.eclipse.persistence.annotations.TypeConverter;
35
import static org.eclipse.persistence.annotations.Direction.IN;
36
import static org.eclipse.persistence.annotations.Direction.IN_OUT;
37
import static org.eclipse.persistence.annotations.Direction.OUT;
38
import static org.eclipse.persistence.annotations.Direction.OUT_CURSOR;
39
import org.eclipse.persistence.platform.database.oracle.NString;
40
41
@Entity
42
@Table(name="CUSTOM_FEATURE_EMPLOYEE")
43
@NamedStoredProcedureQueries({
44
@NamedStoredProcedureQuery(
45
    name="ReadEmployeeInOut",
46
    resultClass=org.eclipse.persistence.testing.models.jpa.customfeatures.Employee.class,
47
    procedureName="Read_Employee_InOut",
48
    parameters={
49
        @StoredProcedureParameter(direction=IN_OUT, name="employee_id_v", queryParameter="ID", type=Integer.class),
50
        @StoredProcedureParameter(direction=OUT, name="nchar_v", queryParameter="NCHARTYPE", type=Character.class)}
51
),
52
@NamedStoredProcedureQuery(
53
    name="ReadEmployeeCursor",
54
    resultClass=org.eclipse.persistence.testing.models.jpa.customfeatures.Employee.class,
55
    procedureName="Read_Employee_Cursor",
56
    parameters={
57
        @StoredProcedureParameter(direction=IN, name="employee_id_v", queryParameter="ID", type=Integer.class),
58
        @StoredProcedureParameter(direction=OUT_CURSOR, queryParameter="RESULT_CURSOR")})
59
})
60
61
public class Employee implements Serializable {
62
63
    @SequenceGenerator(
64
      name="CUSTOMEMP_SEQ",
65
      sequenceName="EMPLOYEE_SEQUENCE",
66
      initialValue=50,
67
      allocationSize=1
68
    )
69
70
    @Id
71
    @Column(name="ID")
72
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="CUSTOMEMP_SEQ")
73
    private Integer id;
74
75
    @Column(name="NAME")
76
    private String name;
77
78
    @Version
79
    @Column(name="VERSION")
80
    private Integer version;
81
    
82
    @Column(name="NCHARTYPE")
83
    @Convert(value="NChar")
84
    @TypeConverter(name="NChar", dataType=NString.class)
85
    private Character empNChar;
86
    
87
    @Column(name="XMLData")
88
    private String resume_xml;
89
90
    //@Column(name="XMLDom") wait for fix for bug 265468 to use this annotation
91
    @Transient
92
    private Document resume_dom;
93
 
94
    public Employee() {}
95
96
    public Integer getId() {
97
        return this.id;
98
    }
99
100
    public String getName() {
101
        return this.name;
102
    }
103
104
    public void setName(String name) {
105
        this.name = name;
106
    }
107
108
    public Integer getVersion() {
109
        return version; 
110
    }
111
112
    public void setVersion(Integer version) {
113
        this.version = version;
114
    }
115
116
    public char getEmpNChar() {
117
        return this.empNChar;
118
    }
119
120
    public void setEmpNChar(char empNChar) {
121
        this.empNChar = empNChar;
122
    }
123
    
124
    public String getReume_xml() {
125
        return this.resume_xml;
126
    }
127
128
    public void setResume_xml(String resume_xml) {
129
        this.resume_xml = resume_xml;
130
    }
131
132
    public Document getReume_dom() {
133
        return this.resume_dom;
134
    }
135
136
    public void setResume_dom(Document resume_dom) {
137
        this.resume_dom = resume_dom;
138
    }
139
140
    
141
}
142
(-)foundation/eclipselink.extension.oracle.test/src/org/eclipse/persistence/testing/models/jpa/customfeatures/XmlDataCustomizer.java (+36 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 1998, 2008 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation from Oracle TopLink
12
 ******************************************************************************/  
13
package org.eclipse.persistence.testing.models.jpa.customfeatures;
14
15
import org.eclipse.persistence.descriptors.ClassDescriptor;
16
import org.eclipse.persistence.sessions.factories.DescriptorCustomizer;
17
import org.eclipse.persistence.mappings.xdb.DirectToXMLTypeMapping;
18
19
public class XmlDataCustomizer implements DescriptorCustomizer {
20
21
    public void customize(final ClassDescriptor descriptor) throws Exception{
22
         descriptor.removeMappingForAttributeName("resume_xml");
23
         DirectToXMLTypeMapping mapping1 = new DirectToXMLTypeMapping();
24
         mapping1.setAttributeName("resume_xml");
25
         mapping1.setFieldName("XMLDATA");
26
         descriptor.addMapping(mapping1);
27
28
         descriptor.removeMappingForAttributeName("resume_dom");
29
         DirectToXMLTypeMapping mapping2 = new DirectToXMLTypeMapping();
30
         mapping2.setAttributeName("resume_dom");
31
         mapping2.setFieldName("XMLDom");
32
         descriptor.addMapping(mapping2);
33
34
     }
35
}
36
(-)foundation/eclipselink.extension.oracle.test/src/org/eclipse/persistence/testing/models/jpa/customfeatures/EmployeeTableCreator.java (+93 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 1998, 2008 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation from Oracle TopLink
12
 ******************************************************************************/  
13
package org.eclipse.persistence.testing.models.jpa.customfeatures;
14
15
import org.eclipse.persistence.tools.schemaframework.*;
16
17
public class EmployeeTableCreator extends TableCreator {
18
    public EmployeeTableCreator() {
19
        setName("CustomFeatureEmployeeProject");
20
21
        addTableDefinition(buildEmployeeTable());
22
    }
23
    
24
    public static TableDefinition buildEmployeeTable() {
25
        TableDefinition table = new TableDefinition();
26
        table.setName("CUSTOM_FEATURE_EMPLOYEE");
27
28
        FieldDefinition fieldID = new FieldDefinition();
29
        fieldID.setName("ID");
30
        fieldID.setTypeName("NUMERIC");
31
        fieldID.setSize(15);
32
        fieldID.setSubSize(0);
33
        fieldID.setIsPrimaryKey(true);
34
        fieldID.setIsIdentity(true);
35
        fieldID.setUnique(false);
36
        fieldID.setShouldAllowNull(false);
37
        table.addField(fieldID);
38
39
        FieldDefinition fieldNAME = new FieldDefinition();
40
        fieldNAME.setName("NAME");
41
        fieldNAME.setTypeName("VARCHAR2");
42
        fieldNAME.setSize(60);
43
        fieldNAME.setSubSize(0);
44
        fieldNAME.setIsPrimaryKey(false);
45
        fieldNAME.setIsIdentity(false);
46
        fieldNAME.setUnique(false);
47
        fieldNAME.setShouldAllowNull(true);
48
        table.addField(fieldNAME);
49
50
        FieldDefinition fieldNCH = new FieldDefinition();
51
        fieldNCH.setName("NCHARTYPE");
52
        fieldNCH.setTypeName("NCHAR");
53
        fieldNCH.setSize(1);
54
        fieldNCH.setSubSize(0);
55
        fieldNCH.setIsPrimaryKey(false);
56
        fieldNCH.setIsIdentity(false);
57
        fieldNCH.setUnique(false);
58
        fieldNCH.setShouldAllowNull(true);
59
        table.addField(fieldNCH);
60
      
61
        FieldDefinition fieldXMLDATA = new FieldDefinition();
62
        fieldXMLDATA.setName("XMLData");
63
        fieldXMLDATA.setTypeName("XMLTYPE");
64
        fieldXMLDATA.setIsPrimaryKey(false);
65
        fieldXMLDATA.setIsIdentity(false);
66
        fieldXMLDATA.setUnique(false);
67
        fieldXMLDATA.setShouldAllowNull(true);
68
        table.addField(fieldXMLDATA);
69
70
        FieldDefinition fieldXMLDOM = new FieldDefinition();
71
        fieldXMLDOM.setName("XMLDom");
72
        fieldXMLDOM.setTypeName("XMLTYPE");
73
        fieldXMLDOM.setIsPrimaryKey(false);
74
        fieldXMLDOM.setIsIdentity(false);
75
        fieldXMLDOM.setUnique(false);
76
        fieldXMLDOM.setShouldAllowNull(true);
77
        table.addField(fieldXMLDOM);
78
79
        FieldDefinition fieldVERSION = new FieldDefinition();
80
        fieldVERSION.setName("VERSION");
81
        fieldVERSION.setTypeName("NUMERIC");
82
        fieldVERSION.setSize(15);
83
        fieldVERSION.setShouldAllowNull(true);
84
        fieldVERSION.setIsPrimaryKey(false);
85
        fieldVERSION.setUnique(false);
86
        fieldVERSION.setIsIdentity(false);
87
        table.addField(fieldVERSION);
88
89
        return table;
90
    }
91
    
92
     
93
}
(-)foundation/eclipselink.extension.oracle.test/src/org/eclipse/persistence/testing/models/jpa/customfeatures/Employee.java (+142 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 1998, 2008 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation from Oracle TopLink
12
 ******************************************************************************/  
13
package org.eclipse.persistence.testing.models.jpa.customfeatures;
14
15
import java.io.Serializable;
16
import javax.persistence.Column;
17
import javax.persistence.JoinColumn;
18
import javax.persistence.Entity;
19
import javax.persistence.GeneratedValue;
20
import javax.persistence.GenerationType;
21
import javax.persistence.Id;
22
import javax.persistence.Table;
23
import javax.persistence.SequenceGenerator;
24
import javax.persistence.Transient;
25
import javax.persistence.Version;
26
27
import org.w3c.dom.*;
28
29
import oracle.sql.*;
30
import org.eclipse.persistence.annotations.Convert;
31
import org.eclipse.persistence.annotations.NamedStoredProcedureQuery;
32
import org.eclipse.persistence.annotations.NamedStoredProcedureQueries;
33
import org.eclipse.persistence.annotations.StoredProcedureParameter;
34
import org.eclipse.persistence.annotations.TypeConverter;
35
import static org.eclipse.persistence.annotations.Direction.IN;
36
import static org.eclipse.persistence.annotations.Direction.IN_OUT;
37
import static org.eclipse.persistence.annotations.Direction.OUT;
38
import static org.eclipse.persistence.annotations.Direction.OUT_CURSOR;
39
import org.eclipse.persistence.platform.database.oracle.NString;
40
41
@Entity
42
@Table(name="CUSTOM_FEATURE_EMPLOYEE")
43
@NamedStoredProcedureQueries({
44
@NamedStoredProcedureQuery(
45
    name="ReadEmployeeInOut",
46
    resultClass=org.eclipse.persistence.testing.models.jpa.customfeatures.Employee.class,
47
    procedureName="Read_Employee_InOut",
48
    parameters={
49
        @StoredProcedureParameter(direction=IN_OUT, name="employee_id_v", queryParameter="ID", type=Integer.class),
50
        @StoredProcedureParameter(direction=OUT, name="nchar_v", queryParameter="NCHARTYPE", type=Character.class)}
51
),
52
@NamedStoredProcedureQuery(
53
    name="ReadEmployeeCursor",
54
    resultClass=org.eclipse.persistence.testing.models.jpa.customfeatures.Employee.class,
55
    procedureName="Read_Employee_Cursor",
56
    parameters={
57
        @StoredProcedureParameter(direction=IN, name="employee_id_v", queryParameter="ID", type=Integer.class),
58
        @StoredProcedureParameter(direction=OUT_CURSOR, queryParameter="RESULT_CURSOR")})
59
})
60
61
public class Employee implements Serializable {
62
63
    @SequenceGenerator(
64
      name="CUSTOMEMP_SEQ",
65
      sequenceName="EMPLOYEE_SEQUENCE",
66
      initialValue=50,
67
      allocationSize=1
68
    )
69
70
    @Id
71
    @Column(name="ID")
72
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="CUSTOMEMP_SEQ")
73
    private Integer id;
74
75
    @Column(name="NAME")
76
    private String name;
77
78
    @Version
79
    @Column(name="VERSION")
80
    private Integer version;
81
    
82
    @Column(name="NCHARTYPE")
83
    @Convert(value="NChar")
84
    @TypeConverter(name="NChar", dataType=NString.class)
85
    private Character empNChar;
86
    
87
    @Column(name="XMLData")
88
    private String resume_xml;
89
90
    //@Column(name="XMLDom") wait for fix for bug 265468 to use this annotation
91
    @Transient
92
    private Document resume_dom;
93
 
94
    public Employee() {}
95
96
    public Integer getId() {
97
        return this.id;
98
    }
99
100
    public String getName() {
101
        return this.name;
102
    }
103
104
    public void setName(String name) {
105
        this.name = name;
106
    }
107
108
    public Integer getVersion() {
109
        return version; 
110
    }
111
112
    public void setVersion(Integer version) {
113
        this.version = version;
114
    }
115
116
    public char getEmpNChar() {
117
        return this.empNChar;
118
    }
119
120
    public void setEmpNChar(char empNChar) {
121
        this.empNChar = empNChar;
122
    }
123
    
124
    public String getReume_xml() {
125
        return this.resume_xml;
126
    }
127
128
    public void setResume_xml(String resume_xml) {
129
        this.resume_xml = resume_xml;
130
    }
131
132
    public Document getReume_dom() {
133
        return this.resume_dom;
134
    }
135
136
    public void setResume_dom(Document resume_dom) {
137
        this.resume_dom = resume_dom;
138
    }
139
140
    
141
}
142
(-)foundation/eclipselink.extension.oracle.test/src/org/eclipse/persistence/testing/models/jpa/customfeatures/EmployeeTableCreator.java (+93 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 1998, 2008 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation from Oracle TopLink
12
 ******************************************************************************/  
13
package org.eclipse.persistence.testing.models.jpa.customfeatures;
14
15
import org.eclipse.persistence.tools.schemaframework.*;
16
17
public class EmployeeTableCreator extends TableCreator {
18
    public EmployeeTableCreator() {
19
        setName("CustomFeatureEmployeeProject");
20
21
        addTableDefinition(buildEmployeeTable());
22
    }
23
    
24
    public static TableDefinition buildEmployeeTable() {
25
        TableDefinition table = new TableDefinition();
26
        table.setName("CUSTOM_FEATURE_EMPLOYEE");
27
28
        FieldDefinition fieldID = new FieldDefinition();
29
        fieldID.setName("ID");
30
        fieldID.setTypeName("NUMERIC");
31
        fieldID.setSize(15);
32
        fieldID.setSubSize(0);
33
        fieldID.setIsPrimaryKey(true);
34
        fieldID.setIsIdentity(true);
35
        fieldID.setUnique(false);
36
        fieldID.setShouldAllowNull(false);
37
        table.addField(fieldID);
38
39
        FieldDefinition fieldNAME = new FieldDefinition();
40
        fieldNAME.setName("NAME");
41
        fieldNAME.setTypeName("VARCHAR2");
42
        fieldNAME.setSize(60);
43
        fieldNAME.setSubSize(0);
44
        fieldNAME.setIsPrimaryKey(false);
45
        fieldNAME.setIsIdentity(false);
46
        fieldNAME.setUnique(false);
47
        fieldNAME.setShouldAllowNull(true);
48
        table.addField(fieldNAME);
49
50
        FieldDefinition fieldNCH = new FieldDefinition();
51
        fieldNCH.setName("NCHARTYPE");
52
        fieldNCH.setTypeName("NCHAR");
53
        fieldNCH.setSize(1);
54
        fieldNCH.setSubSize(0);
55
        fieldNCH.setIsPrimaryKey(false);
56
        fieldNCH.setIsIdentity(false);
57
        fieldNCH.setUnique(false);
58
        fieldNCH.setShouldAllowNull(true);
59
        table.addField(fieldNCH);
60
      
61
        FieldDefinition fieldXMLDATA = new FieldDefinition();
62
        fieldXMLDATA.setName("XMLData");
63
        fieldXMLDATA.setTypeName("XMLTYPE");
64
        fieldXMLDATA.setIsPrimaryKey(false);
65
        fieldXMLDATA.setIsIdentity(false);
66
        fieldXMLDATA.setUnique(false);
67
        fieldXMLDATA.setShouldAllowNull(true);
68
        table.addField(fieldXMLDATA);
69
70
        FieldDefinition fieldXMLDOM = new FieldDefinition();
71
        fieldXMLDOM.setName("XMLDom");
72
        fieldXMLDOM.setTypeName("XMLTYPE");
73
        fieldXMLDOM.setIsPrimaryKey(false);
74
        fieldXMLDOM.setIsIdentity(false);
75
        fieldXMLDOM.setUnique(false);
76
        fieldXMLDOM.setShouldAllowNull(true);
77
        table.addField(fieldXMLDOM);
78
79
        FieldDefinition fieldVERSION = new FieldDefinition();
80
        fieldVERSION.setName("VERSION");
81
        fieldVERSION.setTypeName("NUMERIC");
82
        fieldVERSION.setSize(15);
83
        fieldVERSION.setShouldAllowNull(true);
84
        fieldVERSION.setIsPrimaryKey(false);
85
        fieldVERSION.setUnique(false);
86
        fieldVERSION.setIsIdentity(false);
87
        table.addField(fieldVERSION);
88
89
        return table;
90
    }
91
    
92
     
93
}
(-)foundation/eclipselink.extension.oracle.test/src/org/eclipse/persistence/testing/models/jpa/customfeatures/XmlDataCustomizer.java (+36 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 1998, 2008 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation from Oracle TopLink
12
 ******************************************************************************/  
13
package org.eclipse.persistence.testing.models.jpa.customfeatures;
14
15
import org.eclipse.persistence.descriptors.ClassDescriptor;
16
import org.eclipse.persistence.sessions.factories.DescriptorCustomizer;
17
import org.eclipse.persistence.mappings.xdb.DirectToXMLTypeMapping;
18
19
public class XmlDataCustomizer implements DescriptorCustomizer {
20
21
    public void customize(final ClassDescriptor descriptor) throws Exception{
22
         descriptor.removeMappingForAttributeName("resume_xml");
23
         DirectToXMLTypeMapping mapping1 = new DirectToXMLTypeMapping();
24
         mapping1.setAttributeName("resume_xml");
25
         mapping1.setFieldName("XMLDATA");
26
         descriptor.addMapping(mapping1);
27
28
         descriptor.removeMappingForAttributeName("resume_dom");
29
         DirectToXMLTypeMapping mapping2 = new DirectToXMLTypeMapping();
30
         mapping2.setAttributeName("resume_dom");
31
         mapping2.setFieldName("XMLDom");
32
         descriptor.addMapping(mapping2);
33
34
     }
35
}
36
(-)foundation/eclipselink.extension.oracle.test/src/org/eclipse/persistence/testing/tests/jpa/customfeatures/CustomFeaturesJUnitTestSuite.java (+320 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 1998, 2008 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation from Oracle TopLink
12
 ******************************************************************************/  
13
package org.eclipse.persistence.testing.tests.jpa.customfeatures;
14
15
import java.io.*;
16
import java.util.Calendar;
17
import java.util.TimeZone;
18
import java.util.List;
19
import java.util.Map;
20
21
import org.w3c.dom.*;
22
23
import javax.xml.parsers.*;
24
import javax.persistence.EntityManager;
25
import javax.persistence.OptimisticLockException;
26
import javax.persistence.PersistenceException;
27
28
import junit.framework.*;
29
import org.eclipse.persistence.testing.framework.TestCase;
30
import org.eclipse.persistence.testing.framework.junit.JUnitTestCase;
31
import org.eclipse.persistence.testing.framework.QuerySQLTracker;
32
import org.eclipse.persistence.testing.models.jpa.customfeatures.*;
33
import org.eclipse.persistence.tools.schemaframework.PackageDefinition;
34
import org.eclipse.persistence.tools.schemaframework.StoredProcedureDefinition;
35
import org.eclipse.persistence.tools.schemaframework.SchemaManager;
36
import org.eclipse.persistence.sessions.DatabaseSession;
37
import org.eclipse.persistence.sessions.Session;
38
import org.eclipse.persistence.sessions.server.ServerSession;
39
40
public class CustomFeaturesJUnitTestSuite extends JUnitTestCase {
41
    private static int empId;
42
    protected static int NUM_INSERTS = 200;
43
        
44
    public CustomFeaturesJUnitTestSuite() {
45
        super();
46
    }
47
    
48
    public CustomFeaturesJUnitTestSuite(String name) {
49
        super(name);
50
    }
51
    
52
    public static Test suite() {
53
        TestSuite suite = new TestSuite();
54
        suite.setName("CustomFeaturesJUnitTestSuite");
55
        suite.addTest(new CustomFeaturesJUnitTestSuite("testSetup"));
56
        suite.addTest(new CustomFeaturesJUnitTestSuite("testNCharXMLType"));
57
        suite.addTest(new CustomFeaturesJUnitTestSuite("testBatchInserts"));
58
        suite.addTest(new CustomFeaturesJUnitTestSuite("testBatchUpdates"));
59
        suite.addTest(new CustomFeaturesJUnitTestSuite("testNamedStoredProcedureInOutQuery"));
60
        suite.addTest(new CustomFeaturesJUnitTestSuite("testNamedStoredProcedureCursorQuery"));
61
        return suite;
62
    }
63
    
64
    public void testSetup() {
65
        ServerSession session = JUnitTestCase.getServerSession("customfeatures");
66
        new EmployeeTableCreator().replaceTables(session);
67
        buildOraclePackage(session);
68
        buildOracleStoredProcedureReadFromEmployeeInOut(session);
69
        buildOracleStoredProcedureReadFromEmployeeCursor(session);
70
    }
71
72
    /**
73
     * Tests a NChar and XML Type with Document.
74
     */
75
    public void testNCharXMLType() {
76
        EntityManager em = createEntityManager("customfeatures");
77
        beginTransaction(em);
78
        Employee emp = null;
79
        try{
80
            emp = new Employee();
81
            emp.setResume_xml(resume0());
82
            char nCh = '\u0410';
83
            emp.setEmpNChar(nCh);
84
            emp.setResume_dom(documentFromString(resume0()));
85
            em.persist(emp);
86
            empId = emp.getId();
87
            commitTransaction(em);
88
        } catch (RuntimeException e) {
89
            if (isTransactionActive(em)){
90
                rollbackTransaction(em);
91
            }
92
            closeEntityManager(em);
93
            throw e;
94
        }
95
96
        try{
97
            Employee readEmp = em.find(Employee.class, empId);
98
            if (!getServerSession("customfeatures").compareObjects(readEmp, emp)) {
99
                closeEntityManager(em);
100
                fail("Object: " + readEmp + " does not match object that was written: " + emp + ". See log (on finest) for what did not match.");
101
            } 
102
        } catch (Exception exception ) {
103
            closeEntityManager(em);
104
            fail("entityManager.refresh(removedObject) threw a wrong exception: " + exception.getMessage());
105
        }
106
       closeEntityManager(em);
107
    }
108
109
    /**
110
     * Tests a Native Batch Writing as batch inserts.
111
     */
112
    public void testBatchInserts() {
113
        EntityManager em = createEntityManager("customfeatures");
114
        beginTransaction(em);
115
        try{
116
            for (int i = 0; i < NUM_INSERTS; i++) {
117
                Employee emp = new Employee();
118
                emp.setResume_xml(resume0());
119
                char nCh = '\u0410';
120
                emp.setEmpNChar(nCh);
121
                em.persist(emp);
122
            }
123
            commitTransaction(em);
124
        } catch (RuntimeException e) {
125
            if (isTransactionActive(em)){
126
                rollbackTransaction(em);
127
            }
128
            throw e;
129
        } finally{
130
            closeEntityManager(em);
131
        }
132
    }
133
134
    /**
135
     * Tests a Native Batch Writing as batch updates with OptimisticLockingException.
136
     */
137
    public void testBatchUpdates() {
138
        QuerySQLTracker counter = null;
139
        EntityManager em = createEntityManager("customfeatures");
140
        beginTransaction(em);
141
        counter = new QuerySQLTracker(getServerSession("customfeatures"));
142
        List emps = em.createQuery("SELECT OBJECT(e) FROM Employee e").getResultList();
143
        if (isOnServer){
144
            try {
145
                for(int i=0; i<emps.size(); i++) {
146
                    Employee e = (Employee)emps.get(i);
147
                    String newName = ((Employee)emps.get(i)).getName() + i + "test";
148
                    e.setName(newName);
149
                    e.setVersion(e.getVersion()-1);
150
                }
151
                commitTransaction(em);
152
                fail("OptimisticLockingException is not thrown!");
153
            }  catch (RuntimeException exception ) {
154
                closeEntityManager(em);
155
            }
156
        }else{
157
            try {
158
                for(int i=0; i<emps.size(); i++) {
159
                    Employee e = (Employee)emps.get(i);
160
                    String newName = ((Employee)emps.get(i)).getName() + i + "test";
161
                    e.setName(newName);
162
                    e.setVersion(e.getVersion()-1);
163
                }
164
                commitTransaction(em);
165
                fail("OptimisticLockingException is not thrown!");
166
            }  catch (Exception exception ) {
167
                if (exception.getMessage().indexOf("org.eclipse.persistence.exceptions.OptimisticLockException") == -1){
168
                    closeEntityManager(em);
169
                    fail("it's not the right exception");
170
                }
171
                closeEntityManager(em);
172
            }
173
            if (counter.getSqlStatements().size() != 1) {
174
                fail("it's not just one batch update statement");
175
            }  
176
        }
177
        
178
    }
179
180
    /**
181
     * Tests a @NamedStoredProcedureQuery with store procedure IN_OUT parameter, and XML Type using String
182
     */
183
    public void testNamedStoredProcedureInOutQuery() {
184
        EntityManager em = createEntityManager("customfeatures");
185
        beginTransaction(em);
186
        try {
187
            Employee emp = new Employee();
188
            emp.setResume_xml(resume1());
189
            char nCh = '\u0400';
190
            emp.setEmpNChar(nCh);
191
            em.persist(emp);
192
            commitTransaction(em);
193
            Employee readEmp = (Employee) em.createNamedQuery("ReadEmployeeInOut").setParameter("ID", emp.getId()).getSingleResult();
194
            if (!getServerSession("customfeatures").compareObjects(readEmp, emp)) {
195
                fail("Object: " + readEmp + " does not match object that was written: " + emp + ". See log (on finest) for what did not match.");
196
            }
197
        } catch (RuntimeException e) {
198
            if (isTransactionActive(em)){
199
                rollbackTransaction(em);
200
            }
201
            closeEntityManager(em);
202
            throw e;
203
        }
204
        closeEntityManager(em);
205
    }
206
207
    /**
208
     * Tests a @NamedStoredProcedureQuery with store procedure ref Cursor, and XML Type using String
209
     */
210
    public void testNamedStoredProcedureCursorQuery() {
211
        EntityManager em = createEntityManager("customfeatures");
212
        beginTransaction(em);
213
        try {
214
            Employee emp = new Employee();
215
            emp.setResume_xml(resume1());
216
            char nCh = '\u0400';
217
            emp.setEmpNChar(nCh);
218
            emp.setName("Edward Xu");
219
            em.persist(emp);
220
            commitTransaction(em);
221
            System.out.println("=====original emp's resume_xml is " + emp.getReume_xml());
222
            clearCache("customfeatures");
223
            EntityManager newEM = createEntityManager("customfeatures");
224
            Employee readEmp = (Employee) newEM.createNamedQuery("ReadEmployeeCursor").setParameter("ID", emp.getId()).getSingleResult();
225
            System.out.println("======the readEmp's resume_xml is " + readEmp.getReume_xml());
226
            System.out.println("======the readEmp's name is " + readEmp.getName());
227
            if (!getServerSession("customfeatures").compareObjects(readEmp, emp)) {
228
                fail("Object: " + readEmp + " does not match object that was written: " + emp + ". See log (on finest) for what did not match.");
229
            }
230
        } catch (RuntimeException e) {
231
            if (isTransactionActive(em)){
232
                rollbackTransaction(em);
233
            }
234
            closeEntityManager(em);
235
            throw e;
236
        }
237
        closeEntityManager(em);
238
    }
239
240
    public static String resume0() {
241
        String resume = "<resume>\n";
242
        resume += "  <first-name>Bob</first-name>\n";
243
        resume += "   <last-name>Jones</last-name>\n";
244
        resume += "   <age>45</age>\n";
245
        resume += "   <education>\n";
246
        resume += "     <degree>BCS</degree>\n";
247
        resume += "     <degree>MBA</degree>\n";
248
        resume += "   </education>\n";
249
        resume += "</resume>";
250
        return resume;
251
    }
252
253
    public static String resume1() {
254
        String resume = "<resume>\n";
255
        resume += "  <first-name>Frank</first-name>\n";
256
        resume += "   <last-name>Cotton</last-name>\n";
257
        resume += "   <age>27</age>\n";
258
        resume += "   <education>\n";
259
        resume += "     <degree>BCS</degree>\n";
260
        resume += "   </education>\n";
261
        resume += "</resume>";
262
        return resume;
263
    }
264
265
    public static Document documentFromString(String xmlString) {
266
        try {
267
            ByteArrayInputStream stream = new ByteArrayInputStream(xmlString.getBytes());
268
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
269
            DocumentBuilder builder = factory.newDocumentBuilder();
270
            Document doc = builder.parse(stream);
271
            return doc;
272
        } catch (Exception ex) {
273
            System.out.println("Unable to create document due to: " + ex.getMessage());
274
            ex.printStackTrace();
275
        }
276
        return null;
277
    }
278
279
    public PackageDefinition buildOraclePackage(Session session) {
280
        PackageDefinition types = new PackageDefinition();
281
        types.setName("Cursor_Type");
282
        types.addStatement("Type Any_Cursor is REF CURSOR");
283
        if (TestCase.supportsStoredProcedures(session)) {
284
            SchemaManager schema = new SchemaManager(((DatabaseSession) session));
285
            schema.replaceObject(types);
286
        }
287
        return types;
288
    }
289
290
    public void buildOracleStoredProcedureReadFromEmployeeInOut(Session session) {
291
        StoredProcedureDefinition proc = new StoredProcedureDefinition();
292
        proc.setName("Read_Employee_InOut");
293
        
294
        proc.addInOutputArgument("employee_id_v", Integer.class);
295
        proc.addOutputArgument("nchar_v", Character.class);
296
                
297
        String statement = "SELECT NCHARTYPE INTO nchar_v FROM CUSTOM_FEATURE_EMPLOYEE WHERE (ID = employee_id_v)";
298
        
299
        proc.addStatement(statement);
300
        if (TestCase.supportsStoredProcedures(session)) {
301
            SchemaManager schema = new SchemaManager(((DatabaseSession) session));
302
            schema.replaceObject(proc);
303
        }
304
    }
305
306
    public void buildOracleStoredProcedureReadFromEmployeeCursor(Session session) {
307
        StoredProcedureDefinition proc = new StoredProcedureDefinition();
308
        proc.setName("Read_Employee_Cursor");
309
        
310
        proc.addArgument("employee_id_v", Integer.class);
311
        proc.addOutputArgument("RESULT_CURSOR", "CURSOR_TYPE.ANY_CURSOR");
312
		proc.addStatement("OPEN RESULT_CURSOR FOR SELECT * FROM CUSTOM_FEATURE_EMPLOYEE WHERE (ID = employee_id_v)");
313
 
314
        if (TestCase.supportsStoredProcedures(session)) {
315
            SchemaManager schema = new SchemaManager(((DatabaseSession) session));
316
            schema.replaceObject(proc);
317
        }
318
    }
319
320
}
(-)foundation/eclipselink.extension.oracle.test/src/org/eclipse/persistence/testing/tests/jpa/customfeatures/CustomFeaturesJUnitTestSuite.java (+320 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 1998, 2008 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     Oracle - initial API and implementation from Oracle TopLink
12
 ******************************************************************************/  
13
package org.eclipse.persistence.testing.tests.jpa.customfeatures;
14
15
import java.io.*;
16
import java.util.Calendar;
17
import java.util.TimeZone;
18
import java.util.List;
19
import java.util.Map;
20
21
import org.w3c.dom.*;
22
23
import javax.xml.parsers.*;
24
import javax.persistence.EntityManager;
25
import javax.persistence.OptimisticLockException;
26
import javax.persistence.PersistenceException;
27
28
import junit.framework.*;
29
import org.eclipse.persistence.testing.framework.TestCase;
30
import org.eclipse.persistence.testing.framework.junit.JUnitTestCase;
31
import org.eclipse.persistence.testing.framework.QuerySQLTracker;
32
import org.eclipse.persistence.testing.models.jpa.customfeatures.*;
33
import org.eclipse.persistence.tools.schemaframework.PackageDefinition;
34
import org.eclipse.persistence.tools.schemaframework.StoredProcedureDefinition;
35
import org.eclipse.persistence.tools.schemaframework.SchemaManager;
36
import org.eclipse.persistence.sessions.DatabaseSession;
37
import org.eclipse.persistence.sessions.Session;
38
import org.eclipse.persistence.sessions.server.ServerSession;
39
40
public class CustomFeaturesJUnitTestSuite extends JUnitTestCase {
41
    private static int empId;
42
    protected static int NUM_INSERTS = 200;
43
        
44
    public CustomFeaturesJUnitTestSuite() {
45
        super();
46
    }
47
    
48
    public CustomFeaturesJUnitTestSuite(String name) {
49
        super(name);
50
    }
51
    
52
    public static Test suite() {
53
        TestSuite suite = new TestSuite();
54
        suite.setName("CustomFeaturesJUnitTestSuite");
55
        suite.addTest(new CustomFeaturesJUnitTestSuite("testSetup"));
56
        suite.addTest(new CustomFeaturesJUnitTestSuite("testNCharXMLType"));
57
        suite.addTest(new CustomFeaturesJUnitTestSuite("testBatchInserts"));
58
        suite.addTest(new CustomFeaturesJUnitTestSuite("testBatchUpdates"));
59
        suite.addTest(new CustomFeaturesJUnitTestSuite("testNamedStoredProcedureInOutQuery"));
60
        suite.addTest(new CustomFeaturesJUnitTestSuite("testNamedStoredProcedureCursorQuery"));
61
        return suite;
62
    }
63
    
64
    public void testSetup() {
65
        ServerSession session = JUnitTestCase.getServerSession("customfeatures");
66
        new EmployeeTableCreator().replaceTables(session);
67
        buildOraclePackage(session);
68
        buildOracleStoredProcedureReadFromEmployeeInOut(session);
69
        buildOracleStoredProcedureReadFromEmployeeCursor(session);
70
    }
71
72
    /**
73
     * Tests a NChar and XML Type with Document.
74
     */
75
    public void testNCharXMLType() {
76
        EntityManager em = createEntityManager("customfeatures");
77
        beginTransaction(em);
78
        Employee emp = null;
79
        try{
80
            emp = new Employee();
81
            emp.setResume_xml(resume0());
82
            char nCh = '\u0410';
83
            emp.setEmpNChar(nCh);
84
            emp.setResume_dom(documentFromString(resume0()));
85
            em.persist(emp);
86
            empId = emp.getId();
87
            commitTransaction(em);
88
        } catch (RuntimeException e) {
89
            if (isTransactionActive(em)){
90
                rollbackTransaction(em);
91
            }
92
            closeEntityManager(em);
93
            throw e;
94
        }
95
96
        try{
97
            Employee readEmp = em.find(Employee.class, empId);
98
            if (!getServerSession("customfeatures").compareObjects(readEmp, emp)) {
99
                closeEntityManager(em);
100
                fail("Object: " + readEmp + " does not match object that was written: " + emp + ". See log (on finest) for what did not match.");
101
            } 
102
        } catch (Exception exception ) {
103
            closeEntityManager(em);
104
            fail("entityManager.refresh(removedObject) threw a wrong exception: " + exception.getMessage());
105
        }
106
       closeEntityManager(em);
107
    }
108
109
    /**
110
     * Tests a Native Batch Writing as batch inserts.
111
     */
112
    public void testBatchInserts() {
113
        EntityManager em = createEntityManager("customfeatures");
114
        beginTransaction(em);
115
        try{
116
            for (int i = 0; i < NUM_INSERTS; i++) {
117
                Employee emp = new Employee();
118
                emp.setResume_xml(resume0());
119
                char nCh = '\u0410';
120
                emp.setEmpNChar(nCh);
121
                em.persist(emp);
122
            }
123
            commitTransaction(em);
124
        } catch (RuntimeException e) {
125
            if (isTransactionActive(em)){
126
                rollbackTransaction(em);
127
            }
128
            throw e;
129
        } finally{
130
            closeEntityManager(em);
131
        }
132
    }
133
134
    /**
135
     * Tests a Native Batch Writing as batch updates with OptimisticLockingException.
136
     */
137
    public void testBatchUpdates() {
138
        QuerySQLTracker counter = null;
139
        EntityManager em = createEntityManager("customfeatures");
140
        beginTransaction(em);
141
        counter = new QuerySQLTracker(getServerSession("customfeatures"));
142
        List emps = em.createQuery("SELECT OBJECT(e) FROM Employee e").getResultList();
143
        if (isOnServer){
144
            try {
145
                for(int i=0; i<emps.size(); i++) {
146
                    Employee e = (Employee)emps.get(i);
147
                    String newName = ((Employee)emps.get(i)).getName() + i + "test";
148
                    e.setName(newName);
149
                    e.setVersion(e.getVersion()-1);
150
                }
151
                commitTransaction(em);
152
                fail("OptimisticLockingException is not thrown!");
153
            }  catch (RuntimeException exception ) {
154
                closeEntityManager(em);
155
            }
156
        }else{
157
            try {
158
                for(int i=0; i<emps.size(); i++) {
159
                    Employee e = (Employee)emps.get(i);
160
                    String newName = ((Employee)emps.get(i)).getName() + i + "test";
161
                    e.setName(newName);
162
                    e.setVersion(e.getVersion()-1);
163
                }
164
                commitTransaction(em);
165
                fail("OptimisticLockingException is not thrown!");
166
            }  catch (Exception exception ) {
167
                if (exception.getMessage().indexOf("org.eclipse.persistence.exceptions.OptimisticLockException") == -1){
168
                    closeEntityManager(em);
169
                    fail("it's not the right exception");
170
                }
171
                closeEntityManager(em);
172
            }
173
            if (counter.getSqlStatements().size() != 1) {
174
                fail("it's not just one batch update statement");
175
            }  
176
        }
177
        
178
    }
179
180
    /**
181
     * Tests a @NamedStoredProcedureQuery with store procedure IN_OUT parameter, and XML Type using String
182
     */
183
    public void testNamedStoredProcedureInOutQuery() {
184
        EntityManager em = createEntityManager("customfeatures");
185
        beginTransaction(em);
186
        try {
187
            Employee emp = new Employee();
188
            emp.setResume_xml(resume1());
189
            char nCh = '\u0400';
190
            emp.setEmpNChar(nCh);
191
            em.persist(emp);
192
            commitTransaction(em);
193
            Employee readEmp = (Employee) em.createNamedQuery("ReadEmployeeInOut").setParameter("ID", emp.getId()).getSingleResult();
194
            if (!getServerSession("customfeatures").compareObjects(readEmp, emp)) {
195
                fail("Object: " + readEmp + " does not match object that was written: " + emp + ". See log (on finest) for what did not match.");
196
            }
197
        } catch (RuntimeException e) {
198
            if (isTransactionActive(em)){
199
                rollbackTransaction(em);
200
            }
201
            closeEntityManager(em);
202
            throw e;
203
        }
204
        closeEntityManager(em);
205
    }
206
207
    /**
208
     * Tests a @NamedStoredProcedureQuery with store procedure ref Cursor, and XML Type using String
209
     */
210
    public void testNamedStoredProcedureCursorQuery() {
211
        EntityManager em = createEntityManager("customfeatures");
212
        beginTransaction(em);
213
        try {
214
            Employee emp = new Employee();
215
            emp.setResume_xml(resume1());
216
            char nCh = '\u0400';
217
            emp.setEmpNChar(nCh);
218
            emp.setName("Edward Xu");
219
            em.persist(emp);
220
            commitTransaction(em);
221
            System.out.println("=====original emp's resume_xml is " + emp.getReume_xml());
222
            clearCache("customfeatures");
223
            EntityManager newEM = createEntityManager("customfeatures");
224
            Employee readEmp = (Employee) newEM.createNamedQuery("ReadEmployeeCursor").setParameter("ID", emp.getId()).getSingleResult();
225
            System.out.println("======the readEmp's resume_xml is " + readEmp.getReume_xml());
226
            System.out.println("======the readEmp's name is " + readEmp.getName());
227
            if (!getServerSession("customfeatures").compareObjects(readEmp, emp)) {
228
                fail("Object: " + readEmp + " does not match object that was written: " + emp + ". See log (on finest) for what did not match.");
229
            }
230
        } catch (RuntimeException e) {
231
            if (isTransactionActive(em)){
232
                rollbackTransaction(em);
233
            }
234
            closeEntityManager(em);
235
            throw e;
236
        }
237
        closeEntityManager(em);
238
    }
239
240
    public static String resume0() {
241
        String resume = "<resume>\n";
242
        resume += "  <first-name>Bob</first-name>\n";
243
        resume += "   <last-name>Jones</last-name>\n";
244
        resume += "   <age>45</age>\n";
245
        resume += "   <education>\n";
246
        resume += "     <degree>BCS</degree>\n";
247
        resume += "     <degree>MBA</degree>\n";
248
        resume += "   </education>\n";
249
        resume += "</resume>";
250
        return resume;
251
    }
252
253
    public static String resume1() {
254
        String resume = "<resume>\n";
255
        resume += "  <first-name>Frank</first-name>\n";
256
        resume += "   <last-name>Cotton</last-name>\n";
257
        resume += "   <age>27</age>\n";
258
        resume += "   <education>\n";
259
        resume += "     <degree>BCS</degree>\n";
260
        resume += "   </education>\n";
261
        resume += "</resume>";
262
        return resume;
263
    }
264
265
    public static Document documentFromString(String xmlString) {
266
        try {
267
            ByteArrayInputStream stream = new ByteArrayInputStream(xmlString.getBytes());
268
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
269
            DocumentBuilder builder = factory.newDocumentBuilder();
270
            Document doc = builder.parse(stream);
271
            return doc;
272
        } catch (Exception ex) {
273
            System.out.println("Unable to create document due to: " + ex.getMessage());
274
            ex.printStackTrace();
275
        }
276
        return null;
277
    }
278
279
    public PackageDefinition buildOraclePackage(Session session) {
280
        PackageDefinition types = new PackageDefinition();
281
        types.setName("Cursor_Type");
282
        types.addStatement("Type Any_Cursor is REF CURSOR");
283
        if (TestCase.supportsStoredProcedures(session)) {
284
            SchemaManager schema = new SchemaManager(((DatabaseSession) session));
285
            schema.replaceObject(types);
286
        }
287
        return types;
288
    }
289
290
    public void buildOracleStoredProcedureReadFromEmployeeInOut(Session session) {
291
        StoredProcedureDefinition proc = new StoredProcedureDefinition();
292
        proc.setName("Read_Employee_InOut");
293
        
294
        proc.addInOutputArgument("employee_id_v", Integer.class);
295
        proc.addOutputArgument("nchar_v", Character.class);
296
                
297
        String statement = "SELECT NCHARTYPE INTO nchar_v FROM CUSTOM_FEATURE_EMPLOYEE WHERE (ID = employee_id_v)";
298
        
299
        proc.addStatement(statement);
300
        if (TestCase.supportsStoredProcedures(session)) {
301
            SchemaManager schema = new SchemaManager(((DatabaseSession) session));
302
            schema.replaceObject(proc);
303
        }
304
    }
305
306
    public void buildOracleStoredProcedureReadFromEmployeeCursor(Session session) {
307
        StoredProcedureDefinition proc = new StoredProcedureDefinition();
308
        proc.setName("Read_Employee_Cursor");
309
        
310
        proc.addArgument("employee_id_v", Integer.class);
311
        proc.addOutputArgument("RESULT_CURSOR", "CURSOR_TYPE.ANY_CURSOR");
312
		proc.addStatement("OPEN RESULT_CURSOR FOR SELECT * FROM CUSTOM_FEATURE_EMPLOYEE WHERE (ID = employee_id_v)");
313
 
314
        if (TestCase.supportsStoredProcedures(session)) {
315
            SchemaManager schema = new SchemaManager(((DatabaseSession) session));
316
            schema.replaceObject(proc);
317
        }
318
    }
319
320
}
(-)foundation/eclipselink.extension.oracle.test/src/org/eclipse/persistence/testing/tests/OracleJPACustomFeaturesTestSuite.java (+31 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 1998, 2008 Oracle. All rights reserved.
3
 * This program and the accompanying materials are made available under the 
4
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
5
 * which accompanies this distribution. 
6
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7
 * and the Eclipse Distribution License is available at 
8
 * http://www.eclipse.org/org/documents/edl-v10.php.
9
 *
10
 * Contributors:
11
 *     05/29/2008-1.0M8 Andrei Ilitchev. 
12
 *       - New file introduced to consolidate Oracle-specific JPA tests.
13
 ******************************************************************************/  
14
package org.eclipse.persistence.testing.tests;
15
16
import junit.framework.TestSuite;
17
import junit.framework.Test;
18
19
import org.eclipse.persistence.testing.tests.jpa.customfeatures.CustomFeaturesJUnitTestSuite;
20
21
public class OracleJPACustomFeaturesTestSuite extends TestSuite{
22
    
23
    public static Test suite() {
24
        TestSuite fullSuite = new TestSuite();
25
        fullSuite.setName("OracleJPACustomFeaturesTestSuite");
26
27
        fullSuite.addTest(CustomFeaturesJUnitTestSuite.suite());
28
        
29
        return fullSuite;
30
    }
31
}
(-)jpa/eclipselink.jpa.test/build.properties (+4 lines)
Lines 46-53 Link Here
46
jpa.performance=jpa-performance
46
jpa.performance=jpa-performance
47
47
48
eclipselink.struct.converter.model=eclipselink-struct-converter-model
48
eclipselink.struct.converter.model=eclipselink-struct-converter-model
49
eclipselink.customfeatures.model=eclipselink-customfeatures-model
50
eclipselink.jpa.oracle=eclipselink-jpa-oracle
49
oracle.extensions.depend.dir=../../../extension.oracle.lib.external
51
oracle.extensions.depend.dir=../../../extension.oracle.lib.external
50
oracle.spatial.lib=sdoapi.jar
52
oracle.spatial.lib=sdoapi.jar
53
oracle.xdb.lib=xdb.jar
54
oracle.xmlparserv2.lib=xmlparserv2.jar
51
55
52
eclipselink.tests.jar=eclipselink-tests.jar
56
eclipselink.tests.jar=eclipselink-tests.jar
53
57
(-)jpa/eclipselink.jpa.test/build.xml (-5 / +51 lines)
Lines 30-36 Link Here
30
        - package : jars JPA persistent units and tests jars
30
        - package : jars JPA persistent units and tests jars
31
        - test : runs JPA LRG (FullRegressionTestSuite)
31
        - test : runs JPA LRG (FullRegressionTestSuite)
32
        - test-lrg : runs JPA LRG (FullRegressionTestSuite, if database is Oracle, OracleJPATestSuite as well)
32
        - test-lrg : runs JPA LRG (FullRegressionTestSuite, if database is Oracle, OracleJPATestSuite as well)
33
        - test-oracle : runs JPA Oracle-specific tests (OracleJPATestSuite)
33
        - test-oracle : runs JPA Oracle-specific tests (OracleJPATestSuite and OracleJPACustomfeaturesTestSuite)
34
        - test-no-weave : runs JPA LRG using no weaving (no agent)
34
        - test-no-weave : runs JPA LRG using no weaving (no agent)
35
        - test-static-weave : runs JPA LRG using static weaving
35
        - test-static-weave : runs JPA LRG using static weaving
36
36
Lines 92-97 Link Here
92
        <contains string="${server.name}" substring="jboss"/>
92
        <contains string="${server.name}" substring="jboss"/>
93
    </condition>
93
    </condition>
94
94
95
    <!-- This checks if the Apllication Server is WebLogic -->
96
    <condition property="is.weblogic">
97
        <contains string="${server.name}" substring="weblogic"/>
98
    </condition>
99
100
    <!-- This checks if the Apllication Server is WebLogic and running against oracle db-->
101
    <condition property="is.weblogic.and.oracle">
102
        <and>
103
            <contains string="${server.name}" substring="weblogic"/>
104
            <contains string="${db.driver}" substring="oracle"/>
105
        </and>
106
    </condition>
107
95
    <target name="set-app-name">
108
    <target name="set-app-name">
96
        <condition property="APP_NAME" value="">
109
        <condition property="APP_NAME" value="">
97
            <contains string="${server.name}" substring="websphere"/>
110
            <contains string="${server.name}" substring="websphere"/>
Lines 408-413 Link Here
408
            <pathelement path="${eclipselink.extension.oracle.dir}/${classes.dir}"/>
421
            <pathelement path="${eclipselink.extension.oracle.dir}/${classes.dir}"/>
409
            <pathelement path="${eclipselink.extension.oracle.dir}/eclipselink-extension-oracle.jar"/>
422
            <pathelement path="${eclipselink.extension.oracle.dir}/eclipselink-extension-oracle.jar"/>
410
            <pathelement path="${jdbc.driver.jar}"/>
423
            <pathelement path="${jdbc.driver.jar}"/>
424
            <pathelement path="${oracle.extensions.depend.dir}/${oracle.xdb.lib}"/>
425
            <pathelement path="${oracle.extensions.depend.dir}/${oracle.xmlparserv2.lib}"/>
411
            <pathelement path="${eclipselink.jpa.test}/${eclipselink.tests.jar}"/>
426
            <pathelement path="${eclipselink.jpa.test}/${eclipselink.tests.jar}"/>
412
            <pathelement path="${eclipselink.jpa.test}/${eclipselink.annotation.model}.jar"/>
427
            <pathelement path="${eclipselink.jpa.test}/${eclipselink.annotation.model}.jar"/>
413
            <pathelement path="${eclipselink.jpa.test}/${eclipselink.ddl.generation.model}.jar"/>
428
            <pathelement path="${eclipselink.jpa.test}/${eclipselink.ddl.generation.model}.jar"/>
Lines 420-426 Link Here
420
            <!--pathelement path="${eclipselink.jpa.test}/${eclipselink.pu.with.multibyte}.jar"/-->
435
            <!--pathelement path="${eclipselink.jpa.test}/${eclipselink.pu.with.multibyte}.jar"/-->
421
            <pathelement path="${eclipselink.jpa.test}/${jpa.performance}.jar"/>
436
            <pathelement path="${eclipselink.jpa.test}/${jpa.performance}.jar"/>
422
            <pathelement path="${eclipselink.extension.oracle.test.dir}/${eclipselink.struct.converter.model}.jar"/>
437
            <pathelement path="${eclipselink.extension.oracle.test.dir}/${eclipselink.struct.converter.model}.jar"/>
423
            <pathelement path="${eclipselink.extension.oracle.test.dir}/${eclipselink.struct.converter.model}-tests.jar"/>
438
            <pathelement path="${eclipselink.extension.oracle.test.dir}/${eclipselink.customfeatures.model}.jar"/>
439
            <pathelement path="${eclipselink.extension.oracle.test.dir}/${eclipselink.jpa.oracle}-tests.jar"/>
424
            <pathelement path="${oracle.extensions.depend.dir}/${oracle.spatial.lib}"/>
440
            <pathelement path="${oracle.extensions.depend.dir}/${oracle.spatial.lib}"/>
425
        </path>
441
        </path>
426
        <path id="run.extended.classpath">
442
        <path id="run.extended.classpath">
Lines 448-453 Link Here
448
            <param name="TEST_WEAVING" value="${test.weaving}"/>
464
            <param name="TEST_WEAVING" value="${test.weaving}"/>
449
            <param name="ORM_TESTING" value="-Dorm.testing=jpa"/>
465
            <param name="ORM_TESTING" value="-Dorm.testing=jpa"/>
450
            <param name="RUN_PATH" value="run.classpath"/>
466
            <param name="RUN_PATH" value="run.classpath"/>
467
            <param name="DB_URL" value="${db.url}"/>
451
        </antcall>
468
        </antcall>
452
        <antcall target="generate-report" inheritRefs="true"/>
469
        <antcall target="generate-report" inheritRefs="true"/>
453
    </target>
470
    </target>
Lines 460-465 Link Here
460
            <param name="TEST_WEAVING" value="${test.weaving}"/>
477
            <param name="TEST_WEAVING" value="${test.weaving}"/>
461
            <param name="ORM_TESTING" value="-Dorm.testing=jpa"/>
478
            <param name="ORM_TESTING" value="-Dorm.testing=jpa"/>
462
            <param name="RUN_PATH" value="run.classpath"/>
479
            <param name="RUN_PATH" value="run.classpath"/>
480
            <param name="DB_URL" value="${db.url}"/>
463
        </antcall>
481
        </antcall>
464
        <antcall target="run-test" inheritRefs="true">
482
        <antcall target="run-test" inheritRefs="true">
465
            <param name="TEST_CLASS" value="org.eclipse.persistence.testing.tests.jpa.xml.EntityMappingsJUnitTestSuite"/>
483
            <param name="TEST_CLASS" value="org.eclipse.persistence.testing.tests.jpa.xml.EntityMappingsJUnitTestSuite"/>
Lines 467-472 Link Here
467
            <param name="TEST_WEAVING" value="${test.weaving}"/>
485
            <param name="TEST_WEAVING" value="${test.weaving}"/>
468
            <param name="ORM_TESTING" value="-Dorm.testing=eclipselink"/>
486
            <param name="ORM_TESTING" value="-Dorm.testing=eclipselink"/>
469
            <param name="RUN_PATH" value="run.extended.classpath"/>
487
            <param name="RUN_PATH" value="run.extended.classpath"/>
488
            <param name="DB_URL" value="${db.url}"/>
470
        </antcall>
489
        </antcall>
471
        <antcall target="test-oracle" inheritRefs="true"/>
490
        <antcall target="test-oracle" inheritRefs="true"/>
472
        <antcall target="generate-report" inheritRefs="true"/>
491
        <antcall target="generate-report" inheritRefs="true"/>
Lines 474-485 Link Here
474
493
475
    <!-- Runs JPA Oracle-specific tests. -->
494
    <!-- Runs JPA Oracle-specific tests. -->
476
    <target name="test-oracle" if="is.oracle" depends="config-trunk, config-flat">
495
    <target name="test-oracle" if="is.oracle" depends="config-trunk, config-flat">
477
        <antcall target="run-test" inheritRefs="true">
496
        <!--antcall target="run-test" inheritRefs="true">
478
            <param name="TEST_CLASS" value="org.eclipse.persistence.testing.tests.OracleJPATestSuite"/>
497
            <param name="TEST_CLASS" value="org.eclipse.persistence.testing.tests.OracleJPATestSuite"/>
479
            <param name="TEST_AGENT" value="${test.agent}"/>
498
            <param name="TEST_AGENT" value="${test.agent}"/>
480
            <param name="TEST_WEAVING" value="${test.weaving}"/>
499
            <param name="TEST_WEAVING" value="${test.weaving}"/>
481
            <param name="ORM_TESTING" value="-Dorm.testing=jpa"/>
500
            <param name="ORM_TESTING" value="-Dorm.testing=jpa"/>
482
            <param name="RUN_PATH" value="run.classpath"/>
501
            <param name="RUN_PATH" value="run.classpath"/>
502
            <param name="DB_URL" value="${db.url}"/>
503
        </antcall-->
504
        <antcall target="run-test" inheritRefs="true">
505
            <param name="TEST_CLASS" value="org.eclipse.persistence.testing.tests.OracleJPACustomFeaturesTestSuite"/>
506
            <param name="TEST_AGENT" value="${test.agent}"/>
507
            <param name="TEST_WEAVING" value="${test.weaving}"/>
508
            <param name="ORM_TESTING" value="-Dorm.testing=jpa"/>
509
            <param name="RUN_PATH" value="run.classpath"/>
510
            <param name="DB_URL" value="${db.oci.url}"/>
483
        </antcall>
511
        </antcall>
484
    </target>
512
    </target>
485
513
Lines 491-496 Link Here
491
            <param name="TEST_WEAVING" value="${test.weaving}"/>
519
            <param name="TEST_WEAVING" value="${test.weaving}"/>
492
            <param name="ORM_TESTING" value="-Dorm.testing=jpa"/>
520
            <param name="ORM_TESTING" value="-Dorm.testing=jpa"/>
493
            <param name="RUN_PATH" value="run.classpath"/>
521
            <param name="RUN_PATH" value="run.classpath"/>
522
            <param name="DB_URL" value="${db.url}"/>
494
        </antcall>
523
        </antcall>
495
        <antcall target="generate-report" inheritRefs="true"/>
524
        <antcall target="generate-report" inheritRefs="true"/>
496
    </target>
525
    </target>
Lines 503-508 Link Here
503
            <param name="TEST_WEAVING" value="-DTEST_NO_WEAVING=true"/>
532
            <param name="TEST_WEAVING" value="-DTEST_NO_WEAVING=true"/>
504
            <param name="ORM_TESTING" value="-Dorm.testing=jpa"/>
533
            <param name="ORM_TESTING" value="-Dorm.testing=jpa"/>
505
            <param name="RUN_PATH" value="run.classpath"/>
534
            <param name="RUN_PATH" value="run.classpath"/>
535
            <param name="DB_URL" value="${db.url}"/>
506
        </antcall>
536
        </antcall>
507
        <antcall target="generate-report" inheritRefs="true"/>
537
        <antcall target="generate-report" inheritRefs="true"/>
508
    </target>
538
    </target>
Lines 538-543 Link Here
538
            <param name="TEST_WEAVING" value="-Dignore"/>
568
            <param name="TEST_WEAVING" value="-Dignore"/>
539
            <param name="ORM_TESTING" value="-Dorm.testing=jpa"/>
569
            <param name="ORM_TESTING" value="-Dorm.testing=jpa"/>
540
            <param name="RUN_PATH" value="run.classpath.static"/>
570
            <param name="RUN_PATH" value="run.classpath.static"/>
571
            <param name="DB_URL" value="${db.url}"/>
541
        </antcall>
572
        </antcall>
542
        <antcall target="run-test" inheritRefs="true">
573
        <antcall target="run-test" inheritRefs="true">
543
            <param name="TEST_CLASS" value="org.eclipse.persistence.testing.tests.jpa.xml.EntityMappingsJUnitTestSuite"/>
574
            <param name="TEST_CLASS" value="org.eclipse.persistence.testing.tests.jpa.xml.EntityMappingsJUnitTestSuite"/>
Lines 545-550 Link Here
545
            <param name="TEST_WEAVING" value="-Dignore"/>
576
            <param name="TEST_WEAVING" value="-Dignore"/>
546
            <param name="ORM_TESTING" value="-Dorm.testing=eclipselink"/>
577
            <param name="ORM_TESTING" value="-Dorm.testing=eclipselink"/>
547
            <param name="RUN_PATH" value="run.extended.classpath.static"/>
578
            <param name="RUN_PATH" value="run.extended.classpath.static"/>
579
            <param name="DB_URL" value="${db.url}"/>
548
        </antcall>
580
        </antcall>
549
        <antcall target="generate-report" inheritRefs="true"/>
581
        <antcall target="generate-report" inheritRefs="true"/>
550
    </target>
582
    </target>
Lines 665-671 Link Here
665
697
666
    <!-- Generic target for running tests. -->
698
    <!-- Generic target for running tests. -->
667
    <target name="run-test" depends="config-trunk, config-flat">
699
    <target name="run-test" depends="config-trunk, config-flat">
668
        <echo>Running test on ${db.url}</echo>
700
        <echo>Running test on ${DB_URL}</echo>
669
701
670
        <condition property="jvmarg.db.platform" value="-Ddb.platform=${db.platform}">
702
        <condition property="jvmarg.db.platform" value="-Ddb.platform=${db.platform}">
671
            <isset property="db.platform"/>
703
            <isset property="db.platform"/>
Lines 682-688 Link Here
682
            <jvmarg value="${ORM_TESTING}"/>
714
            <jvmarg value="${ORM_TESTING}"/>
683
            <jvmarg value="-Declipselink.logging.level=${logging.level}"/>
715
            <jvmarg value="-Declipselink.logging.level=${logging.level}"/>
684
            <jvmarg value="-Ddb.driver=${db.driver}"/>
716
            <jvmarg value="-Ddb.driver=${db.driver}"/>
685
            <jvmarg value="-Ddb.url=${db.url}"/>
717
            <jvmarg value="-Ddb.url=${DB_URL}"/>
686
            <jvmarg value="-Ddb.user=${db.user}"/>
718
            <jvmarg value="-Ddb.user=${db.user}"/>
687
            <jvmarg value="-Ddb.pwd=${db.pwd}"/>
719
            <jvmarg value="-Ddb.pwd=${db.pwd}"/>
688
            <jvmarg value="${jvmarg.db.platform}"/>
720
            <jvmarg value="${jvmarg.db.platform}"/>
Lines 1411-1416 Link Here
1411
            <param name="eclipselink.jpa.test.dir" value="./../../foundation/eclipselink.extension.oracle.test"/>
1443
            <param name="eclipselink.jpa.test.dir" value="./../../foundation/eclipselink.extension.oracle.test"/>
1412
        </antcall>
1444
        </antcall>
1413
    </target>
1445
    </target>
1446
1447
    <target name="server-test-custom-features" if="is.weblogic.and.oracle">
1448
        <antcall target="server-run-all" inheritRefs="true">
1449
            <param name="PERSISTENCE_UNIT_NAME" value="customfeatures"/>
1450
            <param name="MODEL_DIR" value="org/eclipse/persistence/testing/models/jpa/customfeatures"/>
1451
            <param name="MODEL_NAME" value="eclipselink-customfeatures-model"/>
1452
            <param name="TEST_DIR" value="org/eclipse/persistence/testing/tests/jpa/customfeatures"/>
1453
            <param name="TEST_NAME" value="eclipselink-customfeatures-model"/>
1454
            <param name="EAR_NAME" value="eclipselink-customfeatures-model"/>
1455
            <param name="TEST_SUITE" value="org.eclipse.persistence.testing.tests.jpa.customfeatures.CustomFeaturesJUnitTestSuite"/>
1456
            <param name="eclipselink.jpa.test.dir" value="./../../foundation/eclipselink.extension.oracle.test"/>
1457
        </antcall>
1458
    </target>
1459
1414
    <!-- *********** CacheCoordination Test Targets -->
1460
    <!-- *********** CacheCoordination Test Targets -->
1415
    <target name="server-start-cachecoordination" depends="detect-os,config-trunk, config-flat">
1461
    <target name="server-start-cachecoordination" depends="detect-os,config-trunk, config-flat">
1416
      <ant antfile="${eclipselink.jpa.test}/cachecoordination_${server.name}.xml" target="${server.name}-start-cachecoordination" inheritRefs="true"/>
1462
      <ant antfile="${eclipselink.jpa.test}/cachecoordination_${server.name}.xml" target="${server.name}-start-cachecoordination" inheritRefs="true"/>
(-)jpa/eclipselink.jpa.test/resource/eclipselink-customfeatures-model/server/persistence.xml (+12 lines)
Line 0 Link Here
1
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence_1_0.xsd" version="1.0">
2
    <persistence-unit name="%%default%%">
3
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
4
        <jta-data-source>jdbc/EclipseLinkDS_OCI</jta-data-source>
5
        <properties>
6
            <property name="eclipselink.target-server" value="%%server-platform%%"/>
7
            <property name="eclipselink.logging.level" value="FINEST"/>
8
            <property name="eclipselink.descriptor.customizer" value="org.eclipse.persistence.testing.models.jpa.customfeatures.XmlDataCustomizer"/>
9
            <property name="eclipselink.jdbc.batch-writing" value="Oracle-JDBC"/>
10
        </properties>
11
    </persistence-unit>
12
</persistence>
(-)jpa/eclipselink.jpa.test/resource/eclipselink-customfeatures-model/server/persistence.xml (+12 lines)
Line 0 Link Here
1
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence_1_0.xsd" version="1.0">
2
    <persistence-unit name="%%default%%">
3
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
4
        <jta-data-source>jdbc/EclipseLinkDS_OCI</jta-data-source>
5
        <properties>
6
            <property name="eclipselink.target-server" value="%%server-platform%%"/>
7
            <property name="eclipselink.logging.level" value="FINEST"/>
8
            <property name="eclipselink.descriptor.customizer" value="org.eclipse.persistence.testing.models.jpa.customfeatures.XmlDataCustomizer"/>
9
            <property name="eclipselink.jdbc.batch-writing" value="Oracle-JDBC"/>
10
        </properties>
11
    </persistence-unit>
12
</persistence>
(-)jpa/eclipselink.jpa.test/weblogic.xml (+16 lines)
Lines 75-80 Link Here
75
        <copy file="${junit.lib}" todir="${weblogic.domain}/lib"/>
75
        <copy file="${junit.lib}" todir="${weblogic.domain}/lib"/>
76
        <copy file="${eclipselink.jar.name}" todir="${weblogic.domain}/lib"/>
76
        <copy file="${eclipselink.jar.name}" todir="${weblogic.domain}/lib"/>
77
        <copy file="${jdbc.driver.jar}" todir="${weblogic.domain}/lib"/>
77
        <copy file="${jdbc.driver.jar}" todir="${weblogic.domain}/lib"/>
78
        <copy file="${oracle.extensions.depend.dir}/${oracle.xdb.lib}" todir="${weblogic.domain}/lib"/>
78
        <antcall target="weblogic-stop" inheritRefs="true"/>
79
        <antcall target="weblogic-stop" inheritRefs="true"/>
79
    </target>
80
    </target>
80
81
Lines 125-130 Link Here
125
                <set attribute="PoolName" value="ejbPool"/>
126
                <set attribute="PoolName" value="ejbPool"/>
126
                <set attribute="Targets" value="${myserver}"/>
127
                <set attribute="Targets" value="${myserver}"/>
127
            </create>
128
            </create>
129
            <create type="JDBCConnectionPool" name="ejbPool_oci">
130
                <set attribute="CapacityIncrement" value="2"/>
131
                <set attribute="DriverName" value="${db.driver}"/>
132
                <set attribute="InitialCapacity" value="1"/>
133
                <set attribute="MaxCapacity" value="50"/>
134
                <set attribute="Password" value="${db.pwd}"/>
135
                <set attribute="Properties" value="user=${db.user}"/>
136
                <set attribute="URL" value="${db.oci.url}"/>
137
                <set attribute="Targets" value="${myserver}"/>
138
            </create>
139
            <create type="JDBCTxDataSource" name="EclipseLinkDS_OCI">
140
                <set attribute="JNDIName" value="jdbc/EclipseLinkDS_OCI"/>
141
                <set attribute="PoolName" value="ejbPool_oci"/>
142
                <set attribute="Targets" value="${myserver}"/>
143
            </create>
128
        </wlconfig>
144
        </wlconfig>
129
    </target>
145
    </target>
130
146

Return to bug 265512