Guest User

Untitled

a guest
Jan 29th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.07 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
  3. <persistence-unit name="TestePU" transaction-type="RESOURCE_LOCAL">
  4. <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
  5. <class>testepessoa.Pessoa</class>
  6. <properties>
  7. <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5433/PessoaTeste"/>
  8. <property name="javax.persistence.jdbc.user" value="postgres"/>
  9. <property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver"/>
  10. <property name="javax.persistence.jdbc.password" value="doremifa"/>
  11. <property name="javax.persistence.schema-generation.database.action" value="create"/>
  12. </properties>
  13. </persistence-unit>
  14. </persistence>
  15.  
  16. <?xml version="1.0" encoding="UTF-8"?>
  17. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  18. <modelVersion>4.0.0</modelVersion>
  19. <groupId>TestePessoa</groupId>
  20. <artifactId>TestePessoa</artifactId>
  21. <version>1.0-SNAPSHOT</version>
  22. <packaging>jar</packaging>
  23. <dependencies>
  24. <dependency>
  25. <groupId>org.eclipse.persistence</groupId>
  26. <artifactId>javax.persistence</artifactId>
  27. <version>2.1.0</version>
  28. <type>jar</type>
  29. </dependency>
  30. <dependency>
  31. <groupId>org.postgresql</groupId>
  32. <artifactId>postgresql</artifactId>
  33. <version>9.2-1002-jdbc4</version>
  34. </dependency>
  35.  
  36. <dependency>
  37. <groupId>org.eclipse.persistence</groupId>
  38. <artifactId>eclipselink</artifactId>
  39. <version>2.5.2</version>
  40. </dependency>
  41.  
  42. <dependency>
  43. <groupId>org.eclipse.persistence</groupId>
  44. <artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
  45. <version>2.5.2</version>
  46. <scope>provided</scope>
  47. </dependency>
  48. </dependencies>
  49.  
  50. <properties>
  51. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  52. <maven.compiler.source>1.7</maven.compiler.source>
  53. <maven.compiler.target>1.7</maven.compiler.target>
  54. </properties>
  55.  
  56. </project>
  57.  
  58. package testePessoa;
  59.  
  60. import javax.persistence.Entity;
  61. import javax.persistence.Id;
  62.  
  63. @Entity
  64. public class Pessoa {
  65.  
  66. @Id
  67. private int idade;
  68. private String nome;
  69.  
  70.  
  71. public Pessoa(int idade, String nome) {
  72. this.idade = idade;
  73. this.nome = nome;
  74. }
  75.  
  76.  
  77. public int getIdade() {
  78. return idade;
  79. }
  80.  
  81. public void setIdade(int idade) {
  82. this.idade = idade;
  83. }
  84.  
  85. Exception [EclipseLink-63] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DescriptorException
  86. Exception Description: The instance creation method [testePessoa.Pessoa.<Default Constructor>], with no parameters, does not exist, or is not accessible.
  87. Internal Exception: java.lang.NoSuchMethodException: testePessoa.Pessoa.<init>()
  88. Descriptor: RelationalDescriptor(testePessoa.Pessoa --> [DatabaseTable(PESSOA)])
  89.  
  90. Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project TestePessoa: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
  91.  
  92. package testePessoa;
  93.  
  94. import javax.persistence.Entity;
  95. import javax.persistence.Id;
  96.  
  97. @Entity
  98. public class Pessoa {
  99.  
  100. @Id
  101. private int idade;
  102. private String nome;
  103.  
  104. public Pessoa() {
  105. }
  106.  
  107.  
  108. public Pessoa(int idade, String nome) {
  109. this.idade = idade;
  110. this.nome = nome;
  111. }
  112.  
  113.  
  114. public int getIdade() {
  115. return idade;
  116. }
  117.  
  118. public void setIdade(int idade) {
  119. this.idade = idade;
  120. }
  121.  
  122. public String getNome() {
  123. return nome;
  124. }
  125. public void setNome(String nome) {
  126. this.nome = nome;
  127. }
  128.  
  129. }
Add Comment
Please, Sign In to add comment