Package org.apache.ojb.broker.metadata

Examples of org.apache.ojb.broker.metadata.FieldDescriptor


                    + SequenceManagerNextValImpl.class + " Skip test case.");
            broker.close();
            return;
        }
        int count = 0;
        FieldDescriptor idFld = broker.getClassDescriptor(
                Repository.SMDatabaseSequence.class).getAutoIncrementFields()[0];
        for (int i = 0; i < 10; i++)
        {
            Integer val = (Integer) sm.getUniqueValue(idFld);
            count += val.intValue();
View Full Code Here


     * implementations.
     */
    public void testMaxKeySearch1()
    {
        PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker();
        FieldDescriptor field = null;

        // find max from classes using different tables
        // FieldDescriptor field = broker.getClassDescriptor(Repository.SMMax.class).getAutoIncrementFields()[0];
        // long result1 = SequenceManagerHelper.getMaxForExtent(broker, field);
        field = broker.getClassDescriptor(Repository.SMMaxA.class).getAutoIncrementFields()[0];
View Full Code Here

        broker.store(new ObjectRepository.B1());
        broker.store(new ObjectRepository.C());
        broker.store(new ObjectRepository.D());
        broker.commitTransaction();
        long[] result = new long[5];
        FieldDescriptor field = broker.getClassDescriptor(ObjectRepository.A.class).getAutoIncrementFields()[0];
        result[0] = SequenceManagerHelper.getMaxForExtent(broker, field);
        field = broker.getClassDescriptor(ObjectRepository.B.class).getAutoIncrementFields()[0];
        result[1] = SequenceManagerHelper.getMaxForExtent(broker, field);
        field = broker.getClassDescriptor(ObjectRepository.C.class).getAutoIncrementFields()[0];
        result[2] = SequenceManagerHelper.getMaxForExtent(broker, field);
View Full Code Here

     */
    public void testMaxKeySearch3()
    {
        PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker();
        long[] result = new long[3];
        FieldDescriptor field = broker.getClassDescriptor(Article.class).getAutoIncrementFields()[0];
        result[0] = SequenceManagerHelper.getMaxForExtent(broker, field);
        // field = broker.getClassDescriptor(AbstractArticle.class).getAutoIncrementFields()[0];
        // result[1] = SequenceManagerHelper.getMaxForExtent(broker, field);
        field = broker.getClassDescriptor(BookArticle.class).getAutoIncrementFields()[0];
        result[1] = SequenceManagerHelper.getMaxForExtent(broker, field);
View Full Code Here

    }

    private void doKeyAnalysing(Class classOne, Class classTwo) throws SequenceManagerException
    {
        PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker();
        FieldDescriptor fieldOne = broker.getClassDescriptor(classOne).getAutoIncrementFields()[0];
        FieldDescriptor fieldTwo = broker.getClassDescriptor(classOne).getAutoIncrementFields()[0];

        List listOne = createKeyList(broker, fieldOne, numberOfKeys);
        List listTwo = createKeyList(broker, fieldTwo, numberOfKeys);
        for (int i = 0; i < listOne.size(); i++)
        {
View Full Code Here

     * test case written by a user
     */
    public void testGetUniqueIdWithOneBroker() throws Exception
    {
        PersistenceBroker pb = PersistenceBrokerFactory.defaultPersistenceBroker();
        FieldDescriptor field = pb.getClassDescriptor(targetClass).getAutoIncrementFields()[0];
        Integer val = (Integer) pb.serviceSequenceManager().getUniqueValue(field);
        int id1 = val.intValue();
        val = (Integer) pb.serviceSequenceManager().getUniqueValue(field);
        int id2 = val.intValue();
        assertTrue(id1 != id2);
View Full Code Here

     */
    public void YYYtest_getUniqueIdWithTwoBrokers() throws Exception
    {
        PersistenceBroker pb = PersistenceBrokerFactory.defaultPersistenceBroker();
        PersistenceBroker pb2 = PersistenceBrokerFactory.defaultPersistenceBroker();
        FieldDescriptor field = pb.getClassDescriptor(targetClass).getAutoIncrementFields()[0];

        Integer val = (Integer) pb.serviceSequenceManager().getUniqueValue(field);
        int id1 = val.intValue();

        val = (Integer) pb2.serviceSequenceManager().getUniqueValue(field);
View Full Code Here

                fail("testSM_StoredProcedure: Expected sequence manager implemenation was " +
                        SequenceManagerStoredProcedureImpl.class.getName());
                return;
            }
            // now we start the tests
            FieldDescriptor field = broker.getClassDescriptor(targetClass).getAutoIncrementFields()[0];
            sm.getUniqueValue(field);

            generatedKeys.clear();
// comment in
//            testSequenceGeneration();
View Full Code Here

    {
        PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker();
        try
        {
            SequenceManager sm = broker.serviceSequenceManager();
            FieldDescriptor fld_1 = broker.getClassDescriptor(SMObjectOne.class).getAutoIncrementFields()[0];
            FieldDescriptor fld_2 = broker.getClassDescriptor(SMObjectTwo.class).getAutoIncrementFields()[0];

            Object result_1 = sm.getUniqueValue(fld_1);
            Object result_2 = sm.getUniqueValue(fld_2);

            assertNotNull(result_1);
View Full Code Here

        buildForeignKeyHeader(cd.getFullTableName(), buffer);

        for (int i = 0; i < keys.length; i++) {
            String columnName = (String) keys[i];

            FieldDescriptor foreignColumn = cd.getPkFields()[i];
            String foreignColumnName = foreignColumn.getPersistentField().getName();
            buildReferenceForColumn(buffer, columnName, foreignColumnName);
            FieldDescriptor fieldDescriptor = (FieldDescriptor)foreignColumn.clone();
            fieldDescriptor.setColumnName(columnName);
            columns.add(fieldDescriptor);
        }
        buffer.append("        </foreign-key>\n");

        addReferenceToTable(collectionDescriptor.getIndirectionTable(), buffer.toString());
View Full Code Here

TOP

Related Classes of org.apache.ojb.broker.metadata.FieldDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.