« first day (584 days earlier)      last day (1654 days later) » 

4:46 AM
good morning @Jens
 
5:09 AM
@greenhorn Good morning
@greenhorn How are you today?
 
@Jens yeah .. i am good today
yesterday i was on leave
 
@greenhorn That's nice
 
@Jens my leave was nice for you huh? :D
 
@greenhorn Sorry may it is a missunderstanding. You not have one day free?
 
@Jens yes i have one free leave but next further leave will incur one day salary loss :(
how about the leave in your office? @Jens
 
5:21 AM
@greenhorn Oh sorry i do not know that.
@greenhorn In germany we normaly have 30 day's of vacation in which you get your normal salary.
 
@Jens if you took 2 leave for a month won't you incur any loss in the salary?
@Jens this you already said
 
@greenhorn That is right. Until you have reached the 30 workdays you have no loss in salary. Also you are ill you have an insurance, so you also do not loss any salary
 
@Jens that's nice friend here we don't have any insurance policies, if we took leave simply we incur loss that's the fact here
 
@greenhorn But the insurance is not for free. You have to pay for it 15% of your salary every month.
 
@Jens here too we have the same like Employee's State Insurance Corporation (ESIC) under this they will deduct certain amount from our salary, if we got any illness we can get free treatment from the ESIC supported hospital
ESIC hospital is government hospital and won't be nice the environment would be awkward @Jens
also doctor's and other employees on the hospital won't care the patient as much
 
5:38 AM
@greenhorn And these insurance is something you must have or is it optional?
 
in most of the companies they have this policy and if they the policy ; it is must @Jens
 
@greenhorn And you have no payed vacation in india?
 
@Jens we don't have such a thing here :(
 
6:07 AM
@jens,@greenhorn good morning
 
@Tajinder Good morning.
 
@jens Could you please help me with yesterday's issue? i read document but still it do not help me in resolving my issue
 
@Tajinder So you have this error message :Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'entityManagerFactory' is defined ?
 
@jens ...i have this
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'applicationRepositoryInterface': Cannot create inner bean '(inner bean)#168a7f8' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#168a7f8': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
and this is how i am trying to access it
@MappedSuperclass
public abstract class AbstractRepository<T> implements JpaRepository<T, Long> {

@Autowired
@PersistenceContext(name = "nextGenEntityManagerFactory")
protected EntityManager nextGenEntityManagerFactory;
@jens
I have resolved error by including @EntityScan({ "com.gatcbiotech.blueberry.crud.*" })
@ComponentScan("com.gatcbiotech.blueberry.crud.*")
@EnableJpaRepositories(basePackages = "com.gatcbiotech.blueberry.crud.*")
@EnableMongoRepositories(basePackages = "com.gatcbiotech.blueberry.crud.repository.*")
by including component scan
 
@Tajinder You can remove the @Autowired annotation from the entityManger.
 
6:20 AM
i thought entityScan and ComponentScan are same
 
@Tajinder Don't think so but not sure.
can you try to add
@Bean
public EntityManager entityManager() {
return entityManagerFactory().getObject().createEntityManager();
}
to your configuration?
 
@jens ,i have added so to access different datasources i will simply make 2 different EntityManagers with specifying beans
@PersistenceContext(name = "nextGenEntityManagerFactory")
protected EntityManager nextGenEntityManagerFactory;

@PersistenceContext(name = "myGatcEntityManagerFactory")
protected EntityManager myGatcEntityManagerFactory;
like this
?
 
@Tajinder I will only try if it works.
 
@Jens my server started successfully :) but was trying to understand that to access 2 different db's ,i need to have 2 different EntityManagers right?
something like this :
@PersistenceContext(name = "nextGenEntityManagerFactory")
protected EntityManager nextGenEntityManagerFactory;

@PersistenceContext(name = "myGatcEntityManagerFactory")
protected EntityManager myGatcEntityManagerFactory;
 
@Tajinder good morning
 
6:26 AM
@Tajinder Yes because you have to differenct datasources and the datasource is a property of the entitymanager
 
@jens , thanks for help once again , now i understand..... :)
 
