Glen

If I'm reading your code correctly, your method
public void insert(String filename)
is on Pac. Is that right?

The reason your code isn't working is that the "insert" instance of Pac in the insert() method is a local variable. So, when you call

test.insert("blah");
test.getPrimaryKey();

getPrimaryKey() returns 0 because it is 0.

You can fix this by changing your method signature to return an int value of the new primary key.

    public int insert(String filename)
    {
        Pac insert = new Pac();
        try
        {
            insert.setFilename(filename);
            insert.save();
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
        return insert.getPrimaryKey();
    }

Does that help?

Eric


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to