javahibernateflutterpackagenaming-conventions

Can not use .in domain name in package


I tried to search on stack overflow regarding the issue I am facing but did not find any satisfactory answer. So, please read my question first and suggest.

I have a .co.in domain that I want to use to prepare packages. But as per new java conventions(?) the keyword 'in' can not be used at starting of package name. Hence, I am getting problems in building applications. I have problem in building android application with flutter due to package name format in.co.mydomain.myapp. The problem persists in JavaFX applications also where I am using hibernate ORM. When application is run in debug mode, I see HQL queries generated with fully qualified names of entity class resulting into in.co.mydomain.myapp.entities.Student, here also 'in' keyword is a reserved keyword of SQL queries hence it throws errors.

I need expert advice in such a horrible situation I am facing.

The whole thing works without any problem when I rename package to com.mydomain.myapp


Solution

  • In some cases, the internet domain name may not be a valid package name. This can occur if the domain name contains a hyphen or other special character, if the package name begins with a digit or other character that is illegal to use as the beginning of a Java name, or if the package name contains a reserved Java keyword, such as "int". In this event, the suggested convention is to add an underscore.

    https://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html

    So you could use in_.co.mydomain