@Tajinder Don't say thanks. It doesn't work until now :)
@Tajinder Here is a github example github.com/spring-projects/spring-data-examples/tree/master/jpa/… maybe this helps
 
6:45 AM
@jens ...ok iwill search this... other than this my colleague asked me where we will do the basic Crud operations like saving,deleting ,updating ? in Respository itself ? or shall we make Service class corresponding to every repository ?
 
@Tajinder The crud operation are part of the dao, so they should be in the repository i think.
 
@Jens...ok thanks...now i will look into the github code you have given to me...
 
@Tajinder Viel Erfolg :)
 
@jens.... Danke, bis gleich :D
@jens , Git hub code you have given ,i have question why they are not using EntityManagers?
 
@Tajinder Don't know. I haven't written the code.
@Tajinder The programmer use the EM in the test cases.
 
7:42 AM
@jens ...as per code i have created my configs
@Configuration
@EnableJpaRepositories(entityManagerFactoryRef = "gatcEntityManagerFactory", transactionManagerRef = "gatcTransactionManager")
@PropertySource("classpath:application.properties")
public class GatcDbConfig {

@Value("${spring.datasourceGatcLims.driver-class-name}")
String driverClassName = "";
@Value("${spring.datasourceGatcLims.url}")
String url = "";
@Value("${spring.datasourceGatcLims.username}")
String userName = "";
@Value("${spring.datasourceGatcLims.password}")
String password = "";
and for another db
@Configuration
@EnableJpaRepositories(entityManagerFactoryRef = "nextGenEntityManagerFactory", transactionManagerRef = "nextGenTransactionManager")
@PropertySource("classpath:application.properties")
public class NextGenDbConfig {

@Value("${spring.datasourceNextGenLims.driver-class-name}")
String driverClassName = "";
@Value("${spring.datasourceNextGenLims.url}")
String url = "";
@Value("${spring.datasourceNextGenLims.username}")
String userName = "";
@Value("${spring.datasourceNextGenLims.password}")
now in my repository ,will we Autowire ?
 
@Tajinder Yes try it.
 
@jens ...ok great so
@Autowired
protected EntityManager nextGenEntityManagerFactory;

@Autowired
protected EntityManager gatcEntityManagerFactory;
server starts successfully
now i will check it creating some entity
by the way, Can we map entity to view?
 
@Tajinder Yes a VIEW is a "logical" table. At the interface of the database is no difference to a real table.
 
Hi all. In my j2ee application, I have a class thats purpose is to store multiple static final string that represents path for assets or uploaded file folder. Do you know how I could change this system to have a better way to handle environment changing ? How can I deal with multiple environments (test,production) ? Thanks !
 
@Matthieu Use java.util.Properties for that. and put your environment specific values in a properties file.
 
7:53 AM
let's say I have a properties file for some variables : dev.db_port = 80 , prod.db_port = 90 : How can I use one or the other in the code ?
 
@Matthieu I would take one file per server. on properties file for dev one for prod and inside the file you have only a property db_port =
 
ok thanks :)
 
@Matthieu You are welcome.
 
8:49 AM
@jens .,...... i have this OrderController
@RestController
@RequestMapping("/Order")
public class OrderController extends AbstractController<Order> {
@Autowired
OrderRepository order;

// @Autowired
// public OrderController(OrderService service) {
// this.service = service;
// }

@Autowired
OrdertypeService ordertypeService;
@RequestMapping(value = "/testFetch/{id}", method = RequestMethod.GET)
public Order testFetch(@PathVariable Long id) {
System.out.println("id is \n" + order.getInvoiceaddress(id));

return null;
}
and order Repository has
@Repository
@Component
public class OrderRepository extends AbstractRepository<Order> implements
OrderRepositoryInterface {
public OrderRepository() {
}

// @Autowired
// public OrderRepository(OrderRepositoryInterface repositoryInterface) {
// this.repositoryInterface = repositoryInterface;
// }

@Transactional
public java.util.List getInvoiceaddress(Long id) throws DataAccessException {
// javax.persistence.Query query = getNextGenEntityManagerFactory()
// .createQuery("select idcustomer from v_order where id = ?", id);
but when i start server i recieve
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.gatcbiotech.blueberry.crud.repository.order.OrderRepository com.gatcbiotech.blueberry.crud.controller.OrderController.order; nested exception is java.lang.IllegalArgumentException: Can not set com.gatcbiotech.blueberry.crud.repository.order.OrderRepository field com.gatcbiotech.blueberry.crud.controller.OrderController.order to com.sun.proxy.$Proxy111
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProc
all i want is to get id from REST API and execute sample query in OrderRepository
 
 
9:16 AM
@jens yieh but in my case it didnot help.i just tried.
@jens.. Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'orderController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.gatcbiotech.blueberry.crud.repository.order.OrderRepository com.gatcbiotech.blueberry.crud.controller.OrderController.order; nested exception is java.lang.IllegalArgumentException: Can not set com.gatcbiotech.blueberry.crud.repository.order.OrderRepository field com.gatcbiotech.blueberry.crud.controller.
In order controller i am just Autowiring
and in orderRepository @Repository
@Component
public class OrderRepository extends AbstractRepository<Order> implements
OrderRepositoryInterface {
public OrderRepository() {
}



@Transactional
public java.util.List getInvoiceaddress(Long id) throws DataAccessException {
// javax.persistence.Query query = getNextGenEntityManagerFactory()
// .createQuery("select idcustomer from v_order where id = ?", id);
javax.persistence.Query queryTest = getNextGenEntityManagerFactory()
.createNativeQuery(
"select idcustomer from v_order where id = ?",
is it possible that i am extending and implementing interface and class, so thats why ,injection fails?
 
@shyleshkrishna Hi
 
can u help me for this qus
Welcome to Stack Overflow! I edited your question to improve the formatting - please see the editing help for more information on formatting. Good luck! — Wtower 54 mins ago
Welcome to Stack Overflow! I edited your question to improve the formatting - please see the editing help for more information on formatting. Good luck! — Wtower 54 mins ago
ho sorry
0
Q: How to make MySQL database backup

shylesh krishnaÎœy code works properly in local host: Process run = Runtime.getRuntime().exec( "C:\\Program Files\\MySQL\\MySQL Server 5.5\\bin\\mysqldump --host=" + host + " --port=" + port + " --user=" + user + " --password=" + password + " --compact --databases --add-dr...

 
@Tajinder Spring uses proxies (generated classes from interfaces)
 
any body know how to get databases backup form hosted space to local mechine
 
9:23 AM
@Tajinder And if spring uses java standard proxies there are some issues. But i am not so good in explaining proxiing.
@shyleshkrishna create a dump of the database to a fine, and copy it to your local machine
@shyleshkrishna try to use mysqldumpwithout path.
 
is it possible
with out path
 
@shyleshkrishna Yes if the command is in the path of the environment
 
how to set that
 
@shyleshkrishna it depends on the OS do you use.
 
i want to set in my local mechine
windows
7
 
9:34 AM
@shyleshkrishna In windows yoe can use SET PATH="C:\Program Files\MySQL\MySQL Server 5.5\bin\";%PATH%
on a command line
 
he if i am setting my local machine environment, how can i get server MySQL data
if i need do any configuration in server
 
@jens ... no problem jens, thanks anyways, i am looking into it
 
@Tajinder AOP is a lot of magic :)
@shyleshkrishna Sorry it is very unclear what the goal of your questions is.
 
i want to get my server database data in to my local mechine
want to take a backup
server to local mechine
 
@shyleshkrishna Then you have to make a dump of the database on the server and copy it to your local machine.
@shyleshkrishna Do you have access to the server via ssh?
@shyleshkrishna or is your mysql server reachable from your machine?
 
9:40 AM
yes
 
@shyleshkrishna Yes means you have access to server using ssh?
 
i can access mysql databases from my mechine
 
@shyleshkrishna How you do it?
 
through normal connection
in my local system i gave server db and password
by using this connection can i do backup process?
i can do this with phpmyadmin , i want to know any programmatic way
 
9:55 AM
@jens .... Caused by: java.io.IOException: Eine bestehende Verbindung wurde softwaregesteuert
durch den Hostcomputer abgebrochen this means connection has not been established right ? or it is because of wrong query >?
@jens i am using this query for my testing
javax.persistence.Query query = getNextGenEntityManagerFactory()
.createNativeQuery(
"select idcustomer from v_order where id = ?",
String.valueOf(id));
id will come from controller
@jens ...my connection is fine ,probably something wrong with query
public List fetchOrders(Long id) {
if (getNextGenEntityManagerFactory().isOpen()) {
System.out.println("connection is fine");
}
javax.persistence.Query query = getNextGenEntityManagerFactory()
.createNativeQuery(
"select idcustomer from v_order where id = ?",
String.valueOf(id));

return query.getResultList();

}
 
Good Evening!
 
@jude .... good afternoon...is it evening there?
 
fine. not so bad
what about you?
 
@JudeNiroshan good evening
@Tajinder It looks like the connection was established and after that it would be terminated.
@shyleshkrishna Have you seen this thread stackoverflow.com/questions/20820213/…?
 
10:11 AM
@Jens u have any idea bout that back up?
 
@shyleshkrishna calling mysqldump is the correct way
 
@shyleshkrishna here an other thread: stackoverflow.com/questions/2989724/…
 
10:26 AM
@Jens @Tajinder for using native query I use enitymanager.createnativequery()
but you are using getNextGenEntityManagerFactory()
is this getNextGenEntityManagerFactory() return entiymanager or its a special method?
 
@SpringLearner It returns an LocalContainerEntityManagerFactoryBean.
@SpringLearner It is an implementation of EntityManagerFactory
@SpringLearner But also we do not want to use native queries. We are talking about spring-data-jpa with multiple datasources.
 
10:44 AM
@SpringLearner....hii... i tried with nativeQuery as well and TYpedQuery for my testing .
@Springlearner TypedQuery<Order> query = getNextGenEntityManagerFactory().createQuery(
"select idcustomer from v_order", Order.class);
it says v_order is not mapped
org.hibernate.hql.internal.ast.QuerySyntaxException: v_order is not mapped
at org.hibernate.hql.internal.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:189)
at org.hibernate.hql.internal.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:109)
at org.hibernate.hql.internal.ast.tree.FromClause.addFromElement(FromClause.java:95)
at org.hibernate.hql.internal.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:332)
but ofcourse i have done that
@Entity
@Table(name = "v_order")
public class Order extends AbstractEntity {
v_order is view.... but that does not matter as Jens said.
 
@Tajinder Think the packages to scan is not correct.
@Tajinder return getNextGenEntityManagerFactory a entitymanager?
 
@Jens yes as you suggested...i have created it like this
@Bean
public LocalContainerEntityManagerFactoryBean nextGenEntityManagerFactory() {
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setGenerateDdl(true);

LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean();

factoryBean.setDataSource(nextGenDataSource());
factoryBean.setJpaVendorAdapter(vendorAdapter);
factoryBean.setPackagesToScan(R.nextGenDB_PACKAGE);

return factoryBean;
}
and nextGenDB_PACKAGE = "com.gatcbiotech.blueberry.crud.*";
i have used * to include all the packages.....
 
@Tajinder Can you try it with a real table?
 
@jens ok
 
@Tajinder If any thing is not working JPA then go for native
 
10:52 AM
@Tajinder I am a little bit confueed that getNextGenEntityManagerFactory().createQuery compiles.
I can no see in the javadoc that LocalContainerEntityManagerFactoryBean has a method createQuery
 
@jens... unfortunately i cannot access real table as i told you we will use view for new project... and my entity is according to view...it do not include fields exactly mapped to old db.
@jens it does have ...see
/**
* Create an instance of <code>Query</code> for executing a
* Java Persistence query language statement.
* @param qlString a Java Persistence query string
* @return the new query instance
* @throws IllegalArgumentException if the query string is
* found to be invalid
*/
public Query createQuery(String qlString);

/**
* Create an instance of <code>TypedQuery</code> for executing a
* criteria query.
* @param criteriaQuery a criteria query object
* @return the new query instance
* @throws IllegalArgumentException if the criteria query is
 
@Tajinder At one moment i wasn't sure that i am right with views and tables. But i have googled it and i am right with this.
@Tajinder I can not find it here docs.spring.io/spring/docs/current/javadoc-api/org/… maybe i am blind.
 
@jens... no...i looked in EntityManager.class
 
@Tajinder But getNextGenEntityManagerFactory retuns a factory or not?
 
@jens ... yes but see
@SuppressWarnings("serial")
public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManagerFactoryBean
implements ResourceLoaderAware, LoadTimeWeaverAware {
it is extending entitymanager
@jens ublic abstract class AbstractEntityManagerFactoryBean implements
FactoryBean<EntityManagerFactory>, BeanClassLoaderAware, BeanFactoryAware, BeanNameAware,
InitializingBean, DisposableBean, EntityManagerFactoryInfo, PersistenceExceptionTranslator, Serializable {
my bean is returning LocalContainerEntityManagerFactoryBean
and i am Autowiring @Autowired
protected EntityManager nextGenEntityManagerFactory;
 
11:02 AM
@Tajinder Ok haven't seen this in the moment
 
@springlearner yes i will do that :),but so far i am not successful in running any of the queries.....
 
@Tajinder Can you show the complete stacktrace please?
@Tajinder .... Caused by: java.io.IOException
@Tajinder Also isOpen()only says "Determine whether the entity manager is open. " i do not know if this also means the connection is open !
 
11:31 AM
@jens ...i am not able to create same scenario now but i strongly believe something wrong with my entityManager thing
public List<Order> fetchOrders(Long old_id) {
if (getNextGenEntityManagerFactory().isOpen()) {
System.out.println("connection is fine");
}
Query query = getNextGenEntityManagerFactory().createNativeQuery(
"select count(*) from v_order");
Order order = getNextGenEntityManagerFactory()
.find(Order.class, old_id);
int results = query.getFirstResult();
i tried both native and normal ...both are null... and ofcourse i can query the same in my db console and data is there...
 
@Tajinder Why you do not use the property nextGenEntityManagerFactory?
 
@jens ... getNextGenEntityManagerFactory is simple getter setter nothing else...
 
@Tajinder and it returns nextGenEntityManagerFactory?
 
@jens yes
 
@Tajinder It is really hard to say from here what is happend.
 
11:38 AM
@jens... i am going for lunch... i almost forgt because of work.. :) will message once am back
 
12:19 PM
@jens ..if you have time may be team viewer?
 
@Tajinder Yes let us try it.
 
okay
i am sending you mail with username and password
 
@Tajinder okay
 
12:35 PM
@Jens
String hashCheck="hello";
	System.out.println(hashCheck.hashCode());
	hashCheck=null;
	hashCheck="hello";
	System.out.println(hashCheck.hashCode());
hashcode methods converts address internally and return int
so first sysout will return 99162322
then I am making it null
so no address
 
@SpringLearner It has an algorithm to calculate the hashcode.
 
but again when I initate same value then why it showing same value 99162322
 
see the implentation of public int hashCode() {
int h = hash;
if (h == 0 && value.length > 0) {
char val[] = value;

for (int i = 0; i < value.length; i++) {
h = 31 * h + val[i];
}
hash = h;
}
return h;
}
@SpringLearner or read here: tutorialspoint.com/java/java_string_hashcode.htm the hashcode is calculated from the value of the string. Not from tha address.
 
@SpringLearner Yust a moment.
 
see this paragraph
What is Hashing

Hashing in its simplest form, is a way to assigning a unique code for any variable/object after applying any formula/algorithm on its properties. A true Hashing function must follow this rule:

Hash function should return the same hash code each and every time, when function is applied on same or equal objects. In other words, two equal objects must produce same hash code consistently.

All objects in java inherit a default implementation of hashCode() function defined in Object class. This function produce hash code by typically converting the internal address of the objec
 
1:30 PM
@SpringLearner Yes but String overrides the hashCode method.
 
2:30 PM
@jens : is it legal to use team viewer in companies here ?
 
 
1 hour later…
3:40 PM
Don't Know. That depends on the Company. It can be problematic
 
4:37 PM
@Jens if a class does not override hashcode then that objects hashcode will give adress?
 

« first day (584 days earlier)      last day (1654 days later) »