Magazine
 
Maven2 with JPA Example

</executions>
<configuration>
<mainClass>hello.HelloWorld
</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<!--
<repositories>
<repository>
<id>scriptlandia-repo</id>
<name>Scriptlandia Maven2 repository
</ name>
<url>http://scriptlandiarepository.
googlecode.com/svn/trunk/
tools</url>
</repository>
</repositories>
-->
</project>

4. Open the command prompt. Go inside
the project directory of your application
(MyApplication in this case) and run the
"mvn compile exec:java" command.

C:\MyApplication >mvn compile exec:java

After successfully running the command, your command prompt will display the output on the console shown below: Hibernate:

insert
into
MESSAGES
(MESSAGE_ID, MESSAGE_TEXT,
NEXT_MESSAGE_ID)
values
(null, ?, ?)
Hibernate:
call identity()
Hibernate:
insert
into
MESSAGES
(MESSAGE_ID, MESSAGE_TEXT,
NEXT_MESSAGE_ID)
values
(null, ?, ?)

 

Hibernate:
call identity()
Hibernate:
insert
into
MESSAGES
(MESSAGE_ID, MESSAGE_TEXT,
NEXT_MESSAGE_ID)
values
(null, ?, ?)
Hibernate:
call identity()
Hibernate:
select
message0_.MESSAGE_ID as
MESSAGE1_0_,
message0_.MESSAGE_TEXT as
MESSAGE2_0_,
message0_.NEXT_MESSAGE_ID as
NEXT3_0_
from
MESSAGES message0_
order by
message0_.MESSAGE_TEXT asc
3 message(s) found:
Hello World with JPA
This is message 2
This is message 3
Aug 21, 2007 3:18:06 AM
org.hibernate.impl.SessionFactoryImpl
close
INFO: closing
[INFO] ---------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ---------------------------------
[INFO] Total time: 34 seconds
[INFO] Finished at: Tue Aug 21 03:18:06
GMT+05:30 2007
[INFO] Final Memory: 6M/11M
[INFO] ---------------------------------

On building successfully, our application displays the messages given below on the console:

Hello World with JPA
This is message 2
This is message 3

Download Maven2JPA Source Code

Sept 2007 | Java Jazz Up | 39
 
previous
index
next
 
Pages: 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, 52, 53 , 54, 55, 56, 57,

58
, 59, 60, 61, 62, 63 , 64, 65 , 66 , 67 , 68 , 69 , 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,   Download PDF