-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.java
51 lines (40 loc) · 1.23 KB
/
App.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package com.example;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
/**
* Hello world!
*
*/
public class App
{
public App()
{
// TODO Auto-generated constructor stub
}
public void insertIntoMongo()
{
Email email = new Email();
email.setMessageId( "1" );
email.setSubject( "Please Join Meeting" );
email.setBody( "Agenda: RFP discussion" );
email.setZipcode( 560085 );
email.setFrom( new Contact( "a", "Amresh", "Singh", "[email protected]" ) );
email.addTo( new Contact( "b", "Vivek", "Mishra", "[email protected]" ) );
email.addTo( new Contact( "c", "Saurabh", "Singh", "[email protected]" ) );
email.addAttachment( new Attachment( "aaa", "Agenda.doc", "MS Word" ) );
email.addAttachment( new Attachment( "bbb", "MOM_Last_Meeting.xls", "MS Excel" ) );
email.addAttachment( new Attachment( "ccc", "Client_Feedback.txt", "Text" ) );
EntityManagerFactory emf = Persistence.createEntityManagerFactory( "ac" );
EntityManager em = emf.createEntityManager();
em.persist( email );
em.close();
emf.close();
System.out.println( "All done" );
}
public static void main( String[] args )
{
App app = new App();
app.insertIntoMongo();
}
}