“How to fix ‘' the Save XML with hibernate and spring
There is a class of Hibernate XML Type and I need to save in postgresql with the help of hibernate @type custom. The class is https://wiki.postgresql.org/wiki/Hibernate_XML_Type
but at the time of saving, it appears that I have not assigned the value.
I think it's because my configuration class, I have not added that property of @type in my configuration, Any Idea
@Getter
@Setter
@Entity
@Table(name = "doc_sri")
public class Bill {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "cod_doc")
private int idBill;
@Column(name = "key_doc")
private String keyBill;
@Column(name = "date_doc")
private String dateIssueBill;
@Type(type = "com.rolandopalermo.facturacion.ec.entity.SQLXMLType")
@Column(name = "xml_doc" )
private String xmlBill;
@Column(name = "status_doc")
private int statusBill;
@Column(name = "type_doc")
private String typeBill;
public Bill( String keyBill, String dateIssueBill, String xmlBill, int statusBill, String typeBill) {
super();
this.keyBill = keyBill;
this.dateIssueBill = dateIssueBill;
this.xmlBill = xmlBill;
this.statusBill = statusBill;
this.typeBill = typeBill;
}
}
Next class is
@Configuration
@ComponentScan({ "com.rolandopalermo.facturacion.ec" })
@PropertySource("classpath:application.properties")
public class WebAppConfig {
private static final String PROPERTY_NAME_DATABASE_DRIVER = "org.postgresql.Driver";
private static final String PROPERTY_NAME_DATABASE_PASSWORD = "admin";
private static final String PROPERTY_NAME_DATABASE_URL = "jdbc:postgresql://localhost:5433/sri_data_base";
private static final String PROPERTY_NAME_DATABASE_USERNAME = "postgres";
private static final String PROPERTY_NAME_HIBERNATE_DIALECT = "org.hibernate.dialect.PostgreSQLDialect";
private static final String PROPERTY_NAME_HIBERNATE_SHOW_SQL = "true";
private static final String PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN = "com.rolandopalermo.facturacion.ec.entity";
private static final String PROPERTY_NAME_ENTITYMANAGER_PACKAGES_MAPPING = "com.rolandopalermo.facturacion.ec.entity.SQLXMLType";
@Bean
public DataSource dataSource() {
DriverManagerDataSource dataSource = null;
try {
dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(PROPERTY_NAME_DATABASE_DRIVER);
dataSource.setUrl(PROPERTY_NAME_DATABASE_URL);
dataSource.setUsername(PROPERTY_NAME_DATABASE_USERNAME);
dataSource.setPassword(PROPERTY_NAME_DATABASE_PASSWORD);
} catch (Exception e) {
// TODO: handle exception
}
return dataSource;
}
@Bean
public LocalSessionFactoryBean sessionFactory() {
LocalSessionFactoryBean sessionFactoryBean = null;
try {
sessionFactoryBean = new LocalSessionFactoryBean();
sessionFactoryBean.setDataSource(dataSource());
sessionFactoryBean.setPackagesToScan(PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN);
sessionFactoryBean.setHibernateProperties(hibProperties());
} catch (Exception e) {
// TODO: handle exception
}
return sessionFactoryBean;
}
private Properties hibProperties() {
Properties properties = null;
try {
properties = new Properties();
properties.put(PROPERTY_NAME_HIBERNATE_DIALECT, PROPERTY_NAME_HIBERNATE_DIALECT);
properties.put(PROPERTY_NAME_HIBERNATE_SHOW_SQL, PROPERTY_NAME_HIBERNATE_SHOW_SQL);
properties.put("xml", PROPERTY_NAME_ENTITYMANAGER_PACKAGES_MAPPING);
} catch (Exception e) {
// TODO: handle exception
}
return properties;
}
@Bean
public HibernateTransactionManager transactionManager() {
HibernateTransactionManager transactionManager = new HibernateTransactionManager();
transactionManager.setSessionFactory(sessionFactory().getObject());
return transactionManager;
}
@Bean
public UrlBasedViewResolver setupViewResolver() {
UrlBasedViewResolver resolver = new UrlBasedViewResolver();
resolver.setPrefix("/WEB-INF/pages/");
resolver.setSuffix(".jsp");
resolver.setViewClass(JstlView.class);
return resolver;
}
}
But when I try to save, it executes the following error
org.postgresql.util.PSQLException: No se ha especificado un valor para el parámetro 5.
java xml spring postgresql hibernate
add a comment |
There is a class of Hibernate XML Type and I need to save in postgresql with the help of hibernate @type custom. The class is https://wiki.postgresql.org/wiki/Hibernate_XML_Type
but at the time of saving, it appears that I have not assigned the value.
I think it's because my configuration class, I have not added that property of @type in my configuration, Any Idea
@Getter
@Setter
@Entity
@Table(name = "doc_sri")
public class Bill {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "cod_doc")
private int idBill;
@Column(name = "key_doc")
private String keyBill;
@Column(name = "date_doc")
private String dateIssueBill;
@Type(type = "com.rolandopalermo.facturacion.ec.entity.SQLXMLType")
@Column(name = "xml_doc" )
private String xmlBill;
@Column(name = "status_doc")
private int statusBill;
@Column(name = "type_doc")
private String typeBill;
public Bill( String keyBill, String dateIssueBill, String xmlBill, int statusBill, String typeBill) {
super();
this.keyBill = keyBill;
this.dateIssueBill = dateIssueBill;
this.xmlBill = xmlBill;
this.statusBill = statusBill;
this.typeBill = typeBill;
}
}
Next class is
@Configuration
@ComponentScan({ "com.rolandopalermo.facturacion.ec" })
@PropertySource("classpath:application.properties")
public class WebAppConfig {
private static final String PROPERTY_NAME_DATABASE_DRIVER = "org.postgresql.Driver";
private static final String PROPERTY_NAME_DATABASE_PASSWORD = "admin";
private static final String PROPERTY_NAME_DATABASE_URL = "jdbc:postgresql://localhost:5433/sri_data_base";
private static final String PROPERTY_NAME_DATABASE_USERNAME = "postgres";
private static final String PROPERTY_NAME_HIBERNATE_DIALECT = "org.hibernate.dialect.PostgreSQLDialect";
private static final String PROPERTY_NAME_HIBERNATE_SHOW_SQL = "true";
private static final String PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN = "com.rolandopalermo.facturacion.ec.entity";
private static final String PROPERTY_NAME_ENTITYMANAGER_PACKAGES_MAPPING = "com.rolandopalermo.facturacion.ec.entity.SQLXMLType";
@Bean
public DataSource dataSource() {
DriverManagerDataSource dataSource = null;
try {
dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(PROPERTY_NAME_DATABASE_DRIVER);
dataSource.setUrl(PROPERTY_NAME_DATABASE_URL);
dataSource.setUsername(PROPERTY_NAME_DATABASE_USERNAME);
dataSource.setPassword(PROPERTY_NAME_DATABASE_PASSWORD);
} catch (Exception e) {
// TODO: handle exception
}
return dataSource;
}
@Bean
public LocalSessionFactoryBean sessionFactory() {
LocalSessionFactoryBean sessionFactoryBean = null;
try {
sessionFactoryBean = new LocalSessionFactoryBean();
sessionFactoryBean.setDataSource(dataSource());
sessionFactoryBean.setPackagesToScan(PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN);
sessionFactoryBean.setHibernateProperties(hibProperties());
} catch (Exception e) {
// TODO: handle exception
}
return sessionFactoryBean;
}
private Properties hibProperties() {
Properties properties = null;
try {
properties = new Properties();
properties.put(PROPERTY_NAME_HIBERNATE_DIALECT, PROPERTY_NAME_HIBERNATE_DIALECT);
properties.put(PROPERTY_NAME_HIBERNATE_SHOW_SQL, PROPERTY_NAME_HIBERNATE_SHOW_SQL);
properties.put("xml", PROPERTY_NAME_ENTITYMANAGER_PACKAGES_MAPPING);
} catch (Exception e) {
// TODO: handle exception
}
return properties;
}
@Bean
public HibernateTransactionManager transactionManager() {
HibernateTransactionManager transactionManager = new HibernateTransactionManager();
transactionManager.setSessionFactory(sessionFactory().getObject());
return transactionManager;
}
@Bean
public UrlBasedViewResolver setupViewResolver() {
UrlBasedViewResolver resolver = new UrlBasedViewResolver();
resolver.setPrefix("/WEB-INF/pages/");
resolver.setSuffix(".jsp");
resolver.setViewClass(JstlView.class);
return resolver;
}
}
But when I try to save, it executes the following error
org.postgresql.util.PSQLException: No se ha especificado un valor para el parámetro 5.
java xml spring postgresql hibernate
add a comment |
There is a class of Hibernate XML Type and I need to save in postgresql with the help of hibernate @type custom. The class is https://wiki.postgresql.org/wiki/Hibernate_XML_Type
but at the time of saving, it appears that I have not assigned the value.
I think it's because my configuration class, I have not added that property of @type in my configuration, Any Idea
@Getter
@Setter
@Entity
@Table(name = "doc_sri")
public class Bill {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "cod_doc")
private int idBill;
@Column(name = "key_doc")
private String keyBill;
@Column(name = "date_doc")
private String dateIssueBill;
@Type(type = "com.rolandopalermo.facturacion.ec.entity.SQLXMLType")
@Column(name = "xml_doc" )
private String xmlBill;
@Column(name = "status_doc")
private int statusBill;
@Column(name = "type_doc")
private String typeBill;
public Bill( String keyBill, String dateIssueBill, String xmlBill, int statusBill, String typeBill) {
super();
this.keyBill = keyBill;
this.dateIssueBill = dateIssueBill;
this.xmlBill = xmlBill;
this.statusBill = statusBill;
this.typeBill = typeBill;
}
}
Next class is
@Configuration
@ComponentScan({ "com.rolandopalermo.facturacion.ec" })
@PropertySource("classpath:application.properties")
public class WebAppConfig {
private static final String PROPERTY_NAME_DATABASE_DRIVER = "org.postgresql.Driver";
private static final String PROPERTY_NAME_DATABASE_PASSWORD = "admin";
private static final String PROPERTY_NAME_DATABASE_URL = "jdbc:postgresql://localhost:5433/sri_data_base";
private static final String PROPERTY_NAME_DATABASE_USERNAME = "postgres";
private static final String PROPERTY_NAME_HIBERNATE_DIALECT = "org.hibernate.dialect.PostgreSQLDialect";
private static final String PROPERTY_NAME_HIBERNATE_SHOW_SQL = "true";
private static final String PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN = "com.rolandopalermo.facturacion.ec.entity";
private static final String PROPERTY_NAME_ENTITYMANAGER_PACKAGES_MAPPING = "com.rolandopalermo.facturacion.ec.entity.SQLXMLType";
@Bean
public DataSource dataSource() {
DriverManagerDataSource dataSource = null;
try {
dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(PROPERTY_NAME_DATABASE_DRIVER);
dataSource.setUrl(PROPERTY_NAME_DATABASE_URL);
dataSource.setUsername(PROPERTY_NAME_DATABASE_USERNAME);
dataSource.setPassword(PROPERTY_NAME_DATABASE_PASSWORD);
} catch (Exception e) {
// TODO: handle exception
}
return dataSource;
}
@Bean
public LocalSessionFactoryBean sessionFactory() {
LocalSessionFactoryBean sessionFactoryBean = null;
try {
sessionFactoryBean = new LocalSessionFactoryBean();
sessionFactoryBean.setDataSource(dataSource());
sessionFactoryBean.setPackagesToScan(PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN);
sessionFactoryBean.setHibernateProperties(hibProperties());
} catch (Exception e) {
// TODO: handle exception
}
return sessionFactoryBean;
}
private Properties hibProperties() {
Properties properties = null;
try {
properties = new Properties();
properties.put(PROPERTY_NAME_HIBERNATE_DIALECT, PROPERTY_NAME_HIBERNATE_DIALECT);
properties.put(PROPERTY_NAME_HIBERNATE_SHOW_SQL, PROPERTY_NAME_HIBERNATE_SHOW_SQL);
properties.put("xml", PROPERTY_NAME_ENTITYMANAGER_PACKAGES_MAPPING);
} catch (Exception e) {
// TODO: handle exception
}
return properties;
}
@Bean
public HibernateTransactionManager transactionManager() {
HibernateTransactionManager transactionManager = new HibernateTransactionManager();
transactionManager.setSessionFactory(sessionFactory().getObject());
return transactionManager;
}
@Bean
public UrlBasedViewResolver setupViewResolver() {
UrlBasedViewResolver resolver = new UrlBasedViewResolver();
resolver.setPrefix("/WEB-INF/pages/");
resolver.setSuffix(".jsp");
resolver.setViewClass(JstlView.class);
return resolver;
}
}
But when I try to save, it executes the following error
org.postgresql.util.PSQLException: No se ha especificado un valor para el parámetro 5.
java xml spring postgresql hibernate
There is a class of Hibernate XML Type and I need to save in postgresql with the help of hibernate @type custom. The class is https://wiki.postgresql.org/wiki/Hibernate_XML_Type
but at the time of saving, it appears that I have not assigned the value.
I think it's because my configuration class, I have not added that property of @type in my configuration, Any Idea
@Getter
@Setter
@Entity
@Table(name = "doc_sri")
public class Bill {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "cod_doc")
private int idBill;
@Column(name = "key_doc")
private String keyBill;
@Column(name = "date_doc")
private String dateIssueBill;
@Type(type = "com.rolandopalermo.facturacion.ec.entity.SQLXMLType")
@Column(name = "xml_doc" )
private String xmlBill;
@Column(name = "status_doc")
private int statusBill;
@Column(name = "type_doc")
private String typeBill;
public Bill( String keyBill, String dateIssueBill, String xmlBill, int statusBill, String typeBill) {
super();
this.keyBill = keyBill;
this.dateIssueBill = dateIssueBill;
this.xmlBill = xmlBill;
this.statusBill = statusBill;
this.typeBill = typeBill;
}
}
Next class is
@Configuration
@ComponentScan({ "com.rolandopalermo.facturacion.ec" })
@PropertySource("classpath:application.properties")
public class WebAppConfig {
private static final String PROPERTY_NAME_DATABASE_DRIVER = "org.postgresql.Driver";
private static final String PROPERTY_NAME_DATABASE_PASSWORD = "admin";
private static final String PROPERTY_NAME_DATABASE_URL = "jdbc:postgresql://localhost:5433/sri_data_base";
private static final String PROPERTY_NAME_DATABASE_USERNAME = "postgres";
private static final String PROPERTY_NAME_HIBERNATE_DIALECT = "org.hibernate.dialect.PostgreSQLDialect";
private static final String PROPERTY_NAME_HIBERNATE_SHOW_SQL = "true";
private static final String PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN = "com.rolandopalermo.facturacion.ec.entity";
private static final String PROPERTY_NAME_ENTITYMANAGER_PACKAGES_MAPPING = "com.rolandopalermo.facturacion.ec.entity.SQLXMLType";
@Bean
public DataSource dataSource() {
DriverManagerDataSource dataSource = null;
try {
dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(PROPERTY_NAME_DATABASE_DRIVER);
dataSource.setUrl(PROPERTY_NAME_DATABASE_URL);
dataSource.setUsername(PROPERTY_NAME_DATABASE_USERNAME);
dataSource.setPassword(PROPERTY_NAME_DATABASE_PASSWORD);
} catch (Exception e) {
// TODO: handle exception
}
return dataSource;
}
@Bean
public LocalSessionFactoryBean sessionFactory() {
LocalSessionFactoryBean sessionFactoryBean = null;
try {
sessionFactoryBean = new LocalSessionFactoryBean();
sessionFactoryBean.setDataSource(dataSource());
sessionFactoryBean.setPackagesToScan(PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN);
sessionFactoryBean.setHibernateProperties(hibProperties());
} catch (Exception e) {
// TODO: handle exception
}
return sessionFactoryBean;
}
private Properties hibProperties() {
Properties properties = null;
try {
properties = new Properties();
properties.put(PROPERTY_NAME_HIBERNATE_DIALECT, PROPERTY_NAME_HIBERNATE_DIALECT);
properties.put(PROPERTY_NAME_HIBERNATE_SHOW_SQL, PROPERTY_NAME_HIBERNATE_SHOW_SQL);
properties.put("xml", PROPERTY_NAME_ENTITYMANAGER_PACKAGES_MAPPING);
} catch (Exception e) {
// TODO: handle exception
}
return properties;
}
@Bean
public HibernateTransactionManager transactionManager() {
HibernateTransactionManager transactionManager = new HibernateTransactionManager();
transactionManager.setSessionFactory(sessionFactory().getObject());
return transactionManager;
}
@Bean
public UrlBasedViewResolver setupViewResolver() {
UrlBasedViewResolver resolver = new UrlBasedViewResolver();
resolver.setPrefix("/WEB-INF/pages/");
resolver.setSuffix(".jsp");
resolver.setViewClass(JstlView.class);
return resolver;
}
}
But when I try to save, it executes the following error
org.postgresql.util.PSQLException: No se ha especificado un valor para el parámetro 5.
java xml spring postgresql hibernate
java xml spring postgresql hibernate
asked Jan 2 at 18:46
Fun CodeFun Code
62
62
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54011593%2fhow-to-fix-the-save-xml-with-hibernate-and-spring%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54011593%2fhow-to-fix-the-save-xml-with-hibernate-and-spring%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown