Couldn't get default View id for database

Hello everyone,I used java agent in domino designer to create an e-mail with document link. Here is my sample code.

Document memo = database.createDocument();

RichTextItem body = memo.createRichTextItem(“Body”);

//DAL = my own DA class

Document linkDocument = DAL.getDocumentById(1);

body.appendDocLink(linkDocument);

I got the following error when agent was running:

NotesException: Couldn’t get default View id for database (Application\dis.nsf)

at lotus.domino.local.RichTextItem.NappendDocLink(Native Method)

at lotus.domino.local.RichTextItem.appendDocLink(Unknown Source)

at lotus.domino.local.RichTextItem.appendDocLink(Unknown Source)

at application.PendingIrMailer.send(PendingIrMailer.java:69)

at agent.MailReminder.JavaAgent.checkDue(JavaAgent.java:71)

at agent.MailReminder.JavaAgent.NotesMain(JavaAgent.java:26)

at lotus.domino.AgentBase.runNotes(Unknown Source)

at lotus.domino.NotesThread.run(Unknown Source)

Is there something wrong with my view? In my DAL class, the linkDocument is retrieved from

database.search(“Select Form = XXX”,null,0), not from view. Beside, I had checked the linkDocument variable. It is not null.

Please help. Thank you.

Subject: Your database has no default view…

… and since you didn’t obtain the NotesDocument from a view, the doclink doesn’t mention a specific view. That’s why the client doesn’t know what view to use when you click the link.