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

(-)foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/models/mapping/Employee1.java (-5 / +7 lines)
Lines 19-24 Link Here
19
import org.eclipse.persistence.descriptors.RelationalDescriptor;
19
import org.eclipse.persistence.descriptors.RelationalDescriptor;
20
import org.eclipse.persistence.internal.helper.*;
20
import org.eclipse.persistence.internal.helper.*;
21
import org.eclipse.persistence.sessions.*;
21
import org.eclipse.persistence.sessions.*;
22
import org.eclipse.persistence.internal.sessions.DatabaseSessionImpl;
22
import org.eclipse.persistence.expressions.*;
23
import org.eclipse.persistence.expressions.*;
23
24
24
public class Employee1 implements Serializable {
25
public class Employee1 implements Serializable {
Lines 55-73 Link Here
55
    /**
56
    /**
56
     * Amend the Employee1 descriptor with a join expression to join the multiple tables in the database.
57
     * Amend the Employee1 descriptor with a join expression to join the multiple tables in the database.
57
     */
58
     */
58
    public static void amendEmployee1WithFKInfo(DatabaseSession session) {
59
    public static void amendEmployee1WithFKInfo(DatabaseSessionImpl session) {
59
        ClassDescriptor descriptor = (ClassDescriptor)new LegacyTestProject().getDescriptors().get(Employee1.class);
60
        ClassDescriptor descriptor = (ClassDescriptor)new LegacyTestProject().getDescriptors().get(Employee1.class);
60
61
        amendEmployee1WithFKInfo(descriptor);
61
        amendEmployee1WithFKInfo(descriptor);
62
63
        // Insert new descriptor.
62
        // Insert new descriptor.
64
        session.addDescriptor(descriptor);
63
        session.addDescriptor(descriptor);
64
        session.initializeDescriptors();
65
    }
65
    }
66
66
67
    /**
67
    /**
68
     * Amend the Employee1 descriptor with a join expression to join the multiple tables in the database.
68
     * Amend the Employee1 descriptor with a join expression to join the multiple tables in the database.
69
     */
69
     */
70
    public static void amendEmployee1WithJoinOnly(DatabaseSession aSession) {
70
    public static void amendEmployee1WithJoinOnly(DatabaseSessionImpl aSession) {
71
        ClassDescriptor descriptor = (ClassDescriptor)new LegacyTestProject().getDescriptors().get(Employee1.class);
71
        ClassDescriptor descriptor = (ClassDescriptor)new LegacyTestProject().getDescriptors().get(Employee1.class);
72
72
73
        // Setup the join from the employee table to the address table using a custom join expression and 
73
        // Setup the join from the employee table to the address table using a custom join expression and 
Lines 77-82 Link Here
77
77
78
        // Insert new descriptor.
78
        // Insert new descriptor.
79
        aSession.addDescriptor(descriptor);
79
        aSession.addDescriptor(descriptor);
80
        aSession.initializeDescriptors();
80
    }
81
    }
81
82
82
    /**
83
    /**
Lines 98-110 Link Here
98
    /**
99
    /**
99
     * Amend the Employee1 descriptor with a join expression to join the multiple tables in the database.
100
     * Amend the Employee1 descriptor with a join expression to join the multiple tables in the database.
100
     */
101
     */
101
    public static void amendEmployee1WithJoinWithInsert(DatabaseSession aSession) {
102
    public static void amendEmployee1WithJoinWithInsert(DatabaseSessionImpl aSession) {
102
        ClassDescriptor descriptor = (ClassDescriptor)new LegacyTestProject().getDescriptors().get(Employee1.class);
103
        ClassDescriptor descriptor = (ClassDescriptor)new LegacyTestProject().getDescriptors().get(Employee1.class);
103
104
104
        amendEmployee1WithJoinWithInsert(descriptor);
105
        amendEmployee1WithJoinWithInsert(descriptor);
105
106
106
        // Insert new descriptor.
107
        // Insert new descriptor.
107
        aSession.addDescriptor(descriptor);
108
        aSession.addDescriptor(descriptor);
109
        aSession.initializeDescriptors();
108
    }
110
    }
109
111
110
    public static Employee1 example1() {
112
    public static Employee1 example1() {
(-)foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/feature/ShouldCheckDatabaseTest.java (-1 / +2 lines)
Lines 14-19 Link Here
14
14
15
import org.eclipse.persistence.testing.framework.*;
15
import org.eclipse.persistence.testing.framework.*;
16
import org.eclipse.persistence.exceptions.*;
16
import org.eclipse.persistence.exceptions.*;
17
import org.eclipse.persistence.internal.sessions.DatabaseSessionImpl;
17
import org.eclipse.persistence.sessions.*;
18
import org.eclipse.persistence.sessions.*;
18
19
19
/**
20
/**
Lines 27-33 Link Here
27
    public void test() {
28
    public void test() {
28
        EmployeeProjectForDatabaseChecking project = new EmployeeProjectForDatabaseChecking();
29
        EmployeeProjectForDatabaseChecking project = new EmployeeProjectForDatabaseChecking();
29
        project.setDatasourceLogin(getSession().getDatasourceLogin());
30
        project.setDatasourceLogin(getSession().getDatasourceLogin());
30
        DatabaseSession session = new Project(getSession().getDatasourceLogin()).createDatabaseSession();
31
        DatabaseSessionImpl session = (DatabaseSessionImpl)new Project(getSession().getDatasourceLogin()).createDatabaseSession();
31
        boolean caughtError = false;
32
        boolean caughtError = false;
32
        try {
33
        try {
33
            session.setSessionLog(getSession().getSessionLog());
34
            session.setSessionLog(getSession().getSessionLog());
(-)foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/mapping/MultipleTableDeleteObjectTest.java (-1 / +2 lines)
Lines 13-18 Link Here
13
package org.eclipse.persistence.testing.tests.mapping;
13
package org.eclipse.persistence.testing.tests.mapping;
14
14
15
import org.eclipse.persistence.sessions.*;
15
import org.eclipse.persistence.sessions.*;
16
import org.eclipse.persistence.internal.sessions.DatabaseSessionImpl;
16
import org.eclipse.persistence.testing.models.mapping.Employee1;
17
import org.eclipse.persistence.testing.models.mapping.Employee1;
17
18
18
/**
19
/**
Lines 33-39 Link Here
33
        try {
34
        try {
34
            // Get the Method
35
            // Get the Method
35
            Class[] parms = new Class[1];
36
            Class[] parms = new Class[1];
36
            parms[0] = DatabaseSession.class;
37
            parms[0] = DatabaseSessionImpl.class;
37
            java.lang.reflect.Method method = Employee1.class.getMethod(this.amendmentMethodName, parms);
38
            java.lang.reflect.Method method = Employee1.class.getMethod(this.amendmentMethodName, parms);
38
39
39
            // Invoke it.
40
            // Invoke it.
(-)foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/mapping/MultipleTableInsertObjectTest.java (-1 / +2 lines)
Lines 13-18 Link Here
13
package org.eclipse.persistence.testing.tests.mapping;
13
package org.eclipse.persistence.testing.tests.mapping;
14
14
15
import org.eclipse.persistence.sessions.*;
15
import org.eclipse.persistence.sessions.*;
16
import org.eclipse.persistence.internal.sessions.DatabaseSessionImpl;
16
import org.eclipse.persistence.testing.models.mapping.Employee1;
17
import org.eclipse.persistence.testing.models.mapping.Employee1;
17
18
18
/**
19
/**
Lines 33-39 Link Here
33
        try {
34
        try {
34
            // Get the Method
35
            // Get the Method
35
            Class[] parms = new Class[1];
36
            Class[] parms = new Class[1];
36
            parms[0] = DatabaseSession.class;
37
            parms[0] = DatabaseSessionImpl.class;
37
            java.lang.reflect.Method method = Employee1.class.getMethod(this.amendmentMethodName, parms);
38
            java.lang.reflect.Method method = Employee1.class.getMethod(this.amendmentMethodName, parms);
38
39
39
            // Invoke it.
40
            // Invoke it.
(-)foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/mapping/MultipleTableReadAllTest.java (-1 / +2 lines)
Lines 13-18 Link Here
13
package org.eclipse.persistence.testing.tests.mapping;
13
package org.eclipse.persistence.testing.tests.mapping;
14
14
15
import org.eclipse.persistence.sessions.*;
15
import org.eclipse.persistence.sessions.*;
16
import org.eclipse.persistence.internal.sessions.DatabaseSessionImpl;
16
import org.eclipse.persistence.testing.models.mapping.Employee1;
17
import org.eclipse.persistence.testing.models.mapping.Employee1;
17
18
18
/**
19
/**
Lines 33-39 Link Here
33
        try {
34
        try {
34
            // Get the Method
35
            // Get the Method
35
            Class[] parms = new Class[1];
36
            Class[] parms = new Class[1];
36
            parms[0] = DatabaseSession.class;
37
            parms[0] = DatabaseSessionImpl.class;
37
            java.lang.reflect.Method method = Employee1.class.getMethod(this.amendmentMethodName, parms);
38
            java.lang.reflect.Method method = Employee1.class.getMethod(this.amendmentMethodName, parms);
38
39
39
            // Invoke it.
40
            // Invoke it.
(-)foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/mapping/MultipleTableReadObjectTest.java (-1 / +2 lines)
Lines 13-18 Link Here
13
package org.eclipse.persistence.testing.tests.mapping;
13
package org.eclipse.persistence.testing.tests.mapping;
14
14
15
import org.eclipse.persistence.sessions.*;
15
import org.eclipse.persistence.sessions.*;
16
import org.eclipse.persistence.internal.sessions.DatabaseSessionImpl;
16
import org.eclipse.persistence.testing.models.mapping.Employee1;
17
import org.eclipse.persistence.testing.models.mapping.Employee1;
17
18
18
/**
19
/**
Lines 33-39 Link Here
33
        try {
34
        try {
34
            // Get the Method
35
            // Get the Method
35
            Class[] parms = new Class[1];
36
            Class[] parms = new Class[1];
36
            parms[0] = DatabaseSession.class;
37
            parms[0] = DatabaseSessionImpl.class;
37
            java.lang.reflect.Method method = Employee1.class.getMethod(this.amendmentMethodName, parms);
38
            java.lang.reflect.Method method = Employee1.class.getMethod(this.amendmentMethodName, parms);
38
39
39
            // Invoke it.
40
            // Invoke it.
(-)foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/mapping/MultipleTableWriteObjectTest.java (-1 / +2 lines)
Lines 13-18 Link Here
13
package org.eclipse.persistence.testing.tests.mapping;
13
package org.eclipse.persistence.testing.tests.mapping;
14
14
15
import org.eclipse.persistence.sessions.*;
15
import org.eclipse.persistence.sessions.*;
16
import org.eclipse.persistence.internal.sessions.DatabaseSessionImpl;
16
import org.eclipse.persistence.testing.models.mapping.Employee1;
17
import org.eclipse.persistence.testing.models.mapping.Employee1;
17
18
18
/**
19
/**
Lines 33-39 Link Here
33
        try {
34
        try {
34
            // Get the Method
35
            // Get the Method
35
            Class[] parms = new Class[1];
36
            Class[] parms = new Class[1];
36
            parms[0] = DatabaseSession.class;
37
            parms[0] = DatabaseSessionImpl.class;
37
            java.lang.reflect.Method method = Employee1.class.getMethod(this.amendmentMethodName, parms);
38
            java.lang.reflect.Method method = Employee1.class.getMethod(this.amendmentMethodName, parms);
38
39
39
            // Invoke it.
40
            // Invoke it.
(-)foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/optimization/queryandsqlcounting/querycache/QueryCacheHitTest.java (-2 / +2 lines)
Lines 164-170 Link Here
164
    
164
    
165
    public void testNoResultsCachedDataRead() {
165
    public void testNoResultsCachedDataRead() {
166
        DataReadQuery dataReadQuery1 = new DataReadQuery();
166
        DataReadQuery dataReadQuery1 = new DataReadQuery();
167
        String sqlString1 = "select f_name, l_name from employee where f_name = 'impossible'";
167
        String sqlString1 = "SELECT F_NAME, L_NAME FROM EMPLOYEE WHERE F_NAME = 'impossible'";
168
        dataReadQuery1.setSQLString(sqlString1);
168
        dataReadQuery1.setSQLString(sqlString1);
169
        dataReadQuery1.setQueryResultsCachePolicy(new QueryResultsCachePolicy(2));
169
        dataReadQuery1.setQueryResultsCachePolicy(new QueryResultsCachePolicy(2));
170
        // Test DataReadQuery with zero expected results ("no results" cached)
170
        // Test DataReadQuery with zero expected results ("no results" cached)
Lines 185-191 Link Here
185
    
185
    
186
    public void testValidResultsCachedDataRead() {
186
    public void testValidResultsCachedDataRead() {
187
        DataReadQuery dataReadQuery2 = new DataReadQuery();
187
        DataReadQuery dataReadQuery2 = new DataReadQuery();
188
        String sqlString2 = "select f_name, l_name from employee";
188
        String sqlString2 = "SELECT F_NAME, L_NAME FROM EMPLOYEE";
189
        dataReadQuery2.setSQLString(sqlString2);
189
        dataReadQuery2.setSQLString(sqlString2);
190
        dataReadQuery2.setQueryResultsCachePolicy(new QueryResultsCachePolicy(2));
190
        dataReadQuery2.setQueryResultsCachePolicy(new QueryResultsCachePolicy(2));
191
        
191
        
(-)foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/workbenchintegration/ProjectClassGeneratorNonUnicodeTest.java (+4 lines)
Lines 18-23 Link Here
18
//Check if ProjectClassGenerator does not generate unicode escaped characters for non-ASCII
18
//Check if ProjectClassGenerator does not generate unicode escaped characters for non-ASCII
19
//characters when false is passed in to generate().  Compile on the generated project file 
19
//characters when false is passed in to generate().  Compile on the generated project file 
20
//should fail.
20
//should fail.
21
22
// This test has been removed from the test suite because the IBM VM on the eclipse build server
23
// does not write the unicode characters in the expected manner.  Instead of ??Mapping, we get the
24
// actual unicode characters.  This may be because the VM is running on a 64 bit linux server
21
public class ProjectClassGeneratorNonUnicodeTest extends ProjectClassGeneratorResultFileTest {
25
public class ProjectClassGeneratorNonUnicodeTest extends ProjectClassGeneratorResultFileTest {
22
26
23
    public ProjectClassGeneratorNonUnicodeTest() {
27
    public ProjectClassGeneratorNonUnicodeTest() {
(-)foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/workbenchintegration/ProjectClassGeneratorTestModel.java (-1 lines)
Lines 60-66 Link Here
60
        unicodeSuite.setName("UnicodeSuite");
60
        unicodeSuite.setName("UnicodeSuite");
61
        unicodeSuite.setDescription("Tests to ensure unicode/non-unicode are generated as required.");
61
        unicodeSuite.setDescription("Tests to ensure unicode/non-unicode are generated as required.");
62
        unicodeSuite.addTest(new ProjectClassGeneratorUnicodeTest());
62
        unicodeSuite.addTest(new ProjectClassGeneratorUnicodeTest());
63
        unicodeSuite.addTest(new ProjectClassGeneratorNonUnicodeTest());
64
        addTest(unicodeSuite);
63
        addTest(unicodeSuite);
65
64
66
        addTest(new ProjectClassGeneratorOrderByQueryKeysTest());
65
        addTest(new ProjectClassGeneratorOrderByQueryKeysTest());
(-)foundation/eclipselink.core/src/org/eclipse/persistence/exceptions/i18n/ValidationExceptionResource.java (-1 / +1 lines)
Lines 237-243 Link Here
237
                                           { "7242", "An attempt was made to traverse a relationship using indirection that had a null Session.  This often occurs when an entity with an uninstantiated LAZY relationship is serialized and that lazy relationship is traversed after serialization.  To avoid this issue, instantiate the LAZY relationship prior to serialization."},
237
                                           { "7242", "An attempt was made to traverse a relationship using indirection that had a null Session.  This often occurs when an entity with an uninstantiated LAZY relationship is serialized and that lazy relationship is traversed after serialization.  To avoid this issue, instantiate the LAZY relationship prior to serialization."},
238
                                           { "7243", "Missing meta data for class [{0}]. Ensure the class is not being excluded from your persistence unit by a <exclude-unlisted-classes>true</exclude-unlisted-classes> setting. If this is the case, you will need to include the class directly by adding a <class>[{0}]</class> entry for your persistence-unit."},
238
                                           { "7243", "Missing meta data for class [{0}]. Ensure the class is not being excluded from your persistence unit by a <exclude-unlisted-classes>true</exclude-unlisted-classes> setting. If this is the case, you will need to include the class directly by adding a <class>[{0}]</class> entry for your persistence-unit."},
239
										   { "7244", "An incompatible mapping has been encountered between [{0}] and [{1}]. This usually occurs when the cardinality of a mapping does not correspond with the cardinality of its backpointer."},
239
										   { "7244", "An incompatible mapping has been encountered between [{0}] and [{1}]. This usually occurs when the cardinality of a mapping does not correspond with the cardinality of its backpointer."},
240
                                           { "7245", "The *metadata-less* embeddable class [{0}] is used in entity classes with conflicting access-types. This is not allowed as this may result in inconsistent mappings of the embeddable class in different points of use. This problem can be corrected in two ways: 1. Provide metadata on class [{0}] that allows the access type to be determined. 2. Ensure all users of class [{0}] have the same access type."},
240
                                           { "7245", "The *metadata-less* embeddable class [{0}] is used in entity classes with conflicting access-types.  Its property access flag is set to [{1}]. It is being embedded in a [{2}] with property access flag set to: [{3}]. This is not allowed as this may result in inconsistent mappings of the embeddable class in different points of use. This problem can be corrected in two ways: 1. Provide metadata on class [{0}] that allows the access type to be determined. 2. Ensure all users of class [{0}] have the same access type."},
241
                                           { "7246", "The Entity class [{0}] has an embedded attribute [{1}] of type [{2}] which is NOT an Embeddable class. Probable reason: missing @Embeddable or missing <embeddable> in orm.xml if metadata-complete = true"},
241
                                           { "7246", "The Entity class [{0}] has an embedded attribute [{1}] of type [{2}] which is NOT an Embeddable class. Probable reason: missing @Embeddable or missing <embeddable> in orm.xml if metadata-complete = true"},
242
                                           { "7247", "Both fields and methods are annotated in [{0}]"},
242
                                           { "7247", "Both fields and methods are annotated in [{0}]"},
243
                                           { "7248", "For [{0}] access type [{1}] as determined by XML is different from access type [{2}] determined using annotation."},
243
                                           { "7248", "For [{0}] access type [{1}] as determined by XML is different from access type [{2}] determined using annotation."},
(-)foundation/eclipselink.core/src/org/eclipse/persistence/exceptions/IntegrityChecker.java (-3 / +4 lines)
Lines 86-96 Link Here
86
            // load the tables from the session
86
            // load the tables from the session
87
            initializeTables(session);
87
            initializeTables(session);
88
        }
88
        }
89
        //MySQL converts all the table names to lower case.
89
        boolean tableExists =  getTables().contains(table.getName());
90
        if (session.getPlatform().isMySQL()) {
90
        //Some DBs (e.g. some versions of MySQL) convert all the table names to lower case.
91
        if (!tableExists && session.getPlatform().isMySQL()) {
91
            return getTables().contains(table.getName().toLowerCase());
92
            return getTables().contains(table.getName().toLowerCase());
92
        }
93
        }
93
        return getTables().contains(table.getName());
94
        return tableExists;
94
    }
95
    }
95
96
96
    /**
97
    /**
(-)foundation/eclipselink.core/src/org/eclipse/persistence/exceptions/ValidationException.java (-2 / +2 lines)
Lines 2223-2230 Link Here
2223
        validationException.setErrorCode(CLASS_NOT_LISTED_IN_PERSISTENCE_UNIT);
2223
        validationException.setErrorCode(CLASS_NOT_LISTED_IN_PERSISTENCE_UNIT);
2224
        return validationException;
2224
        return validationException;
2225
    }
2225
    }
2226
    public static ValidationException conflictingAccessTypeForEmbeddable(Class embeddableClass) {
2226
    public static ValidationException conflictingAccessTypeForEmbeddable(Class embeddableClass, boolean embeddableAccessType, Class descriptorClass, boolean descriptorAccessType) {
2227
        Object[] args = {embeddableClass };
2227
        Object[] args = {embeddableClass, embeddableAccessType, descriptorClass, descriptorAccessType};
2228
        ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CONFLICTNG_ACCESS_TYPE_FOR_EMBEDDABLE, args));
2228
        ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CONFLICTNG_ACCESS_TYPE_FOR_EMBEDDABLE, args));
2229
        validationException.setErrorCode(CONFLICTNG_ACCESS_TYPE_FOR_EMBEDDABLE);
2229
        validationException.setErrorCode(CONFLICTNG_ACCESS_TYPE_FOR_EMBEDDABLE);
2230
        return validationException;
2230
        return validationException;
(-)jpa/eclipselink.jpa/src/org/eclipse/persistence/internal/jpa/metadata/accessors/mappings/EmbeddedAccessor.java (-1 / +1 lines)
Lines 391-397 Link Here
391
        // in the embeddable class.
391
        // in the embeddable class.
392
        if (! isMetadataPresent(embeddableDescriptor)) {
392
        if (! isMetadataPresent(embeddableDescriptor)) {
393
        	if (embeddableDescriptor.usesPropertyAccess() != getDescriptor().usesPropertyAccess()) {
393
        	if (embeddableDescriptor.usesPropertyAccess() != getDescriptor().usesPropertyAccess()) {
394
        		throw ValidationException.conflictingAccessTypeForEmbeddable(embeddableDescriptor.getJavaClass());
394
        		throw ValidationException.conflictingAccessTypeForEmbeddable(embeddableDescriptor.getJavaClass(), embeddableDescriptor.usesPropertyAccess(), getDescriptor().getJavaClass(), getDescriptor().usesPropertyAccess());
395
            }
395
            }
396
        }
396
        }
397
        
397
        

Return to bug 221894