Skip to content

Instantly share code, notes, and snippets.

@InfoSec812
Created September 12, 2013 18:04
Show Gist options
  • Select an option

  • Save InfoSec812/6541526 to your computer and use it in GitHub Desktop.

Select an option

Save InfoSec812/6541526 to your computer and use it in GitHub Desktop.
Mapping a stored procedure in JPA 2.0
@Entity(name="com.hps.mdm.legacy.domain.person")
@Table(name = "PERSON")
@SqlResultSetMapping(name="myMapping", entities={Person.class, Agent.class, Contact.class})
@NamedNativeQuery(name="PersonPLSQL", query="CALL STORED PROCEDURE", resultSetMapping="myMapping")
public @Data class Person implements Serializable {
private static final long serialVersionUID = 1L;
// @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
@Id
@Basic(optional = false)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment